Skip to content
SQL injection Write-up Intermediate

Critical Vulnerability in PostgreSQL JDBC Driver — Understanding CVE-2024–1597

The PostgreSQL JDBC Driver, when configured with PreferQueryMode=SIMPLE, fails to properly handle parameterised queries where a numeric placeholder is followed by a minus sign and then a string placeholder on the same line, allowing SQL injection. An attacker could inject malicious SQL to expose or manipulate data.

elniak Follow

Published on systemweakness.com

Today, we’re zeroing in on a piece of news that’s been making waves across our circles: CVE-2024–1597.

ElNiak, on systemweakness.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the driver's simple query mode mishandles the combination of a numeric placeholder, a minus sign, and a string placeholder on the same line, causing the minus sign to be interpreted as part of the SQL rather than as a separator.

Impact

SQL injection could lead to unauthorised data exposure, data manipulation, and in some cases full control over the affected database.

What the attacker needed

PreferQueryMode=SIMPLE configured; application uses parameterised queries with numeric and…; attacker can control input values

The fix

The PostgreSQL JDBC Driver team released updated versions that address the vulnerability; users should upgrade to a patched version.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Parameterised queries are a standard way to stop SQL injection: you send the SQL command and the data separately, so the database never treats user input as code. This bug shows that under a specific driver setting, that separation breaks for a particular pattern of placeholders, letting an attacker slip SQL commands into what should be data.

What is SQL injection?

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.

More by elniak

View all

28 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.