pgjdbc SQL Injection via line comment generation
pgjdbc
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| org.postgresql:postgresql Maven |
|
|
pgjdbc
| Product | Affected | Fixed in |
|---|---|---|
| org.postgresql:postgresql Maven |
|
|
42.4.442.5.542.6.142.7.2pgjdbc, the PostgreSQL JDBC Driver, allows attacker to inject SQL if using PreferQueryMode=SIMPLE. Note this is not the default. In the default mode there is no vulnerability. A placeholder for a numeric value must be immediately preceded by a minus. There must be a second placeholder for a string value after the first placeholder; both must be on the same line. By constructing a matching string payload, the attacker can inject SQL to alter the query,bypassing the protections that parameterized queries bring against SQL Injection attacks. Versions before 42.7.2, 42.6.1, 42.5.5, 42.4.4, 42.3.9, and 42.2.28 are affected.
From the CVE record · PostgreSQL
pgjdbc is vulnerable to SQL injection when PreferQueryMode=SIMPLE is enabled; the default mode is not affected. An attacker who can supply a matching string value can alter a parameterized query if a numeric placeholder is immediately preceded by a minus and a string placeholder follows it on the same line.
Teams using Maven org.postgresql:postgresql should check versions below 42.2.28, 42.3.0–42.3.8, 42.4.0–42.4.3, 42.5.0–42.5.4, 42.6.0, or 42.7.0–42.7.1.