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.

Severity (CVSS 3.1)10.0Critical
Exploit odds (30 days)4.8%top 8.0% of all CVEs
Exploited in the wildNo reportsCISA SSVC: poc
Attack toolingNoneno public tooling known

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

EcosystemPackageFixed inAdvisory
AlmaLinux:8postgresql-jdbc42.2.14-3.el8_9ALSA-2024:1435
AlmaLinux:9postgresql-jdbc42.2.28-1.el9_3ALSA-2024:1436
AlmaLinux:8postgresql-jdbc-javadoc42.2.14-3.el8_9ALSA-2024:1435
Alpine:v3.20java-postgresql-jdbc42.6.2-r0ALPINE-CVE-2024-1597
Alpine:v3.21java-postgresql-jdbc42.6.2-r0ALPINE-CVE-2024-1597
Alpine:v3.22java-postgresql-jdbc42.6.2-r0ALPINE-CVE-2024-1597
Alpine:v3.23java-postgresql-jdbc42.6.2-r0ALPINE-CVE-2024-1597
Alpine:v3.24java-postgresql-jdbc42.6.2-r0ALPINE-CVE-2024-1597
Debian:12libpgjava42.5.5-0+deb12u1DEBIAN-CVE-2024-1597
Debian:13libpgjava42.7.2-1DEBIAN-CVE-2024-1597
Debian:14libpgjava42.7.2-1DEBIAN-CVE-2024-1597
Mavenorg.postgresql:postgresql42.2.28GHSA-24rp-q3w6-vc56
Mavenorg.postgresql:postgresql42.3.9GHSA-24rp-q3w6-vc56
Mavenorg.postgresql:postgresql42.4.4GHSA-24rp-q3w6-vc56
Mavenorg.postgresql:postgresql42.5.5GHSA-24rp-q3w6-vc56
Mavenorg.postgresql:postgresql42.6.1GHSA-24rp-q3w6-vc56
Mavenorg.postgresql:postgresql42.7.2GHSA-24rp-q3w6-vc56
Rocky Linux:8postgresql-jdbc0:42.2.14-3.el8_9RLSA-2024:1435
Rocky Linux:9postgresql-jdbc0:42.2.28-1.el9_3RLSA-2024:1436
Ubuntu:22.04:LTSlibpgjavano fix listedUBUNTU-CVE-2024-1597

Affected products (as reported)

VendorProductVersions
pgjdbc pgjdbc < 42.7.2< 42.6.1< 42.5.5< 42.4.4< 42.3.9< 42.2.28

Weakness: CWE-89 · Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H

References