CVE-2026-134844

Authorization Bypass
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.

An authorization bypass vulnerability (CVE-2026-134844) has been identified in the catalog queries of the PostgreSQL JDBC Driver, which allows attackers to run SQL with the privileges of the application's database role. A database role that can create objects in a schema on the application's search_path can supply its own operator, function or domain, and the driver's metadata and type lookup queries then run it in the application's session. The type lookup case needs only the TEMP privilege, which every role has by default.

Per OWASP: Access control enforces policy such that users cannot act outside of their intended permissions. Failures typically lead to unauthorized information disclosure, modification, or destruction of all data or performing a business function outside the user's limits.

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 before 42.7.15 of the PostgreSQL JDBC Driver. The driver sends its own catalog queries to the server from DatabaseMetaData, ResultSetMetaData and TypeInfoCache. Those queries mostly name their tables with the pg_catalog schema, but leave operators, several functions and some type names unqualified, so the server resolves them through the application's search_path.

PgResultSetMetaData.fetchFieldMetaData(), which backs calls such as ResultSetMetaData.getTableName(), joins pg_catalog.pg_class against a list of integer literals built from the result's column sources:

sql.append("SELECT ");
sql.append(field.getTableOid());
if (!hasSourceInfo) {
  sql.append(" AS oid ");
}
// ...
sql.append(") vals ON (c.oid = vals.oid AND a.attnum = vals.attnum) ");

Here c.oid is of type oid and vals.oid is an int4 literal. pg_catalog has no = operator for exactly (oid, int4), so the server would use its oid = oid operator after an implicit cast. PostgreSQL prefers an operator whose argument types match exactly, in any schema on the search_path, over one that needs a cast. A role with CREATE on any schema of the application's search_path can therefore define an = operator on (oid, int4), and the server calls that operator's function with the privileges of the application's role. The queries of PgDatabaseMetaData, such as those behind getTables() and getColumns(), also use unqualified operators such as LIKE and ~, which the server likewise resolves through the search_path.

TypeInfoCache resolves an unqualified type name, such as interval for a PGInterval parameter, with its own ranking query:

sql = "SELECT pg_type.oid, typname "
      + "  FROM pg_catalog.pg_type "
      + "  LEFT "
      + "  JOIN (select ns.oid as nspoid, ns.nspname, r.r "
      + "          from pg_namespace as ns "
      + "          join ( select s.r, (current_schemas(false))[s.r] as nspname "
      + "                   from generate_series(1, array_upper(current_schemas(false), 1)) as s(r) ) as r "
      + "         using ( nspname ) "
      + "       ) as sp "
      + "    ON sp.nspoid = typnamespace "
      + " WHERE typname = ? "
      + " ORDER BY sp.r, pg_type.oid DESC LIMIT 1;";

current_schemas(false) does not include pg_catalog, so the built-in type gets no rank and ties with types in schemas that are not on the search_path at all, and the type with the highest OID wins. A domain named interval created later in any schema, even the temporary schema of another session, is then used for the parameter, and the server runs that domain's CHECK constraint in the application's session.

Steps to Reproduce

1. As a database role that has CREATE on a schema s on the application's search_path, create an operator that exactly matches the driver's oid = int4 comparison:

CREATE FUNCTION s.f(oid, int4) RETURNS bool LANGUAGE plpgsql AS 'BEGIN RETURN true; END';
CREATE OPERATOR s.= (LEFTARG = oid, RIGHTARG = int4, PROCEDURE = s.f);

2. In the application, request result set metadata for a query over a table column:

rs.getMetaData().getTableName(1); // Runs s.f as the application's role.

3. The server runs s.f with the privileges of the application's role. A body that does more than RETURN true runs SQL as that role.

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-134844
PROJECT Affected
PostgreSQL JDBC Driver
Versions Affected
<42.7.15
NES Versions Affected
Published date
November 23, 2026
≈ Fix date
December 4, 2026
Category
Authorization Bypass
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.