CVE-2026-41889: pgx: SQL Injection via placeholder confusion with dollar quoted string literals
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:
- The non-default simple protocol is used.
- A dollar quoted string literal is used in the SQL query.
- That string literal contains text that would be would be interpreted as a placeholder outside of a string literal.
- 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 entriesCVE-2026-33815
pgx contains memory-safety vulnerability
critical9.8Apr 7, 2026CVE-2026-33816
Memory-safety vulnerability in github.com/jackc/pgx/v5.
critical9.8Apr 7, 2026GHSA-fqpg-rq76-99pq
Panic in Pipeline when PgConn is busy or closed in github.com/jackc/pgx
medium5.3Jul 5, 2024CVE-2024-27289
pgx SQL Injection via Line Comment Creation
high8.1Mar 4, 2024CVE-2024-27304
pgx SQL Injection via Protocol Message Size Overflow
high9.8Mar 4, 2024
