# GHSA-6RXC-3R4P-GPFF: pgjdbc simple query mode quotes parameters for the wrong standard\_conforming\_strings value

- Database: GitHub
- Severity: CVSS 8.1 (High)
- Published: 2026-11-23
- Modified: 2026-11-23

## Tracked as

- [CVE-2026-134842](https://cve.now/CVE-2026-134842.md): pgjdbc SQL injection in simple query mode parameter quoting

## Affected versions

- org.postgresql:postgresql (Maven): through 42.7.14

## Description

### Summary

With `preferQueryMode=simple`, pgjdbc could quote a string parameter for the wrong value of `standard_conforming_strings`. A parameter value could then run as SQL.


### Details

In simple query mode the driver writes parameter values into the query text. It doubled quotes and left backslashes alone when it believed the setting was on.

An earlier statement of the same query or batch, a trigger or a configuration reload can turn the setting off. A value with `\'` then ended the literal, and the rest of the value ran as SQL. Before 42.7.6 the driver always quoted as if the setting were on, so any session with the setting off was affected.

The statement cache also reused a parse made under the other setting. The placeholders of that parse could then fall inside or outside a literal.

The JDK EUC_JP and Shift_JIS charsets encode the yen sign `U+00A5` as `0x5C`, which the server reads as a backslash. With `allowEncodingChanges=true` the yen sign worked like a backslash in the same way. `PGConnection.escapeLiteral` had the same problem.


### Proof of concept

```java
// preferQueryMode=simple, autocommit off
PreparedStatement ps = conn.prepareStatement("SET LOCAL standard_conforming_strings = off; SELECT ?");
ps.setString(1, "\\'), (SELECT $$injected$$) --");
ps.execute(); // The subquery runs as SQL.
```


### Impact

An attacker who controls a string parameter can run SQL as the application's database role. This needs `preferQueryMode=simple`, which is not the default. It also needs `standard_conforming_strings` off on the server or during the session. The yen sign case also needs `allowEncodingChanges=true` and the EUC_JP or SJIS client encoding.

## References

- https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-6rxc-3r4p-gpff

Page: https://cve.now/GHSA-6RXC-3R4P-GPFF

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
