# CVE-2024-1597: pgjdbc SQL Injection via line comment generation

- Severity: Critical 10.0 (CVSS:3.1, scored by PostgreSQL) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 4.81%, higher than 92% of CVEs (2026-12-01)
- Published: 2024-02-19T12:58:48.620Z
- Modified: 2026-09-10T16:01:45.935Z
- Also known as: GHSA-24rp-q3w6-vc56, BIT-POSTGRESQL-JDBC-DRIVER-2024-1597
- Related: CVE-2024-32888
- Weaknesses: CWE-89
- SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact total
- Assigned by: PostgreSQL

## 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.

(As written by CVE List.)

## Affected

- pgjdbc pgjdbc: < 42.7.2; < 42.6.1; < 42.5.5; < 42.4.4; < 42.3.9; < 42.2.28; before 42.7.2; before 42.6.1; before 42.5.5; before 42.4.4; before 42.3.9; before 42.2.28
- org.postgresql:postgresql (Maven): before 42.2.28; from 42.3.0 before 42.3.9; from 42.4.0 before 42.4.4; from 42.5.0 before 42.5.5; from 42.6.0 before 42.6.1; from 42.7.0 before 42.7.2
- postgresql postgresql_jdbc_driver: before 42.2.28; from 42.3.0 before 42.3.9; from 42.4.0 before 42.4.4; from 42.5.0 before 42.5.5; from 42.6.0 before 42.6.1; from 42.7.0 before 42.7.2
- fedoraproject fedora: 40
- postgresql-jdbc-driver (Bitnami): before 42.2.28; from 42.3.0 before 42.3.9; from 42.4.0 before 42.4.4; from 42.5.0 before 42.5.5; from 42.6.0 before 42.6.1; from 42.7.0 before 42.7.2

## Every score

- PostgreSQL: CVSS:3.1 10.0 Critical `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 Critical `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H`
- NVD: CVSS:3.1 9.8 Critical `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- Bitnami Vulnerability Database: rating Critical

## References

- <https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-24rp-q3w6-vc56> (advisory, third-party-advisory, web)
- <https://www.enterprisedb.com/docs/security/assessments/cve-2024-1597/> (advisory, third-party-advisory)
- <https://www.enterprisedb.com/docs/jdbc_connector/latest/01_jdbc_rel_notes/> (article, release-notes)
- <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/TZQTSMESZD2RJ5XBPSXH3TIQVUW5DIUU/> (advisory, mailing-list, third-party-advisory)
- <https://security.netapp.com/advisory/ntap-20240419-0008/> (web)
- <http://www.openwall.com/lists/oss-security/2024/04/02/6> (web)
- <https://lists.debian.org/debian-lts-announce/2024/05/msg00007.html> (web)
- <https://www.sonarsource.com/blog/double-dash-double-trouble-a-subtle-sql-injection-flaw/> (web)
- <https://lists.debian.org/debian-lts-announce/2024/12/msg00017.html> (web)
- <https://nvd.nist.gov/vuln/detail/CVE-2024-1597> (advisory, web)
- <https://github.com/pgjdbc/pgjdbc/commit/06abfb78a627277a580d4df825f210e96a4e14ee> (web)
- <https://github.com/pgjdbc/pgjdbc/commit/93b0fcb2711d9c1e3a2a03134369738a02a58b40> (web)
- <https://github.com/pgjdbc/pgjdbc> (package)

## Sources

- CVE List: [CVE-2024-1597](https://www.cve.org/CVERecord?id=CVE-2024-1597), CVE Terms of Use, modified 2025-11-03
- GitHub Advisory Database: [GHSA-24rp-q3w6-vc56](https://github.com/advisories/GHSA-24rp-q3w6-vc56), CC-BY-4.0, modified 2026-09-10
- NVD: [CVE-2024-1597](https://nvd.nist.gov/vuln/detail/CVE-2024-1597), Public domain, modified 2026-06-17
- Bitnami Vulnerability Database: [BIT-POSTGRESQL-JDBC-DRIVER-2024-1597](https://osv.dev/vulnerability/BIT-POSTGRESQL-JDBC-DRIVER-2024-1597), Apache-2.0, modified 2026-09-10

---

Page: https://cve.day/CVE-2024-1597 · Whole record: https://cve.day/CVE-2024-1597.json · Rebuilt by cve.day 2026-11-25T22:58:36.896Z
