Vulnerabilities in pkg:golang/github.com/jackc/pgx/v4

PACKAGE
Advisory Identifier: GHSA-j88v-2chj-qfwx
Advisory Summary

CVE-2026-41889 is a LOW sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting pgx libraries in the Go ecosystem. The issue involves sql injection via placeholder confusion with dollar quoted string literals. Remediation is available by upgrading affected packages to version 5.9.2.

3 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/jackc/pgx/v4

3 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/jackc/pgx/v4. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-j88v-2chj-qfwx CVE-2026-41889 LOW pgx: SQL Injection via placeholder confusion with dollar quoted string literals
GHSA-m7wr-2xf7-cm9p CVE-2024-27289 HIGH pgx SQL Injection via Line Comment Creation
GHSA-mrww-27vc-gghv CVE-2024-27304 HIGH pgx SQL Injection via Protocol Message Size Overflow

CVE-2026-41889 at a Glance

CVE Identifier CVE-2026-41889
GHSA Identifier GHSA-j88v-2chj-qfwx
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product pgx
Package Ecosystem Go
Published Date
Last Updated

How to Fix CVE-2026-41889

To remediate this vulnerability, upgrade all affected pgx dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/jackc/pgx/v5 fixed: 5.9.2
Upgrade github.com/jackc/pgx/v5 to 5.9.2
github.com/jackc/pgx/v4 fixed: Latest secure release
Upgrade github.com/jackc/pgx/v4 to Latest secure release
github.com/jackc/pgx fixed: Latest secure release
Upgrade github.com/jackc/pgx to Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/jackc/pgx/v5

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-41889, inspect your project dependencies for pgx:

inspect dependencies for github.com/jackc/pgx/v5

Analyze the terminal output to locate any version of pgx in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.9.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In pgx, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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. ```go 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.

CVE-2026-41889 Affected pgx Versions

3 component(s)
Fixed Versions:
5.9.2
Product / Package Ecosystem Affected Versions Fixed Version
github.com/jackc/pgx/v5
Go
< 5.9.2
5.9.2
github.com/jackc/pgx/v4
Go
≤ 4.18.3
github.com/jackc/pgx
Go
≤ 3.6.2

References

Frequently Asked Questions

What is CVE-2026-41889?
CVE-2026-41889 is a security vulnerability in pgx involving SQL Injection via placeholder confusion with dollar quoted string literals under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which pgx versions are affected?
Affected versions include releases prior to 5.9.2 across affected packages: github.com/jackc/pgx/v5, github.com/jackc/pgx/v4, github.com/jackc/pgx.
What version fixes CVE-2026-41889?
Upgrading to 5.9.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/jackc/pgx/v5 affected?
Yes, github.com/jackc/pgx/v5 is affected in releases prior to 5.9.2. Upgrade your dependency to 5.9.2 or later.
Is github.com/jackc/pgx/v4 affected?
Yes, github.com/jackc/pgx/v4 is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What CWE is associated with CVE-2026-41889?
CVE-2026-41889 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.).
How can I check Go dependencies for CVE-2026-41889?
Run the dependency tree command: 'inspect dependencies for github.com/jackc/pgx/v5'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-j88v-2chj-qfwx",
  "modified" : "2026-05-13T13:30:26Z",
  "published" : "2026-04-22T20:46:51Z",
  "aliases" : [ "CVE-2026-41889" ],
  "summary" : "pgx: SQL Injection via placeholder confusion with dollar quoted string literals",
  "details" : "### 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.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/jackc/pgx/v5"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.9.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/jackc/pgx/v4"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "4.18.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/jackc/pgx"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "3.6.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/jackc/pgx/security/advisories/GHSA-j88v-2chj-qfwx"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-41889"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jackc/pgx/commit/60644f84918a8af66d14a4b0d865d4edafd955da"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/jackc/pgx"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jackc/pgx/releases/tag/v5.9.2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-22T20:46:51Z",
    "nvd_published_at" : "2026-05-08T17:16:31Z"
  }
}