Information Disclosure Vulnerability in pgjdbc (CVE-2022-41946)

libpgjava Updated 02 Oct 2025

Summary

23/11/2022
N/A
Yes i
Medium
5.5

CVE-2022-41946: pgjdbc is an open source postgresql JDBC Driver. Affects libpgjava across 2 version ranges.

< 42.2.15-1+deb11u2 < 9008dc9aade6dbfe4efafcd6872ebc55f4699cf5

Fixed in 42.2.15-1+deb11u2. 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 Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

pgjdbc is an open-source PostgreSQL JDBC Driver that enables Java applications to interact with PostgreSQL databases. It provides a robust and efficient way to execute SQL queries and manage database connections. However, certain versions of pgjdbc are susceptible to an information disclosure vulnerability that arises when handling large InputStreams in prepared statements.

Vulnerability Detail

The vulnerability, identified as CVE-2022-41946, occurs when a prepared statement uses either PreparedStatement.setText(int, InputStream) or PreparedStatement.setBytea(int, InputStream) with InputStreams larger than 2k. This results in the creation of temporary files in the system's temporary directory, which are readable by other users on Unix-like systems. This poses a risk of sensitive information being exposed to unauthorized users, although it does not allow them to modify the files. The issue is particularly relevant for users on Java versions prior to 1.7, as no patch is available for these versions.

How To Fix

Minimum fixed version

42.2.15-1+deb11u2

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

If upgrading is not feasible, users running Java 1.6 or lower can mitigate the vulnerability by specifying the java.io.tmpdir system environment variable to point to a directory that is exclusively owned by the executing user. This can be done by adding the following line to your Java application startup script:

-Djava.io.tmpdir=/path/to/secure/tmpdir

Conclusion

CVE-2022-41946 represents a significant information disclosure vulnerability in the pgjdbc PostgreSQL JDBC Driver, particularly affecting users on Unix-like systems. It is crucial for users to upgrade to the latest versions or implement workarounds to safeguard sensitive information from unauthorized access.

See every vulnerability recorded for libpgjava →

Share this vulnerability

FAQ

CVE-2022-41946 is an information disclosure vulnerability in the pgjdbc PostgreSQL JDBC Driver that allows sensitive data to be exposed through temporary files.

All versions of pgjdbc prior to 4.5.0 are affected when using Java 1.7 and above. Java 1.6 and lower versions do not have a patch available.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

If you are unable to upgrade your Java version, set the java.io.tmpdir system environment variable to a secure directory that is exclusively owned by the executing user.

The CVSS score for CVE-2022-41946 is 5.5, indicating a moderate level of risk associated with this vulnerability.

Related vulnerabilities

Recent vulnerabilities recorded for libpgjava.

How To Fix

Minimum fixed version

42.2.15-1+deb11u2

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