cve.bz

CVE-2024-1597 SQL Injection

9.8 criticalEPSS 4.8%Fix available

Critical (9.8). EPSS 4.8% estimated probability of exploitation activity in the next 30 days. Fixed in org.postgresql:postgresql 42.2.28, 42.3.9, 42.4.4.

On this page
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.

Severity

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
EPSS
4.8% (unchanged from 4.8% a week ago; 4.8% 30 days ago) estimated probability of exploitation activity in the next 30 days; 92nd percentile. Scored 2026-11-22. A forecast for this CVE across the internet, not for your own systems.
CISA's assessment (SSVC)
Exploitation: PoC · Automatable: yes · Technical impact: total, assessed 2024-04-10. From CISA's Vulnrichment in the CVE List: whether it is exploited, whether exploiting it can be automated, and how much control it gives.
CWE
CWE-89 Improper Neutralization of Special Elements used in an SQL Command (SQL Injection)
OWASP Top 10
A05:2025 Injection
Published
Modified
NVD analysis
Analyzed, since modified
Record from
the NVD, synced

Fix and patched versions

  • org.postgresql:postgresql (Maven): fixed in 42.2.28, 42.3.9, 42.4.4, 42.5.5, 42.6.1, 42.7.2
  • Debian, Red Hat, SUSE, openSUSE, AlmaLinux, Rocky Linux, Alpine: fixed package versions per release

Ask an AI about this CVE

Show the promptExplain CVE-2024-1597 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2024-1597?via=ask-ai-copy and https://cve.bz/cve/CVE-2024-1597?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2024-1597 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the NVD's CPE matches.

ProductAffected
postgresql:postgresql_jdbc_driverbefore 42.2.28
postgresql:postgresql_jdbc_driverfrom 42.3.0 before 42.3.9
postgresql:postgresql_jdbc_driverfrom 42.4.0 before 42.4.4
postgresql:postgresql_jdbc_driverfrom 42.5.0 before 42.5.5
postgresql:postgresql_jdbc_driverfrom 42.6.0 before 42.6.1
postgresql:postgresql_jdbc_driverfrom 42.7.0 before 42.7.2
fedoraproject:fedora40

Packages (OSV)

AdvisoryEcosystemPackageAffectedFixed in
GHSA-24rp-q3w6-vc56Mavenorg.postgresql:postgresql<42.2.2842.2.28
GHSA-24rp-q3w6-vc56Mavenorg.postgresql:postgresql>=42.3.0 <42.3.942.3.9
GHSA-24rp-q3w6-vc56Mavenorg.postgresql:postgresql>=42.4.0 <42.4.442.4.4
GHSA-24rp-q3w6-vc56Mavenorg.postgresql:postgresql>=42.5.0 <42.5.542.5.5
GHSA-24rp-q3w6-vc56Mavenorg.postgresql:postgresql>=42.6.0 <42.6.142.6.1
GHSA-24rp-q3w6-vc56Mavenorg.postgresql:postgresql>=42.7.0 <42.7.242.7.2

Linux distributions

DistributionReleasePackageFixed inAdvisory
Debian10libpgjava42.2.5-2+deb10u4DLA-3812-1
Debian11libpgjava42.2.15-1+deb11u2DLA-3995-1
Debian12libpgjava42.5.5-0+deb12u1DEBIAN-CVE-2024-1597
Debian13, 14libpgjava42.7.2-1DEBIAN-CVE-2024-1597
Ubuntu14.04:LTS, 22.04:LTS, Pro:18.04:LTS and 1 morelibpgjavano fix listedUBUNTU-CVE-2024-1597
Red Hatenterprise_linux:8::appstreampostgresql-jdbc, postgresql-jdbc-javadoc0:42.2.14-3.el8_9RHSA-2024:1435
Red Hatenterprise_linux:9::appstreampostgresql-jdbc0:42.2.28-1.el9_3RHSA-2024:1436
Red Hatrhel_aus:8.2::appstream, rhel_e4s:8.2::appstream, rhel_tus:8.2::appstreampostgresql-jdbc, postgresql-jdbc-javadoc0:42.2.3-5.el8_2RHSA-2024:2624
Red Hatrhel_aus:8.4::appstream, rhel_e4s:8.4::appstream, rhel_tus:8.4::appstreampostgresql-jdbc, postgresql-jdbc-javadoc0:42.2.3-7.el8_4RHSA-2024:4375
Red Hatrhel_aus:8.6::appstream, rhel_e4s:8.6::appstream, rhel_tus:8.6::appstreampostgresql-jdbc, postgresql-jdbc-javadoc0:42.2.3-5.el8_6RHSA-2024:4402
Red Hatrhel_eus:8.8::appstreampostgresql-jdbc, postgresql-jdbc-javadoc0:42.2.14-5.el8_8RHSA-2024:3313
Red Hatrhel_eus:9.0::appstreampostgresql-jdbc0:42.2.28-1.el9_0RHSA-2024:1999
Red Hatrhel_eus:9.2::appstreampostgresql-jdbc0:42.2.28-1.el9_2RHSA-2024:1649
SUSEEnterprise Storage 7.1, Linux Enterprise High Performance Computing 15 SP3-LTSS, Linux Enterprise Server 15 SP3-LTSS and 1 morepostgresql-jdbc42.2.25-150300.3.14.1SUSE-SU-2024:0769-1
SUSELinux Enterprise High Performance Computing 15 SP4-ESPOS, Linux Enterprise High Performance Computing 15 SP4-LTSS, Linux Enterprise Module for Server Applications 15 SP5 and 4 morepostgresql-jdbc42.2.25-150400.3.12.1SUSE-SU-2024:0773-1
SUSELinux Enterprise Server 12 SP5, Linux Enterprise Server for SAP Applications 12 SP5postgresql-jdbc9.4-3.12.1SUSE-SU-2024:0771-1
openSUSELeap 15.5postgresql-jdbc42.2.25-150400.3.12.1SUSE-SU-2024:0773-1
AlmaLinux8postgresql-jdbc, postgresql-jdbc-javadoc42.2.14-3.el8_9ALSA-2024:1435
AlmaLinux9postgresql-jdbc42.2.28-1.el9_3ALSA-2024:1436
Rocky Linux8postgresql-jdbc0:42.2.14-3.el8_9RLSA-2024:1435
Rocky Linux9postgresql-jdbc0:42.2.28-1.el9_3RLSA-2024:1436
Alpinev3.19, v3.20, v3.21 and 3 morejava-postgresql-jdbc42.6.2-r0ALPINE-CVE-2024-1597

From the distributions' data via OSV.dev: the Debian Security Tracker; Ubuntu Security Notices © Canonical Ltd., CC BY-SA 4.0; Red Hat Security Data © Red Hat, Inc., CC BY 4.0; SUSE security data, CC BY 4.0; AlmaLinux's OSV database, MIT; Rocky Linux's errata, BSD-3-Clause; the Alpine secdb, CC BY-SA 4.0. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Debian · Ubuntu · Red Hat · SUSE · openSUSE · Alpine.

Red Hat

Red Hat rates this Important.

Red Hat's statement

The PostgreSQL JDBC Driver is not affected in the default query mode. Users that do not override the query mode are not impacted.

The described SQL injection vulnerability, while significant, is categorized as important rather than critical due to several factors. Firstly, the exploitation relies on specific conditions, including the use of a non-default query mode (preferQueryMode=simple) and the precise arrangement of user-controlled parameters within the SQL query. This limits the potential attack surface and reduces the likelihood of widespread exploitation across systems. Additionally, the vulnerability does not pose an immediate and severe risk of system compromise or data breach; rather, it enables attackers to manipulate SQL queries and potentially execute arbitrary commands within the context of the application's database. Furthermore, the vulnerability can be effectively mitigated by applying the provided patch or by avoiding the use of the vulnerable query mode, thus reducing the risk of exploitation.

Red Hat Satellite ships a PostgreSQL JDBC Driver which embeds into Candlepin. However, Candlepin doesn't directly utilize the PostgreSQL JDBC Driver and doesn't set PreferQueryMode. Therefore, although the affected component is shipped, the product impact is considered Low. This issue may be addressed in a future Satellite release.

Red Hat's mitigation

Do not use the connection propertypreferQueryMode=simple. If you do not explicitly specify a query mode, then you are using the default of extended and are not impacted by this issue.

ProductPackageStateAdvisory
Red Hat build of Apache Camel 4.4.1 for Spring Boot 3.2pgjdbcFixed 2024-07-25RHSA-2024:4884
Red Hat build of Keycloak 24pgjdbcFixed 2024-04-29RHBA-2024:2108
Red Hat build of Quarkus 2.13.9.SP2org.postgresql/postgresql:42.5.6.redhat-00001Fixed 2024-04-22RHSA-2024:1797
Red Hat build of Quarkus 3.2.11.Finalorg.postgresql/postgresql:42.6.1.redhat-00001Fixed 2024-04-03RHSA-2024:1662
Red Hat Enterprise Linux 8postgresql-jdbc-0:42.2.14-3.el8_9Fixed 2024-03-20RHSA-2024:1435
Red Hat Enterprise Linux 8.2 Advanced Update Supportpostgresql-jdbc-0:42.2.3-5.el8_2Fixed 2024-04-30RHSA-2024:2624
Red Hat Enterprise Linux 8.2 Telecommunications Update Servicepostgresql-jdbc-0:42.2.3-5.el8_2Fixed 2024-04-30RHSA-2024:2624
Red Hat Enterprise Linux 8.2 Update Services for SAP Solutionspostgresql-jdbc-0:42.2.3-5.el8_2Fixed 2024-04-30RHSA-2024:2624
Red Hat Enterprise Linux 8.4 Advanced Mission Critical Update Supportpostgresql-jdbc-0:42.2.3-7.el8_4Fixed 2024-07-08RHSA-2024:4375
Red Hat Enterprise Linux 8.4 Telecommunications Update Servicepostgresql-jdbc-0:42.2.3-7.el8_4Fixed 2024-07-08RHSA-2024:4375
Red Hat build of Apache Camel 4 for Quarkus 3pgjdbcWill not fix
Red Hat build of Apache Camel for Spring Boot 3pgjdbcAffected
Red Hat build of Apicurio Registry 2pgjdbcNot affected
Red Hat build of OptaPlanner 8pgjdbcWill not fix
Red Hat Enterprise Linux 6postgresql-jdbcNot affected
Red Hat Enterprise Linux 7postgresql-jdbcNot affected
Red Hat Enterprise Linux 8libreoffice:flatpak/postgresql-jdbcWill not fix
Red Hat Enterprise Linux 9libreoffice:flatpak/postgresql-jdbcWill not fix
Red Hat Fuse 7pgjdbcNot affected
Red Hat Integration Camel Quarkus 2pgjdbcWill not fix
24 more in the JSON and on Red Hat's page.

Contains Red Hat Security Data © Red Hat, Inc., licensed under CC BY 4.0. Source: https://access.redhat.com/security/data. Modified: reformatted. Red Hat's page for CVE-2024-1597.

Attack patterns (CAPEC)

  • CAPEC-7 Blind SQL Injection Likelihood: High · Severity: High
  • CAPEC-66 SQL Injection Likelihood: High · Severity: High
  • CAPEC-108 Command Line Execution through SQL Injection Likelihood: Low · Severity: Very High
  • CAPEC-109 Object Relational Mapping Injection Likelihood: Low · Severity: High
  • CAPEC-110 SQL Injection through SOAP Parameter Tampering Likelihood: High · Severity: Very High
  • CAPEC-470 Expanding Control over the Operating System from the Database Severity: Very High

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits.

References

Check your stackJSON