CVE-2026-134843: pgjdbc leaves a half-written message on the connection after an unchecked exception
pgjdbc, the PostgreSQL JDBC Driver, does not close the connection when an unchecked exception interrupts a request. Part of a Bind message stays in the send buffer, and the server reads the bytes that follow as the rest of it. The bytes of a value uploaded later on the same connection can then run as a SQL command. Since 42.6.0 a setBinaryStream() value without a length that is executed again throws such an exception, as does the driver's own retry after SQLState 0A000 or 26000. An application stream that throws an unchecked exception has the same effect in all versions. All versions before 42.7.15 are affected, and 42.7.15 fixes the problem.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pgjdbcto a version that resolves this vulnerability.Fixed in 42.7.15
Event History
Frequently Asked Questions
Which applications are most likely to be exposed?
Applications using pgjdbc versions before 42.7.15 are affected if an unchecked exception can interrupt a request and the application later uploads a value on the same connection. The documented driver-triggered cases include re-executing a setBinaryStream() value without a length since 42.6.0, and the driver's retry after SQLState 0A000 or 26000; an application stream throwing an unchecked exception can trigger the issue in all affected versions.
What does an attacker need to exploit this?
An unchecked exception must interrupt a request after part of a Bind message has been left in the connection send buffer. Data sent later on that same connection can then be interpreted by PostgreSQL as the remainder of the message and run as a SQL command.
Are default deployments affected?
Affected driver versions are not exposed merely by being installed. Exploitation depends on a request being interrupted by an unchecked exception and subsequent data being sent over the same connection.
What should be done if upgrading cannot happen immediately?
Avoid reusing a connection after an unchecked exception interrupts a request; close the connection instead. This prevents later uploaded data from being appended to the half-written message.
How can I determine whether my application is affected?
Check whether the application uses pgjdbc before 42.7.15 and whether it reuses connections after unchecked exceptions during request or stream processing. Review use of setBinaryStream() without a length that is executed again, retries following SQLState 0A000 or 26000, and application-provided streams that can throw unchecked exceptions.