CVE-2022-21724: Unchecked Class Instantiation when providing Plugin Classes
pgjdbc is the offical PostgreSQL JDBC Driver. A security hole was found in the jdbc driver for postgresql database while doing security research. The system using the postgresql library will be attacked when attacker control the jdbc url or properties. pgjdbc instantiates plugin instances based on class names provided via authenticationPluginClassName, sslhostnameverifier, socketFactory, sslfactory, sslpasswordcallback connection properties. However, the driver did not verify if the class implements the expected interface before instantiating the class. This can lead to code execution loaded via arbitrary classes. Users using plugins are advised to upgrade. There are no known workarounds for this issue.
Other sources
pgjdbc is the offical PostgreSQL JDBC Driver. A security hole was found in the jdbc driver for postgresql database while doing security research. The system using the postgresql library will be attacked when attacker control the jdbc url or properties. pgjdbc instantiates plugin instances based on class names provided via authenticationPluginClassName, sslhostnameverifier, socketFactory, sslfactory, sslpasswordcallback connection properties. However, the driver did not verify if the class implements the expected interface before instantiating the class. This can lead to remote code execution loaded via arbitrary classes. Users using plugins are advised to upgrade. There are no known workarounds for this issue.
Reference: https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-v7wg-cpwc-24m4
Upstream patch: https://github.com/pgjdbc/pgjdbc/commit/f4d0ed69c0b3aae8531d83d6af4c57f22312c813
— Red Hat
PostgreSQL JDBC Driver (PgJDBC) could allow a remote authenticated attacker to execute arbitrary code on the system, caused by an unchecked class instantiation when providing plugin classes. By sending a specially-crafted request using the "authenticationPluginClassName", "sslhostnameverifier", "socketFactory", "sslfactory", "sslpasswordcallback" classes, an attacker could exploit this vulnerability to execute arbitrary code on the system.
Affected Software
Remediation
Event History
Parent advisories
This vulnerability appears in the following advisories.
Frequently Asked Questions
What is CVE-2022-21724?
CVE-2022-21724 is a vulnerability in the PostgreSQL JDBC Driver (PgJDBC) that could allow a remote authenticated attacker to execute arbitrary code.
How does the vulnerability in CVE-2022-21724 occur?
The vulnerability in CVE-2022-21724 occurs when the jdbc url or properties are controlled by the attacker, which can lead to the execution of arbitrary code.
What is the severity of CVE-2022-21724?
The severity of CVE-2022-21724 is high, with a CVSS base score of 8.5.
Which software versions are affected by CVE-2022-21724?
The PostgreSQL JDBC Driver versions up to and exclusive of 42.2.25 and 42.3.2 are affected by CVE-2022-21724.
How can I fix the vulnerability in CVE-2022-21724?
To fix the vulnerability in CVE-2022-21724, you should update the PostgreSQL JDBC Driver to version 42.2.25 or higher.