{"id":"CVE-2026-41889","aliases":["CVE-2026-41889","GHSA-j88v-2chj-qfwx","GO-2026-5004"],"related":["CGA-rrgr-7xqx-rg3q"],"kind":"vulnerability","state":"published","title":"pgx: SQL Injection via placeholder confusion with dollar quoted string literals","summary":"pgx is a PostgreSQL driver and toolkit for Go. Prior to version 5.9.2, 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, and the value of that placeholder is controllable by the attacker. This issue has been patched in version 5.9.2.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"pgx is a PostgreSQL driver and toolkit for Go. Prior to version 5.9.2, 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, and the value of that placeholder is controllable by the attacker. This issue has been patched in version 5.9.2.","source":"cvelist"},{"lang":"en","text":"### Impact\n\nSQL Injection can occur when:\n\n1. The non-default simple protocol is used.\n2. A dollar quoted string literal is used in the SQL query.\n3. That string literal contains text that would be would be interpreted as a placeholder outside of a string literal.\n4. The value of that placeholder is controllable by the attacker.\n\ne.g.\n\n```go\nattackValue := `$tag$; drop table canary; --`\n_, err = tx.Exec(ctx, `select $tag$ $1 $tag$, $1`, pgx.QueryExecModeSimpleProtocol, attackValue)\n```\n\nThis is unlikely to occur outside of a contrived scenario.\n\n### Patches\n\nThe problem is resolved in v5.9.2.\n\n### Workarounds\n\nDo not use the simple protocol to execute queries matching all the above conditions.","format":"markdown","source":"ghsa"},{"lang":"en","text":"SQL Injection can occur when using the non-default simple protocol with a dollar quoted string literal in the SQL query. If that string literal contains text that would be interpreted as a placeholder outside of a string literal, and the value of that placeholder is controllable by the attacker, an injection may be possible.\n\nFor example, an attacker could provide a value that includes a closing dollar quote followed by malicious SQL commands. This is unlikely to occur outside of a contrived scenario.","format":"markdown","source":"go"},{"lang":"es","text":"pgx es un controlador y kit de herramientas de PostgreSQL para Go. Antes de la versión 5.9.2, puede ocurrir una inyección SQL cuando se utiliza el protocolo simple no predeterminado, se utiliza un literal de cadena entre comillas de dólar en la consulta SQL, ese literal de cadena contiene texto que sería interpretado como un marcador de posición fuera de un literal de cadena, y el valor de ese marcador de posición es controlable por el atacante. Este problema ha sido parcheado en la versión 5.9.2.","source":"nvd"}],"published":"2026-04-22T20:46:51.000Z","modified":"2026-10-26T18:10:00.173Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:H/AT:P/PR:L/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N","score":2.3,"rating":"LOW"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:H/AT:P/PR:L/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N","score":2.3,"rating":"LOW"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:H/AT:P/PR:L/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N","rating":"LOW"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"}],"cwes":["CWE-89"],"affected":[{"ranges":[{"version":"< 5.9.2","status":"affected"}],"vendor":"jackc","product":"pgx","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"5.9.2"}],"ecosystem":"Go","package":"github.com/jackc/pgx/v5","purl":"pkg:golang/github.com/jackc/pgx/v5","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","lastAffected":"4.18.3"}],"ecosystem":"Go","package":"github.com/jackc/pgx/v4","purl":"pkg:golang/github.com/jackc/pgx/v4","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","lastAffected":"3.6.2"}],"ecosystem":"Go","package":"github.com/jackc/pgx","purl":"pkg:golang/github.com/jackc/pgx","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected"}],"ecosystem":"Go","package":"github.com/jackc/pgx","purl":"pkg:golang/github.com/jackc/pgx","source":"go"},{"ranges":[{"type":"semver","introduced":"0","status":"affected"}],"ecosystem":"Go","package":"github.com/jackc/pgx/v4","purl":"pkg:golang/github.com/jackc/pgx/v4","source":"go"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"5.9.2"}],"ecosystem":"Go","package":"github.com/jackc/pgx/v5","purl":"pkg:golang/github.com/jackc/pgx/v5","source":"go"},{"ranges":[{"status":"affected","fixed":"5.9.2"}],"vendor":"jackc","product":"pgx","cpe":"cpe:2.3:a:jackc:pgx:*:*:*:*:*:go:*:*","source":"nvd"}],"references":[{"url":"https://github.com/jackc/pgx/security/advisories/GHSA-j88v-2chj-qfwx","tags":["advisory","mitigation","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/jackc/pgx/commit/60644f84918a8af66d14a4b0d865d4edafd955da","tags":["fix","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/jackc/pgx/releases/tag/v5.9.2","tags":["release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-41889","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/jackc/pgx","tags":["package"],"sources":["ghsa"]}],"credits":["Jack Christensen"],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-05-08T19:38:09.336Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-41889","url":"https://www.cve.org/CVERecord?id=CVE-2026-41889","licence":"CVE Terms of Use","modified":"2026-05-08T19:38:34.153Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-j88v-2chj-qfwx","url":"https://github.com/advisories/GHSA-j88v-2chj-qfwx","licence":"CC-BY-4.0","modified":"2026-09-10T03:51:02.204Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-5004","url":"https://pkg.go.dev/vuln/GO-2026-5004","licence":"CC-BY-4.0","modified":"2026-06-25T18:45:14.963Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-41889","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-41889","licence":"Public domain","modified":"2026-10-26T18:10:00.173Z"}],"updatedAt":"2026-11-25T22:59:21.102Z","epss":{"score":0.00369,"percentile":0.32797,"date":"2026-12-02T12:00:21.000Z"}}