SQL Injection Affecting github.com/jackc/pgx/v5 package, versions <5.9.2


Severity

Recommended
0.0
low
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.36% (28th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about SQL Injection vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-GOLANG-GITHUBCOMJACKCPGXV5-16134557
  • published26 Apr 2026
  • disclosed22 Apr 2026
  • creditUnknown

Introduced: 22 Apr 2026

CVE-2026-41889  (opens in a new tab)
CWE-89  (opens in a new tab)

How to fix?

Upgrade github.com/jackc/pgx/v5 to version 5.9.2 or higher.

Overview

github.com/jackc/pgx/v5 is a pure Go driver and toolkit for PostgreSQL

Affected versions of this package are vulnerable to SQL Injection when using the simple protocol with dollar quoted string literals. An attacker can execute arbitrary SQL commands by crafting input that is interpreted as a placeholder within a dollar quoted string literal.

Note:

This is only exploitable if the simple protocol is used, a dollar quoted string literal is present in the query, the string literal contains text interpreted as a placeholder outside of a string literal, and the value of that placeholder is attacker-controlled.

Workaround

This vulnerability can be mitigated by avoiding the use of the simple protocol for queries that meet all the above conditions.

PoC

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

CVSS Base Scores

version 4.0
version 3.1