# 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.

- **Severity:** High 7.0 (`CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H`)
- **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:** Yes
- **Published:** 2 Feb 2022
- **Updated:** 5 May 2025
- **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, MINI-h5f2-x5fv-p23j, MINI-jfcf-fqxp-3hfc, MINI-xwvg-3933-m7vh, OESA-2022-1535, UBUNTU-CVE-2022-21724

## 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 (Improper Initialization)

## 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 | Ecosystem | 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: 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.

## 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

- [CVE-2015-3306](https://insights.sbomify.com/CVE-2015-3306/): ProFTPD Improper Access Control (critical 10.0, exploited in the wild)
- [CVE-2025-49113](https://insights.sbomify.com/CVE-2025-49113/): RoundCube Webmail Deserialization of Untrusted Data (critical 9.9, exploited in the wild)
- [CVE-2026-24061](https://insights.sbomify.com/CVE-2026-24061/): GNU InetUtils Argument Injection (critical 9.8, exploited in the wild)
- [CVE-2025-39682](https://insights.sbomify.com/CVE-2025-39682/): Linux Kernel Improper Check for Unusual or Exceptional Conditions (critical 9.8, exploited in the wild)
- [CVE-2024-9680](https://insights.sbomify.com/CVE-2024-9680/): Mozilla Firefox Use-After-Free (critical 9.8, exploited in the wild)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-21724 and fix it if it is affected.

What it is: 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.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-21724 exists.

Affected packages and fixed versions:
- org.postgresql:postgresql (Maven): affected from 42.3.0; fixed in 42.3.2
- org.postgresql:postgresql (Maven): affected from 42.3.0; fixed in 42.3.2
- org.postgresql:postgresql (Maven): affected from 9.4.1208; fixed in 42.2.25
- org.postgresql:postgresql (Maven): affected from 9.4.1208; fixed in 42.2.25
- postgresql-jdbc-driver (Bitnami): affected all versions; fixed in 42.2.25, 42.3.2

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2022-21724/ (Markdown: https://insights.sbomify.com/CVE-2022-21724/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2022-21724
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2022-21724
- OSV: https://osv.dev/vulnerability/CVE-2022-21724

---
From sbomify Insights: https://insights.sbomify.com/CVE-2022-21724/
Summaries are generated and may contain mistakes; the official description above is the record.
