# CVE-2026-107313: pgjdbc stores bytes of earlier messages in place of a large value on GSS-encrypted connections

> An attacker with access to the database can read sensitive data from previous messages due to buffer reuse in GSS-encrypted connections.

- **Severity:** Medium 4.2 (`CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 7 Oct 2026
- **Updated:** 7 Oct 2026
- **Also known as:** DEBIAN-CVE-2026-107313, GHSA-hggc-j2qh-988m, UBUNTU-CVE-2026-107313

## What is CVE-2026-107313?

CVE-2026-107313 is a medium-severity vulnerability in pgjdbc, published on 7 Oct 2026. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

pgjdbc, the PostgreSQL JDBC Driver, versions 42.7.4 and 42.7.5 can send the previous contents of the GSS send buffer in place of the first part of a value on a connection with GSS encryption (gssEncMode=prefer or require), and the server stores the value without an error. The buffer is 16320 bytes with MIT Kerberos. The stored value then holds bytes of the messages the driver sent just before it on the same connection, such as the statement's SQL text, its other parameters, and earlier rows of the same batch, instead of the bytes the application supplied. Values at least as long as the buffer are affected when the driver writes them from a byte array: bind parameters set with setString, setBytes, or a ByteStreamWriter, CopyIn.writeToCopy, and LargeObject.write. Most such writes fail with an ArrayIndexOutOfBoundsException instead. The default, gssEncMode=allow, does not start GSS encryption, and connections without GSS encryption are not affected. Versions 42.7.3 and earlier are not affected, and 42.7.6 fixes the problem.

Weakness: CWE-201 (Insertion of Sensitive Information Into Sent Data)

## Which versions are affected by CVE-2026-107313?


## How do I fix CVE-2026-107313?

Upgrade to a fixed version.

## Is CVE-2026-107313 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-107313 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-107313 and fix it if it is affected.

What it is: CVE-2026-107313 is a medium-severity vulnerability in pgjdbc, published on 7 Oct 2026. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-107313 exists.

Affected product: pgjdbc. No package-level version data is available, so check the vendor advisory linked from the reference page.

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

## Sources

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

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