# CVE-2022-41946: TemporaryFolder on unix-like systems does not limit access to created files in pgjdbc

> Local attackers can read temporary files created by the PostgreSQL JDBC driver, potentially exposing sensitive data.

- **Severity:** Medium 4.7 (`CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:N/A:N`)
- **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:** 23 Nov 2022
- **Updated:** 3 Nov 2025
- **Also known as:** ALSA-2023:2378, ALSA-2023:2867, BIT-postgresql-jdbc-driver-2022-41946, DEBIAN-CVE-2022-41946, DLA-3218-1, GHSA-562r-vg33-8x8h, OESA-2023-1366, RHSA-2023:0759, RHSA-2023:1630, RHSA-2023:2378, RHSA-2023:2867, ROOT-APP-MAVEN-CVE-2022-41946, SUSE-SU-2023:0103-1, SUSE-SU-2023:0104-1, SUSE-SU-2023:0451-1, UBUNTU-CVE-2022-41946, openSUSE-SU-2024:12606-1

## What is CVE-2022-41946?

CVE-2022-41946 is a medium-severity vulnerability in Debian Debian Linux, published on 23 Nov 2022. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

pgjdbc is an open source postgresql JDBC Driver. In affected versions a prepared statement using either `PreparedStatement.setText(int, InputStream)` or `PreparedStatemet.setBytea(int, InputStream)` will create a temporary file if the InputStream is larger than 2k. This will create a temporary file which is readable by other users on Unix like systems, but not MacOS. 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. 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.7 and higher users: this vulnerability is fixed in 4.5.0. Java 1.6 and lower users: no patch is available. 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 mitigate this vulnerability.

Weakness: CWE-668 (Exposure of Resource to Wrong Sphere), CWE-377 (DEPRECATED: Insecure Temporary File), CWE-200 (Exposure of Sensitive Information to an Unauthorized Actor)

## Which versions are affected by CVE-2022-41946?

9 open source packages ship an affected version, including org.postgresql:postgresql and postgresql-jdbc-driver. It affects 2 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.postgresql:postgresql` | Maven | From 42.2.0 | 42.2.27 |
| `org.postgresql:postgresql` | Maven | From 42.2.0 | 42.2.27 |
| `org.postgresql:postgresql` | Maven | From 42.3.0 | 42.3.8 |
| `org.postgresql:postgresql` | Maven | From 42.3.0 | 42.3.8 |
| `org.postgresql:postgresql` | Maven | From 42.4.0 | 42.4.3 |
| `org.postgresql:postgresql` | Maven | From 42.4.0 | 42.4.3 |
| `org.postgresql:postgresql` | Maven | From 42.5.0 | 42.5.1 |
| `org.postgresql:postgresql` | Maven | From 42.5.0 | 42.5.1 |
| `postgresql-jdbc-driver` | Bitnami | From 42.2.0 | 42.2.27, 42.3.8, 42.4.3, 42.5.1 |
| `postgresql-jdbc` | AlmaLinux:8 | All versions | 42.2.14-2.el8 |
| `postgresql-jdbc-javadoc` | AlmaLinux:8 | All versions | 42.2.14-2.el8 |
| `postgresql-jdbc` | AlmaLinux:9 | All versions | 42.2.27-1.el9 |
| `postgresql-jdbc` | Red Hat:enterprise_linux:8::appstream | All versions | 0:42.2.14-2.el8 |
| `postgresql-jdbc-javadoc` | Red Hat:enterprise_linux:8::appstream | All versions | 0:42.2.14-2.el8 |
| `postgresql-jdbc` | Red Hat:enterprise_linux:9::appstream | All versions | 0:42.2.27-1.el9 |
| `ovirt-ansible-collection` | Red Hat:rhev_hypervisor:4.4::el8 | All versions | 0:2.4.2-1.el8ev |
| `ovirt-ansible-collection` | Red Hat:rhev_manager:4.4:el8 | All versions | 0:2.4.2-1.el8ev |
| `ovirt-engine` | Red Hat:rhev_manager:4.4:el8 | All versions | 0:4.5.3.7-1.el8ev |
| `ovirt-engine-backend` | Red Hat:rhev_manager:4.4:el8 | All versions | 0:4.5.3.7-1.el8ev |
| `ovirt-engine-dbscripts` | Red Hat:rhev_manager:4.4:el8 | All versions | 0:4.5.3.7-1.el8ev |
| `ovirt-engine-health-check-bundler` | Red Hat:rhev_manager:4.4:el8 | All versions | 0:4.5.3.7-1.el8ev |
| `ovirt-engine-restapi` | Red Hat:rhev_manager:4.4:el8 | All versions | 0:4.5.3.7-1.el8ev |
| `ovirt-engine-setup` | Red Hat:rhev_manager:4.4:el8 | All versions | 0:4.5.3.7-1.el8ev |
| `ovirt-engine-setup-base` | Red Hat:rhev_manager:4.4:el8 | All versions | 0:4.5.3.7-1.el8ev |
| `ovirt-engine-setup-plugin-cinderlib` | Red Hat:rhev_manager:4.4:el8 | All versions | 0:4.5.3.7-1.el8ev |
| `ovirt-engine-setup-plugin-imageio` | Red Hat:rhev_manager:4.4:el8 | All versions | 0:4.5.3.7-1.el8ev |
| `ovirt-engine-setup-plugin-ovirt-engine` | Red Hat:rhev_manager:4.4:el8 | All versions | 0:4.5.3.7-1.el8ev |
| `ovirt-engine-setup-plugin-ovirt-engine-common` | Red Hat:rhev_manager:4.4:el8 | All versions | 0:4.5.3.7-1.el8ev |
| `ovirt-engine-setup-plugin-vmconsole-proxy-helper` | Red Hat:rhev_manager:4.4:el8 | All versions | 0:4.5.3.7-1.el8ev |
| `ovirt-engine-setup-plugin-websocket-proxy` | Red Hat:rhev_manager:4.4:el8 | All versions | 0:4.5.3.7-1.el8ev |
| `ovirt-engine-tools` | Red Hat:rhev_manager:4.4:el8 | All versions | 0:4.5.3.7-1.el8ev |
| `ovirt-engine-tools-backup` | Red Hat:rhev_manager:4.4:el8 | All versions | 0:4.5.3.7-1.el8ev |
| `ovirt-engine-vmconsole-proxy-helper` | Red Hat:rhev_manager:4.4:el8 | All versions | 0:4.5.3.7-1.el8ev |
| `ovirt-engine-webadmin-portal` | Red Hat:rhev_manager:4.4:el8 | All versions | 0:4.5.3.7-1.el8ev |
| `ovirt-engine-websocket-proxy` | Red Hat:rhev_manager:4.4:el8 | All versions | 0:4.5.3.7-1.el8ev |
| `postgresql-jdbc` | Red Hat:rhev_manager:4.4:el8 | All versions | 0:42.2.14-2.el8ev |
| `postgresql-jdbc-javadoc` | Red Hat:rhev_manager:4.4:el8 | All versions | 0:42.2.14-2.el8ev |
| `python3-ovirt-engine-lib` | Red Hat:rhev_manager:4.4:el8 | All versions | 0:4.5.3.7-1.el8ev |
| `rhvm` | Red Hat:rhev_manager:4.4:el8 | All versions | 0:4.5.3.7-1.el8ev |
| `candlepin` | Red Hat:satellite:6.12::el8 | All versions | 0:4.1.20-1.el8sat |

Products: Debian Debian Linux, Postgresql Postgresql Jdbc Driver.

## How do I fix CVE-2022-41946?

Upgrade org.postgresql:postgresql to a fixed version for your release line: 42.2.27, 42.3.8, 42.4.3 or 42.5.1.

## Is CVE-2022-41946 being exploited?

There is no known exploitation of CVE-2022-41946 in the wild and no public exploit code.

## 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-41946 and fix it if it is affected.

What it is: CVE-2022-41946 is a medium-severity vulnerability in Debian Debian Linux, published on 23 Nov 2022. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2022-41946 in the wild and no public exploit code.

Affected packages and fixed versions:
- org.postgresql:postgresql (Maven): affected from 42.2.0; fixed in 42.2.27
- org.postgresql:postgresql (Maven): affected from 42.2.0; fixed in 42.2.27
- org.postgresql:postgresql (Maven): affected from 42.3.0; fixed in 42.3.8
- org.postgresql:postgresql (Maven): affected from 42.3.0; fixed in 42.3.8
- org.postgresql:postgresql (Maven): affected from 42.4.0; fixed in 42.4.3
- org.postgresql:postgresql (Maven): affected from 42.4.0; fixed in 42.4.3
- org.postgresql:postgresql (Maven): affected from 42.5.0; fixed in 42.5.1
- org.postgresql:postgresql (Maven): affected from 42.5.0; fixed in 42.5.1
- postgresql-jdbc-driver (Bitnami): affected from 42.2.0; fixed in 42.2.27, 42.3.8, 42.4.3, 42.5.1

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-41946/ (Markdown: https://insights.sbomify.com/CVE-2022-41946/index.md)
```

## Sources

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

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