CVE-2022-21724 Unchecked Class Instantiation when providing Plugin Classes
Attackers can execute arbitrary code by providing malicious class names in connection properties, requiring an upgrade to the PostgreSQL JDBC Driver.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Local or same network only
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2022-21724?
CVE-2022-21724 is a high-severity code injection vulnerability in Debian Debian Linux, published on 2 Feb 2022. It can only be exploited from the same machine or local network, with no action from the victim.
Official description
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.
Weakness: CWE-665
Which versions are affected by CVE-2022-21724?
5 open source packages ship an affected version, including org.postgresql:postgresql and postgresql-jdbc-driver. It affects 4 products.
| Package | Affected | Fixed in |
|---|---|---|
org.postgresql:postgresql Maven | From 42.3.0 | 42.3.2 |
org.postgresql:postgresql Maven | From 42.3.0 | 42.3.2 |
org.postgresql:postgresql Maven | From 9.4.1208 | 42.2.25 |
org.postgresql:postgresql Maven | From 9.4.1208 | 42.2.25 |
postgresql-jdbc-driver Bitnami | All versions | 42.2.25, 42.3.2 |
Products include Debian Debian Linux, Fedoraproject Fedora, Postgresql Postgresql Jdbc Driver, Quarkus Quarkus.
How do I fix CVE-2022-21724?
Upgrade org.postgresql:postgresql to a fixed version for your release line: 42.3.2 or 42.2.25.
Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.
Is CVE-2022-21724 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-21724 exists.
Other vulnerabilities in Debian Debian Linux
Sources
Also known as BIT-postgresql-jdbc-driver-2022-21724, CLEANSTART-2026-ZQ49670, CLSA-2026-1775033648, DEBIAN-CVE-2022-21724, DLA-3018-1, GHSA-v7wg-cpwc-24m4 and 5 more.