Critical Code Execution Vulnerability in PostgreSQL JDBC Driver (libpgjava)

libpgjava Updated 02 Oct 2025

Summary

02/02/2022
N/A
Yes i
Critical
9.8

CVE-2022-21724: pgjdbc is the offical PostgreSQL JDBC Driver. Affects libpgjava across 3 version ranges.

< 42.2.15-1+deb11u1 < c7555123aaef705d6e35693da4c0daa3db2e9cd7 < f4d0ed69c0b3aae8531d83d6af4c57f22312c813

Fixed in 42.2.15-1+deb11u1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

The PostgreSQL JDBC Driver, known as pgjdbc, is the official driver for connecting Java applications to PostgreSQL databases. It allows developers to execute SQL queries and manage database connections seamlessly. However, a significant security vulnerability has been identified in the driver, which can lead to severe consequences if exploited. The vulnerability arises from the driver's failure to validate class names provided in connection properties, potentially allowing attackers to execute arbitrary code.

Vulnerability Detail

A security hole was discovered in the PostgreSQL JDBC Driver (pgjdbc) during security research. The vulnerability stems from the driver's ability to instantiate plugin instances based on class names provided via connection properties such as 'authenticationPluginClassName' and 'sslFactory'. The driver does not verify whether the specified class implements the expected interface before instantiation. This oversight can lead to code execution via arbitrary classes, posing a significant risk to systems using the driver. The CVSS score for this vulnerability is 9.8, indicating a critical severity level.

How To Fix

Minimum fixed version

42.2.15-1+deb11u1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade libpgjava

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There are no known workarounds for this issue. The best course of action is to upgrade to the fixed versions of the PostgreSQL JDBC Driver as mentioned above.

Conclusion

The PostgreSQL JDBC Driver vulnerability (CVE-2022-21724) poses a critical risk due to its potential for arbitrary code execution. Users are strongly advised to upgrade to the latest versions of the driver to mitigate this risk. Regular monitoring and updates are essential to maintain the security of applications using this driver.

See every vulnerability recorded for libpgjava →

Share this vulnerability

FAQ

The PostgreSQL JDBC Driver (pgjdbc) is a Java-based driver that enables Java applications to connect to and interact with PostgreSQL databases.

This vulnerability allows an attacker to execute arbitrary code on the system by controlling the class names provided in the JDBC connection properties.

You can use the Vulert platform to monitor and alert for open-source vulnerabilities in your software. By using a manifest file like package-lock.json, Vulert can identify if your application is affected by this vulnerability.

The CVSS score of this vulnerability is 9.8, indicating a critical level of severity.

You can upgrade the driver using package management commands. For Debian 11, use 'apt-get install libpgjava=42.2.15-1+deb11u1'. For Debian 12 and 13, use 'apt-get install libpgjava=42.3.2-1'.

Related vulnerabilities

Recent vulnerabilities recorded for libpgjava.

How To Fix

Minimum fixed version

42.2.15-1+deb11u1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade libpgjava

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback