NIST deprecates RSA-2048 from 2030. Find every one of them before attackers do.
☕
☕ Maven
Not in CISA KEV
MEDIUM severity

CVE-2022-41946 — postgresql

MEDIUMFix: pgjdbc/pgjdbc@9008dc9

CVE-2022-41946 is a medium-severity (CVSS 4.7) Information Exposure vulnerability in org.postgresql:postgresql. 1 public exploit or proof-of-concept reference is indexed, so weaponization risk is real. A fix is available for org.postgresql:postgresql — see the affected versions and patch details below.

TemporaryFolder on unix-like systems does not limit access to created files in pgjdbc

Also known asBIT-postgresql-jdbc-driver-2022-41946GHSA-562r-vg33-8x8h
Published
Updated
Affected
4 pkgs
Patched
4 / 4
Exploits
1 known
Exploitation data as of Nov 8, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

EPSS Exploitation Probability

via FIRST.org ↗
0.6%probability of exploitation in next 30 days
Lower Risk0.00%
Lower risk than most CVEs46th percentile — riskier than 46% of all scored CVEsHighest risk
0.00%0.35%0.70%1.05%0.1%0.6%May 26Sep 26Nov 26

Probability of exploitation in the next 30 days, from FIRST.org EPSS.

How urgent is this, really

Where this sits among everything scored

Real-World Exposure

4 pkgs affected
☕org.postgresql:postgresql☕org.postgresql:postgresql☕org.postgresql:postgresql☕org.postgresql:postgresql

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects Maven packages — download data is not available via public APIs for these ecosystems.

Description

Vulnerability

PreparedStatement.setText(int, InputStream) and

PreparedStatemet.setBytea(int, InputStream)

will create a temporary file if the InputStream is larger than 51k

Example of vulnerable code:

String s = "some very large string greater than 51200 bytes";

PreparedStatement.setInputStream(1, new ByteArrayInputStream(s.getBytes()) );

This will create a temporary file which is readable by other users on Unix like systems, but not MacOS.

Impact On Unix like systems, the system's temporary directory is shared between all users on that system. Because of this, when files and directories are written into this directory they are, by default, readable by other users on that same system.

This vulnerability does not allow other users to overwrite the contents of these directories or files. This is purely an information disclosure vulnerability.

When analyzing the impact of this vulnerability, here are the important questions to ask:

Is the driver running in an environment where the OS has other untrusted users. If yes, and you answered 'yes' to question 1, this vulnerability impacts you. If no, this vulnerability does not impact you. Patches Because certain JDK file system APIs were only added in JDK 1.7, this this fix is dependent upon the version of the JDK you are using.

Java 1.8 and higher users: this vulnerability is fixed in 42.2.27, 42.3.8, 42.4.3, 42.5.1 Java 1.7 users: this vulnerability is fixed in 42.2.27.jre7 Java 1.6 and lower users: no patch is available; you must use the workaround below. Workarounds If you are unable to patch, or are stuck running on Java 1.6, specifying the java.io.tmpdir system environment variable to a directory that is exclusively owned by the executing user will fix this vulnerability.

References CWE-200: Exposure of Sensitive Information to an Unauthorized Actor Fix commit https://github.com/pgjdbc/pgjdbc/commit/9008dc9aade6dbfe4efafcd6872ebc55f4699cf5 Similar Vulnerabilities Google Guava - https://github.com/google/guava/issues/4011 Apache Ant - https://nvd.nist.gov/vuln/detail/CVE-2020-1945 JetBrains Kotlin Compiler - https://nvd.nist.gov/vuln/detail/CVE-2020-15824

Affected Packages

4 total 4 fixed
EcosystemPackageVulnerable rangeFix
☕Mavenorg.postgresql:postgresql≥ 42.2.0&&< 42.2.2742.2.27org.postgresql:postgresql:42.2.27
☕Mavenorg.postgresql:postgresql≥ 42.3.0&&< 42.3.842.3.8org.postgresql:postgresql:42.3.8
☕Mavenorg.postgresql:postgresql≥ 42.4.0&&< 42.4.342.4.3org.postgresql:postgresql:42.4.3
☕Mavenorg.postgresql:postgresql≥ 42.5.0&&< 42.5.142.5.1org.postgresql:postgresql:42.5.1

Affected Products

2 products · 6 configurations
OS
debian linuxdebian
1 version
10.0
Application
postgresql jdbc driverpostgresql
≥ 42.4.0 && < 42.4.3
1 version
42.5.0
Exploits & PoCs
1

Research use only. For defensive security, authorized penetration testing, and academic research only. Never execute exploit code against systems without explicit written authorization.

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for org.postgresql:postgresql, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update org.postgresql:postgresql to 42.2.27 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2022-41946 is resolved across your whole dependency graph.

  3. Workarounds

    Assume what was exposed is already known: rotate any credential, token or key that the affected component could return, restrict the endpoint to callers that genuinely need it, and strip sensitive fields from responses and error output at the boundary rather than relying on the client not to read them.

Fixing This On Your OS

If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.

Red HatModerate

Red Hat Satellite ships a PostgreSQL JDBC Driver for Hibernate ORM framework, which is embeds into Candlepin. Although Candlepin itself doesn't make direct use of the PreparedStatement methods from the PostgreSQL JDBC Driver, Hibernate ORM does utilize these methods, potentially making framework affected. Satellite…

ProductFixed inAdvisory
CEQ 2.13.2-1see advisoryRHSA-2023:0888
Red Hat build of Quarkussee advisoryRHSA-2023:0758
Red Hat build of Quarkus 2.7.7jdbc-postgresqlRHSA-2023:1006
Red Hat Enterprise Linux 8postgresql-jdbc-0:42.2.14-2.el8RHSA-2023:2867
Red Hat Enterprise Linux 9postgresql-jdbc-0:42.2.27-1.el9RHSA-2023:2378
Red Hat Fuse 7.12jdbc-postgresqlRHSA-2023:3954
Red Hat Satellite 6.12 for RHEL 8candlepin-0:4.1.20-1.el8satRHSA-2023:1630
Red Hat Satellite 6.13 for RHEL 8candlepin-0:4.2.13-1.el8satRHSA-2023:2097

Frequently Asked Questions

**Vulnerability** `PreparedStatement.setText(int, InputStream)` and `PreparedStatemet.setBytea(int, InputStream)` will create a temporary file if the InputStream is larger than 51k Example of vulnerable code: ```java String s = "some very large string greater than 51200 bytes"; PreparedStatement.setInputStream(1, new ByteArrayInputStream(s.getBytes()) ); ``` This will create a temporary file which is readable by other users on Unix like systems, but not MacOS. Impact On Unix like systems, the system's temporary directory is shared between all users on that system. Because of this, whe
O3 Security · Impact-Aware SCA

Is CVE-2022-41946 in your dependencies?

Find it across Maven, including transitive dependencies.

CVE-2022-41946: postgresql — Fixed in 42.2.27