CVE-2024-27304: SQL Injection in pgx via Protocol Message Size Integer Overflow
- Vendors
- Pgproto3 ProjectJackcPgx Project
CVE-2024-27304 is a SQL injection vulnerability in pgx, a PostgreSQL driver and toolkit for Go. The flaw occurs when an attacker can cause a single PostgreSQL query or bind protocol message to exceed 4 GB in size. In that condition, an integer overflow in the driver's calculated message size can cause what should be one large message to be emitted as multiple protocol messages under attacker control. This breaks the intended framing of the PostgreSQL wire protocol and can allow attacker-influenced SQL to be interpreted separately, resulting in SQL injection. Fixed releases are pgx v4.18.2 and v5.5.4.
Impact, mitigation & remediation
What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.
Impact
What an attacker gets, and what they’ve been doing with it.
Successful exploitation can allow an attacker to transform oversized application input into attacker-controlled PostgreSQL protocol message boundaries, leading to SQL injection against the backend database. Depending on application behavior and database privileges, this can enable unauthorized query execution, modification or deletion of data, disclosure of sensitive information, and potentially broader compromise of database integrity.
Mitigation
If you can’t patch tonight, do this now.
If immediate upgrade is not possible, enforce strict input size limits so that no single query or bind message can exceed 4 GB. Validate and reject oversized user-controlled inputs before they are incorporated into database operations. Additional defensive measures such as minimizing database privileges and using safer query construction patterns may reduce impact, but they do not replace upgrading.
Remediation
Patch, then assume compromise.
Upgrade pgx to a fixed version. For v4 branches, upgrade to v4.18.2 or later. For v5 branches, upgrade to v5.5.4 or later. Ensure downstream products and applications that vendor or bundle pgx also incorporate the corrected dependency version.
Exploits
2 exploits validated by Mallory's analysis.
Affected products & vendors
Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.
References
Frequently asked questions
- Is CVE-2024-27304 exploited in the wild?
- As of Oct 16, 2026, Mallory has no reports of CVE-2024-27304 being exploited in the wild. It is not listed in CISA KEV.
- Is there a public exploit for CVE-2024-27304?
- Yes. Mallory tracks 2 public exploits or proofs of concept for CVE-2024-27304, the earliest disclosed Oct 12, 2025.
- Is there a patch for CVE-2024-27304?
- Upgrade pgx to a fixed version. For v4 branches, upgrade to v4.18.2 or later.
- What products are affected by CVE-2024-27304?
- Pgx Project Pgx, Jackc Pgx, Pgproto3 Project Pgproto3, and Jackc Pgproto3.
- How severe is CVE-2024-27304?
- CVE-2024-27304 has a CVSS v3.1 score of 9.8 (Critical) and an EPSS score of 1.1% (67th percentile) as of Oct 16, 2026.
Recent activity
2 sources tracked across advisories and community write-ups. News coverage will land here when it surfaces.
No news coverage yet. Advisories and community discussion only.