CVE-2026-134843

SQL Injection
Affects
PostgreSQL JDBC Driver
in
PostgreSQL JDBC Driver
No items found.
Versions
<42.7.15

Patch Available.

Exclamation circle icon
Patch Available

This Vulnerability has been fixed in the Never-Ending Support (NES) version offered by HeroDevs.

Overview

The PostgreSQL JDBC Driver (pgJDBC) is the open-source JDBC driver that lets Java programs connect to a PostgreSQL database using standard, database-independent Java code. It is a pure Java (Type 4) driver that speaks the PostgreSQL native network protocol. It is published to Maven Central as org.postgresql:postgresql, and Spring Boot 2.7 manages its 42.3 line.

A command injection vulnerability (CVE-2026-134843) has been identified in the PostgreSQL JDBC Driver's query executor, which allows attackers who control the content of an uploaded value to run SQL as the application's database role. When an unchecked exception interrupts the sending of a Bind message, the driver leaves part of the message in the send buffer and keeps the connection open, so the server can read the bytes of a later uploaded value as a new SQL command.

Per OWASP: A SQL injection attack consists of insertion or "injection" of a SQL query via the input data from the client to the application. A successful SQL injection exploit can read sensitive data from the database, modify database data (Insert/Update/Delete), execute administration operations on the database (such as shutdown the DBMS), recover the content of a given file present on the DBMS file system and in some cases issue commands to the operating system.

This issue affects all versions of the PostgreSQL JDBC Driver before 42.7.15.

Details

Module Info

Vulnerability Info

This High-severity vulnerability is found in the org.postgresql:postgresql package in all versions of the PostgreSQL JDBC Driver before 42.7.15.

The extended query protocol sends each parameter value inside a Bind message. QueryExecutorImpl.sendBind() first writes the declared length of a value and then the value itself. For a stream parameter set with setBinaryStream() or a similar setter, SimpleParameterList.streamBytea() hands the application's InputStream to PGStream.sendStream(), which copies it into the send buffer. sendStream() only handles an IOException from the stream:

try {
  readCount = inStream.read(streamBuffer, 0, count);
  if (readCount < 0) {
    throw new EOFException(...);
  }
} catch (IOException ioe) {
  while (remaining > 0) {
    send(streamBuffer, count);
    remaining -= count;
    count = (remaining > streamBuffer.length ? streamBuffer.length : remaining);
  }
  throw new PGBindException(ioe);
}

An IOException is padded out to the declared length and reported as a bind failure, so the message stays well formed. An unchecked exception, such as a RuntimeException thrown by the application's stream, skips that padding and propagates out of the Bind with only part of the value written. QueryExecutorImpl.execute() closes the connection only for an IOException:

try {
  try {
    handler = sendQueryPreamble(handler, flags);
    autosave = sendAutomaticSavepoint(query, flags);
    sendQuery(query, (V3ParameterList) parameters, maxRows, fetchSize, flags,
        handler, null, adaptiveFetch);
    ...
  } catch (PGBindException se) {
    ...
  }
} catch (IOException e) {
  abort();
  handler.handleError(
      new PSQLException(GT.tr("An I/O error occurred while sending to the backend."),
          PSQLState.CONNECTION_FAILURE, e));
}

The batch execute() and fetch() paths have the same shape. The unchecked exception therefore leaves the connection open with a half-written Bind message in its send buffer. When the application, or a connection pool, uses the connection again, the server reads the next bytes the driver sends as the rest of the unfinished value. The bytes of a later uploaded value then fall outside that message, and the server parses them as a new protocol message. An attacker who controls the content of that value can shape it into a Query message and run arbitrary SQL with the privileges of the application's database role.

In 42.6.0 and later, a setBinaryStream() value without a length and over 51200 bytes is spooled and released after it is sent, so executing the statement again, including the driver's own retry after SQLState 0A000 or 26000, throws a NullPointerException in the middle of the Bind. In all versions, an application InputStream that throws an unchecked exception has the same effect.

Mitigation

The PostgreSQL JDBC Driver's security policy ships security fixes by default only for the latest 42.x release line and for 42.2.x, and for other versions only upon request. Upstream has made no 42.3.x release since 42.3.10 (March 2024), so no 42.3.x release is available to address this issue. For more information, see here.

Users of the affected components should apply one of the following mitigations:

  • Upgrade affected applications to a currently supported release of the PostgreSQL JDBC Driver that contains the fix.
  • Leverage a commercial support partner like HeroDevs for post-EOL security support.

Credits

  • Anthropic OSS Scanner (finder)
Vulnerability Details
Severity
Level
CVSS Assessment
Low
>=0 <4
Medium
>=4 <6
High
>=6 <8
Critical
>=8 <10
High
ID
CVE-2026-134843
PROJECT Affected
PostgreSQL JDBC Driver
Versions Affected
<42.7.15
NES Versions Affected
Published date
November 23, 2026
≈ Fix date
December 4, 2026
Category
SQL Injection
Vex Document
Download VEXHow do I use it?
Sign up for the latest vulnerability alerts fixed in
NES for PostgreSQL JDBC Driver
Rss feed icon
Subscribe via RSS
or

By submitting the form I acknowledge receipt of our Privacy Policy.

Thanks for signing up for our Newsletter! We look forward to connecting with you.
Oops! Something went wrong while submitting the form.