Horizon Alert
Summary of the vulnerability and why it matters
This vulnerability allows an attacker to inject malicious SQL by sending an unusually large query or bind message to applications using the pgx PostgreSQL driver. The driver miscalculates the size of messages larger than 4 GB, causing it to split the attacker's message into multiple smaller messages, bypassing intended security checks. This could allow unauthorized access to or modification of sensitive data.
- Potential for data compromise.
- Affects applications using the pgx Go driver.
- Requires a very large message to trigger.
Attack Path
How an attacker could exploit the issue
An attacker could exploit this by crafting a malformed, exceptionally large SQL query or bind message intended for a Go application using the vulnerable pgx PostgreSQL driver. The integer overflow allows this large message to be split into smaller ones, bypassing size restrictions and potentially leading to SQL injection.
- Network access required.
- Target: Go applications using pgx.
- Large message bypasses size limits.
Live Threat
Current exploitation, exposure, and threat context
This vulnerability presents a low immediate threat because it requires an attacker to craft a single SQL query or bind message exceeding 4 GB. Such large messages are often blocked by network infrastructure like web servers or proxies, and triggering this requires specific application configurations that are uncommon, making direct internet exploitation unlikely.
- No known exploit in the wild.
- Not on the KEV catalog.
Priority actions
Operational Fix
Recommended remediation, mitigation, and detection steps
Prioritize patching affected pgx and pgproto3 Go libraries to versions v4.18.2, v5.5.4, or newer to address a critical SQL injection vulnerability caused by an integer overflow. If immediate patching is not feasible, implement strict input validation to reject user-supplied messages exceeding 4 GB to prevent triggering the overflow condition.
- Update pgx to v4.18.2 or v5.5.4.
- Validate and reject large query messages.
- Monitor for unusually large query sizes.