CVE-2024-1597

pgjdbc SQL Injection via line comment generation

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.

Remediation

Workaround:

  • Don't use SimpleQuery mode

Category

10.0
CVSS
Severity: Critical
CVSS 3.1 •
EPSS 0.10%
Third-Party Advisory github.com Third-Party Advisory fedoraproject.org Third-Party Advisory enterprisedb.com
Affected: pgjdbc pgjdbc
Published at:
Updated at:

References

Frequently Asked Questions

What is the severity of CVE-2024-1597?
CVE-2024-1597 has been scored as a critical severity vulnerability.
How to fix CVE-2024-1597?
As a workaround for remediating CVE-2024-1597: Don't use SimpleQuery mode
Is CVE-2024-1597 being actively exploited in the wild?
As for now, there are no information to confirm that CVE-2024-1597 is being actively exploited. According to its EPSS score, there is a ~0% probability that this vulnerability will be exploited by malicious actors in the next 30 days.
What software or system is affected by CVE-2024-1597?
CVE-2024-1597 affects pgjdbc pgjdbc.
This platform uses data from the NIST NVD, MITRE CVE, MITRE CWE, First.org and CISA KEV but is not endorsed or certified by these entities. CVE is a registred trademark of the MITRE Corporation and the authoritative source of CVE content is MITRE's CVE web site. CWE is a registred trademark of the MITRE Corporation and the authoritative source of CWE content is MITRE's CWE web site.
© 2025 Under My Watch. All Rights Reserved.