PortGate

Advisories · Databases

CVE-2024-1597 Critical CVSS 9.8

PostgreSQL JDBC SQL injection

Disclosed 2024 · Last reviewed 2 Dec 2026

With PreferQueryMode=SIMPLE, a numeric placeholder could break out of the SQL the driver sent.

What happened

Simple query mode interpolated a value that the extended protocol would have sent separately.

Affected and patched versions

Affected
pgjdbc before 42.7.2, 42.6.1, 42.5.5, 42.4.4, 42.3.9, and 42.2.28 when PreferQueryMode is SIMPLE.
Patched
Those driver releases. The default query mode is not SIMPLE.

How to check your server

Check

mvn -q dependency:list | grep postgresql

How to fix and harden

  1. Find the pgjdbc version in the build.
  2. Upgrade the driver on the 42.x line you already use.
  3. Leave PreferQueryMode at its default unless you have a measured reason to set SIMPLE.

Fix

mvn -q dependency:list

Sources

Version ranges and fixes follow the vendor advisory. When a distribution backports a fix, trust its security tracker over the upstream version number. New advisories: RSS · JSON