CVE-2024-1597
Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.
NVD · uneditedpgjdbc, 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.
Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.
dbcve analysis · high confidenceThe PostgreSQL JDBC Driver (pgjdbc) has a SQL injection vulnerability when PreferQueryMode=SIMPLE is enabled. An attacker can inject malicious SQL by crafting a payload where a numeric parameter placeholder is preceded by a minus sign and followed by a string placeholder on the same line, bypassing the protections of parameterized queries.
Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.
Affected products & versions What the vendor confirmedThe version ranges the vendor confirmed as vulnerable. If your version sits inside a range here, treat yourself as exposed until you have upgraded.
NVD · CPE data< 42.2.28>= 42.3.0, < 42.3.9>= 42.4.0, < 42.4.4>= 42.5.0, < 42.5.5>= 42.6.0, < 42.6.1>= 42.7.0, < 42.7.2= 40CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.
From the vector- Attack vector
- Network
- Complexity
- Low
- Privileges
- None
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- High
- Availability
- High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.
dbcve checksWork through these to decide whether this CVE applies to you.
-
Identify pgjdbc driver versionLocate the pgjdbc jar file in your application classpath or dependencies (typically named pgjdbc-*.jar or managed via Maven/Gradle dependencies). Check the filename or manifest for the version number.Affected if The version is less than 42.2.28, or between 42.3.0-42.3.8, 42.4.0-42.4.3, 42.5.0-42.5.4, 42.6.0-42.6.0, or 42.7.0-42.7.1.
-
Check PreferQueryMode connection propertyReview your JDBC connection string or data source configuration for the property PreferQueryMode. Look for PreferQueryMode=SIMPLE in your connection parameters.Affected if PreferQueryMode is explicitly set to SIMPLE.
-
Verify connection property sourceInspect all configuration files, environment variables, or application code where JDBC connection properties are defined to confirm whether PreferQueryMode=SIMPLE is in use.Affected if PreferQueryMode=SIMPLE is found in any connection configuration.
Your environment is affected if you use a pgjdbc version within the affected ranges AND have PreferQueryMode=SIMPLE enabled in your JDBC connection configuration.
Generated from the published advisory. Verify against your own configuration.
Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.
dbcve · scoped42.2.2842.3.942.4.4
Upgrade pgjdbc to version 42.7.2, 42.6.1, 42.5.5, 42.4.4, 42.3.9, or 42.2.28 or later. If upgrading is not immediately possible, avoid using PreferQueryMode=SIMPLE.
42.7.2 or latest stable 42.x release (e.g., 42.7.3, 42.8.0)
- Identify all project build configurations that contain the PostgreSQL JDBC Driver dependency (pom.xml, build.gradle, package.json, or direct JAR references)
- For Maven projects: Update the pgjdbc version in pom.xml to 42.7.2 or later: <dependency><groupId>org.postgresql</groupId><artifactId>postgresql</artifactId><version>42.7.2</version></dependency>
- For Gradle projects: Update the dependency to implementation 'org.postgresql:postgresql:42.7.2'
- For direct JAR deployment: Download the new driver JAR from https://jdbc.postgresql.org/download/ and replace the existing pgjdbc driver in your classpath
- Rebuild the project and run tests to verify the upgrade does not break existing functionality
- Redeploy the updated application
Generated from the published advisory — verify against the referenced sources before acting.
- Consultation4.0 h
- Implementation2.0 h
- Testing8.0 h
- Review / QA2.0 h
An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $4,352.
Scan for this in your stack
Free · runs locallyCheck whether your project pulls in CVE-2024-1597 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.
References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.
Primary sourcesPractitioner notes
ContributedPeer-ranked notes from engineers who’ve handled CVE-2024-1597 in production — separate from our analysis above.
The advisory tells you what broke. It rarely tells you what actually worked. If you’ve dealt with this one, that detail is what the next engineer is searching for.
- The version that genuinely resolved it — not the one the vendor claimed
- A config change or rule that shut the vector down
- A gotcha in the upgrade path that cost you an afternoon
No notes yet
Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.
A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.
- Verified mitigations, workarounds, and config changes
- Version or environment caveats, and links to real fixes
- No weaponised exploit code, or anything meant to cause harm
- No spam, self-promotion, credentials, or personal data