---
title: "CVE-2024-1597: org.postgresql:postgresql vulnerable to SQL Injection via line comment generation"
url: https://erroneo.us/security/cve/CVE-2024-1597/
description: "CVE-2024-1597 (org.postgresql:postgresql (Maven)): pgjdbc, the PostgreSQL JDBC Driver, allows attacker to inject SQL if using PreferQueryMode=SIMPLE. Note…"
type: vulnerability-record
section: "Security Digest"
date_published: 2024-02-19
date_modified: 2026-03-21
publisher: erroneo.us
author: erroneo.us Security Desk
cve: "CVE-2024-1597"
kev: false
cvss: 10
epss: 0.0481
license: All rights reserved. Quote with attribution and a link.
---

# CVE-2024-1597: org.postgresql:postgresql vulnerable to SQL Injection via line comment generation

**Signal:** Critical and remotely reachable. No known exploitation yet, but it is network-reachable without credentials. (Computed from CISA KEV, EPSS and CVSS; not an editorial verdict.)

## Should you act?

- Not in CISA KEV , but CISA’s SSVC assessment records a public proof-of-concept, so attack code exists.
- EPSS 4.8% , percentile 92: FIRST’s model estimates a 4.8% chance of exploitation activity in the next 30 days, higher than 92% of all scored CVEs (elevated). EPSS is a probability, not a verdict.
- Remotely reachable with no login and no user interaction. If the vulnerable service is exposed to the internet, prioritize it.
- Only applies if your dependency tree includes org.postgresql:postgresql (Maven) < 42.2.28, fixed in 42.2.28 ; org.postgresql:postgresql (Maven) >= 42.3.0, < 42.3.9, fixed in 42.3.9 ; org.postgresql:postgresql (Maven) >= 42.4.0, < 42.4.4, fixed in 42.4.4 ; org.postgresql:postgresql (Maven) >= 42.5.0, < 42.5.5, fixed in 42.5.5 . Check your lockfile, including transitive dependencies.

## What it is

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

- Maven `org.postgresql:postgresql` < 42.2.28 → fixed: 42.2.28
- Maven `org.postgresql:postgresql` >= 42.3.0, < 42.3.9 → fixed: 42.3.9
- Maven `org.postgresql:postgresql` >= 42.4.0, < 42.4.4 → fixed: 42.4.4
- Maven `org.postgresql:postgresql` >= 42.5.0, < 42.5.5 → fixed: 42.5.5
- Maven `org.postgresql:postgresql` >= 42.6.0, < 42.6.1 → fixed: 42.6.1
- Maven `org.postgresql:postgresql` >= 42.7.0, < 42.7.2 → fixed: 42.7.2

## Affected products (CVE record)

- pgjdbc pgjdbc: < 42.7.2, < 42.6.1, < 42.5.5, < 42.4.4, < 42.3.9, < 42.2.28

## Severity

- PostgreSQL CVSS 3.1: 10 `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H`
- GitHub CVSS 3.1: 10.0 `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H`

## Exploitation

- CISA KEV: not listed (no confirmed in-the-wild exploitation known to CISA).
- CISA SSVC assessment: exploitation poc , automatable yes , technical impact total .
- FIRST EPSS (model of 2026-10-21): 4.81% probability of exploitation activity in the next 30 days; percentile 92.

## Sources

- [GitHub Advisory GHSA-24rp-q3w6-vc56](https://github.com/advisories/GHSA-24rp-q3w6-vc56)
- [CVE.org record CVE-2024-1597](https://www.cve.org/CVERecord?id=CVE-2024-1597)
- [NVD entry CVE-2024-1597](https://nvd.nist.gov/vuln/detail/CVE-2024-1597)
- [github.com](https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-24rp-q3w6-vc56)
- [enterprisedb.com](https://www.enterprisedb.com/docs/security/assessments/cve-2024-1597/)
- [enterprisedb.com](https://www.enterprisedb.com/docs/jdbc_connector/latest/01_jdbc_rel_notes/)
- [lists.fedoraproject.org](https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/TZQTSMESZD2RJ5XBPSXH3TIQVUW5DIUU/)
- [security.netapp.com](https://security.netapp.com/advisory/ntap-20240419-0008/)
- [openwall.com](http://www.openwall.com/lists/oss-security/2024/04/02/6)
- [lists.debian.org](https://lists.debian.org/debian-lts-announce/2024/05/msg00007.html)
- [sonarsource.com](https://www.sonarsource.com/blog/double-dash-double-trouble-a-subtle-sql-injection-flaw/)
- [lists.debian.org](https://lists.debian.org/debian-lts-announce/2024/12/msg00017.html)
- [github.com](https://github.com/pgjdbc/pgjdbc/commit/06abfb78a627277a580d4df825f210e96a4e14ee)
- [github.com](https://github.com/pgjdbc/pgjdbc/commit/93b0fcb2711d9c1e3a2a03134369738a02a58b40)

---
Source page: https://erroneo.us/security/cve/CVE-2024-1597/ · Security Digest: https://erroneo.us/security/ · More: https://erroneo.us/llms.txt
