NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · Go

CVE-2026-41889: pgx: SQL Injection via placeholder confusion with dollar quoted string literals

lowCVSS 4.0 2.3GHSA-j88v-2chj-qfwx

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. This is unlikely to occur outside of a contrived scenario.

Published Apr 22, 2026 · Updated May 13, 2026

Affected packages

github.com/jackc/pgx/v5

Ecosystem
Go
Affected
< 5.9.2
Fixed in
5.9.2
Check
go list -m github.com/jackc/pgx/v5

github.com/jackc/pgx/v4

Ecosystem
Go
Affected
<= 4.18.3
Fixed in
No patched version yet
Check
go list -m github.com/jackc/pgx/v4

github.com/jackc/pgx

Ecosystem
Go
Affected
<= 3.6.2
Fixed in
No patched version yet
Check
go list -m github.com/jackc/pgx

Advisory details

From the GitHub Advisory Database (CC BY 4.0).

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.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology

More Go vulnerabilities

All Go entries