CVE-2026-134841: pgjdbc parses quoted text as SQL in JDBC escapes, dollar quotes and E strings
pgjdbc, the PostgreSQL JDBC Driver, misreads some quoted text in its query parser. A } inside a literal ends a JDBC escape such as {ts}, and the rest of the literal is translated as SQL. A dollar quote whose tag has a non-ASCII symbol or space is not recognized. An E'' string with a doubled quote is scanned as a standard string. {fn right} and {fn timestampdiff} with a negative argument produce a -- comment. In each case text that the application quoted correctly can run as SQL with the privileges of the application's database role. 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 exposed to this issue?
Applications using the PostgreSQL JDBC Driver before 42.7.15 are affected when they send queries containing the vulnerable JDBC escape, dollar-quote, or E-string parsing patterns. The injected SQL executes with the privileges of the application's database role.
What does an attacker need to exploit the issue?
An attacker needs to influence text placed by the application into a quoted SQL literal that reaches one of the parser edge cases. The affected cases include a } in a JDBC escape literal, an unrecognized dollar-quote tag containing a non-ASCII symbol or space, an E'' string with a doubled quote, and negative arguments to {fn right} or {fn timestampdiff}.
What is the remediation?
Upgrade pgjdbc to version 42.7.15. This version fixes the issue; all earlier versions are affected.
How can I determine whether I am affected?
Check the version of the org.postgresql:postgresql dependency used by the application. Any version before 42.7.15 is affected.