Advisory

GHSA-j88v-2chj-qfwx

Also known as: CVE-2026-41889, GO-2026-5004

Summary

pgx: SQL Injection via placeholder confusion with dollar quoted string literals

Details

Impact

SQL Injection can occur when:

  1. The non-default simple protocol is used.
  2. A dollar quoted string literal is used in the SQL query.
  3. That string literal contains text that would be would be interpreted as a placeholder outside of a string literal.
  4. The value of that placeholder is controllable by the attacker.

e.g.

attackValue := `$tag$; drop table canary; --`
_, err = tx.Exec(ctx, `select $tag$ $1 $tag$, $1`, pgx.QueryExecModeSimpleProtocol, attackValue)

This is unlikely to occur outside of a contrived scenario.

Patches

The problem is resolved in v5.9.2.

Workarounds

Do not use the simple protocol to execute queries matching all the above conditions.

Severity

Low Basis: The source's own band: LOW

Dates

Published
2026-04-22 20:46 UTC
Modified
2026-09-10 03:51 UTC

Affected packages and fixes

github.com/jackc/pgx/v5

Go · All systems

Affected

  • introduced 0, fixed 5.9.2 (semver)

Fixed versions

5.9.2

Fix

github.com/jackc/pgx/v4

Go · All systems

Affected

  • introduced 0, last affected 4.18.3 (semver)

Fixed versions

None listed

Fix

No fixed version is listed.

github.com/jackc/pgx

Go · All systems

Affected

  • introduced 0, last affected 3.6.2 (semver)

Fixed versions

None listed

Fix

No fixed version is listed.

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences