pgx SQL Injection via Protocol Message Size Overflow
jackc pgx
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| github.com/jackc/pgproto3 Go |
|
|
| github.com/jackc/pgproto3/v2 Go |
|
|
| github.com/jackc/pgx Go |
jackc pgx
| Product | Affected | Fixed in |
|---|---|---|
| github.com/jackc/pgproto3 Go |
|
|
| github.com/jackc/pgproto3/v2 Go |
|
|
| github.com/jackc/pgx Go |
< 4.18.2≥ 5.0.0 · < 5.5.4all versions
|
| github.com/jackc/pgx/v4 Go |
|
|
| github.com/jackc/pgx/v5 Go |
|
|
pgx is a PostgreSQL driver and toolkit for Go. SQL injection can occur if an attacker can cause a single query or bind message to exceed 4 GB in size. An integer overflow in the calculated message size can cause the one large message to be sent as multiple messages under the attacker's control. The problem is resolved in v4.18.2 and v5.5.4. As a workaround, reject user input large enough to cause a single query or bind message to exceed 4 GB in size.
From the CVE record · GitHub_M
pgx and pgproto3 can calculate the size of a large query or bind message incorrectly due to an integer overflow. If an attacker can cause a single message to exceed 4 GB, it may be sent as multiple attacker-controlled messages, leading to SQL injection.
Check Go applications using github.com/jackc/pgproto3 or github.com/jackc/pgproto3/v2 before 2.3.3, github.com/jackc/pgx or github.com/jackc/pgx/v4 before 4.18.2, or pgx v5 before 5.5.4.