Vulnerability · Published Feb 19, 2024 · Assigned by PostgreSQL
CVE-2024-1597pgjdbc SQL Injection via line comment generation
Critical 10.0
In plain English
A critical-severity SQL injection in pgjdbc from pgjdbc. Proof-of-concept exploit code is public. The chance it is exploited in the next 30 days is estimated at 4.8% (higher than 92% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official description
pgjdbc, 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.
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| AlmaLinux:8 | postgresql-jdbc | 42.2.14-3.el8_9 | ALSA-2024:1435 |
| AlmaLinux:9 | postgresql-jdbc | 42.2.28-1.el9_3 | ALSA-2024:1436 |
| AlmaLinux:8 | postgresql-jdbc-javadoc | 42.2.14-3.el8_9 | ALSA-2024:1435 |
| Alpine:v3.20 | java-postgresql-jdbc | 42.6.2-r0 | ALPINE-CVE-2024-1597 |
| Alpine:v3.21 | java-postgresql-jdbc | 42.6.2-r0 | ALPINE-CVE-2024-1597 |
| Alpine:v3.22 | java-postgresql-jdbc | 42.6.2-r0 | ALPINE-CVE-2024-1597 |
| Alpine:v3.23 | java-postgresql-jdbc | 42.6.2-r0 | ALPINE-CVE-2024-1597 |
| Alpine:v3.24 | java-postgresql-jdbc | 42.6.2-r0 | ALPINE-CVE-2024-1597 |
| Debian:12 | libpgjava | 42.5.5-0+deb12u1 | DEBIAN-CVE-2024-1597 |
| Debian:13 | libpgjava | 42.7.2-1 | DEBIAN-CVE-2024-1597 |
| Debian:14 | libpgjava | 42.7.2-1 | DEBIAN-CVE-2024-1597 |
| Maven | org.postgresql:postgresql | 42.2.28 | GHSA-24rp-q3w6-vc56 |
| Maven | org.postgresql:postgresql | 42.3.9 | GHSA-24rp-q3w6-vc56 |
| Maven | org.postgresql:postgresql | 42.4.4 | GHSA-24rp-q3w6-vc56 |
| Maven | org.postgresql:postgresql | 42.5.5 | GHSA-24rp-q3w6-vc56 |
| Maven | org.postgresql:postgresql | 42.6.1 | GHSA-24rp-q3w6-vc56 |
| Maven | org.postgresql:postgresql | 42.7.2 | GHSA-24rp-q3w6-vc56 |
| Rocky Linux:8 | postgresql-jdbc | 0:42.2.14-3.el8_9 | RLSA-2024:1435 |
| Rocky Linux:9 | postgresql-jdbc | 0:42.2.28-1.el9_3 | RLSA-2024:1436 |
| Ubuntu:22.04:LTS | libpgjava | no fix listed | UBUNTU-CVE-2024-1597 |
Affected products (as reported)
Weakness: CWE-89 · Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
References
- https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-24rp-q3w6-vc56
- https://www.enterprisedb.com/docs/security/assessments/cve-2024-1597/
- https://www.enterprisedb.com/docs/jdbc_connector/latest/01_jdbc_rel_notes/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/TZQTSMESZD2RJ5XBPSXH3TIQVUW5DIUU/
- https://security.netapp.com/advisory/ntap-20240419-0008/
- http://www.openwall.com/lists/oss-security/2024/04/02/6
- https://lists.debian.org/debian-lts-announce/2024/05/msg00007.html
- https://www.sonarsource.com/blog/double-dash-double-trouble-a-subtle-sql-injection-flaw/
- https://lists.debian.org/debian-lts-announce/2024/12/msg00017.html