Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-107315 Overview
CVE-2026-107315 is an information disclosure vulnerability in pgjdbc, the PostgreSQL JDBC Driver, affecting versions 42.7.4 through 42.7.13. The driver pads values shorter than their declared length using leftover bytes from its send buffer instead of zeros. Those bytes contain SQL text and parameter values from earlier statements on the same connection. On pooled connections, that earlier traffic can originate from other application requests. An attacker who can store a padded value and read it back can harvest fragments of previous database traffic, including sensitive parameter data. The vulnerability is categorized as information exposure [CWE-201].
Critical Impact
Each padded value can expose up to 8192 bytes of prior connection traffic, or 16320 bytes when GSS encryption is enabled, potentially leaking SQL statements and parameter values from other users on pooled connections.
Affected Products
- pgjdbc PostgreSQL JDBC Driver version 42.7.4
- pgjdbc PostgreSQL JDBC Driver versions 42.7.5 through 42.7.13
- Applications using pooled JDBC connections against PostgreSQL with the affected driver
Discovery Timeline
- 2026-10-08 - CVE-2026-107315 published to NVD
- 2026-10-08 - Last updated in NVD database
Technical Details for CVE-2026-107315
Vulnerability Analysis
The flaw resides in how pgjdbc handles length-prefixed value transmission when the supplied data is shorter than the declared length. Instead of writing zero padding, the driver leaves stale bytes from its send buffer in place. PostgreSQL stores the full declared length, including the uninitialized tail. The stale bytes contain earlier wire-protocol traffic: SQL command text and bound parameter values from recent statements executed on the same physical connection.
In connection-pooled architectures, a single physical connection is reused across many logical requests from different users or tenants. An attacker who controls one application code path that triggers short-value padding can later read the stored value and recover traffic generated by unrelated requests. GSS-encrypted connections use a larger buffer, raising the per-value disclosure to 16320 bytes.
Root Cause
The root cause is improper buffer initialization during value serialization. Versions 42.7.3 and earlier correctly zero-padded short values. A change introduced in 42.7.4 substituted raw buffer contents for the zero fill, exposing residual data to the server-side storage path.
Attack Vector
Exploitation requires an application that calls one of the affected APIs with a declared length larger than the supplied data: PreparedStatement.setObject with a ByteStreamWriter, CopyIn.writeToCopy, PGCopyOutputStream.write, LargeObject.write, or Blob.setBytes. The driver accepts the mismatched length without error. The attacker must also be able to read the stored value back to retrieve the leaked bytes. Applications whose declared lengths always equal the actual payload size are not affected.
See the pgjdbc GitHub Security Advisory GHSA-f64h-wr5q-3qf3 for technical details.
Detection Methods for CVE-2026-107315
Indicators of Compromise
- Stored bytea, large object, or BLOB values whose trailing bytes contain readable SQL fragments or protocol markers from unrelated sessions.
- Application logs showing use of ByteStreamWriter, CopyIn.writeToCopy, PGCopyOutputStream, LargeObject.write, or Blob.setBytes with declared lengths exceeding actual payload sizes.
- pgjdbc client library versions between 42.7.4 and 42.7.13 deployed in connection-pooled application tiers.
Detection Strategies
- Inventory JVM applications and build manifests to identify dependencies on org.postgresql:postgresql in the affected version range.
- Audit source code for the five affected API calls and verify declared length always matches the actual data length written.
- Query PostgreSQL for stored binary values and inspect trailing bytes for recognizable SQL keywords or parameter patterns indicative of cross-request leakage.
Monitoring Recommendations
- Track dependency updates in CI/CD pipelines and alert on pgjdbc versions 42.7.4 through 42.7.13.
- Monitor connection pool reuse patterns and tag applications that share pooled connections across trust boundaries for priority remediation.
- Review database audit logs for insert and update operations writing binary data to tables accessible to multi-tenant readers.
How to Mitigate CVE-2026-107315
Immediate Actions Required
- Upgrade pgjdbc to the patched release referenced in the vendor advisory as soon as it is available in your package repository.
- Audit application code for the affected APIs and correct any calls where declared length exceeds the actual data length.
- Rotate credentials and secrets that may have been transmitted as prepared-statement parameters on affected pooled connections.
Patch Information
Refer to the pgjdbc GitHub Security Advisory GHSA-f64h-wr5q-3qf3 for the fixed version. Downgrading to 42.7.3 or earlier eliminates the padding behavior, since those releases pad with zeros, but reintroduces any issues previously fixed in later 42.7.x releases.
Workarounds
- Ensure every call to PreparedStatement.setObject with ByteStreamWriter, CopyIn.writeToCopy, PGCopyOutputStream.write, LargeObject.write, and Blob.setBytes declares a length equal to the bytes actually written.
- Disable connection pooling or isolate pools per trust boundary to limit cross-request data exposure until patching is complete.
- Disable GSS encryption where feasible to reduce the per-value disclosure window from 16320 to 8192 bytes.
# Maven dependency pin example — replace <FIXED_VERSION> with the patched release
# listed in GHSA-f64h-wr5q-3qf3
mvn dependency:tree | grep postgresql
# Update pom.xml:
# <dependency>
# <groupId>org.postgresql</groupId>
# <artifactId>postgresql</artifactId>
# <version><FIXED_VERSION></version>
# </dependency>
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

