pgx SQL Injection via Protocol Message Size Overflow
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.
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2024-27304
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 6 Nov 2026, 09:01 UTC · Revision 1
Source evidence
pgx SQL Injection via Protocol Message Size Overflow
core-osv · Original sourcePublished 6 Mar 2024, 19:07 UTC
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.
osv:CVE-2024-27304
Complete source record
{
"id": "de0c9811cc991307cb07e4927bcf85633e5390040b6b9758ae687e391140e707",
"url": "https://osv.dev/vulnerability/CVE-2024-27304",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "pgx SQL Injection via Protocol Message Size Overflow",
"summary": "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.",
"evidence": "osv:CVE-2024-27304",
"products": [],
"severity": "critical",
"structured": {
"id": "CVE-2024-27304",
"aliases": [
"CVE-2024-27304",
"GHSA-7jwh-3vrq-q3m8",
"GHSA-mrww-27vc-gghv",
"GO-2024-2606"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/jackc/pgproto3",
"type": "GIT",
"events": [
{
"introduced": "0"
},
{
"fixed": "945c2126f6db8f3bea7eeebe307c01fe92bca007"
}
],
"database_specific": {
"extracted_events": [
{
"cpe": "cpe:2.3:a:jackc:pgproto3:*:*:*:*:*:go:*:*",
"range": [
{
"introduced": "0"
},
{
"fixed": "2.3.3"
}
],
"source": "CPE_RANGE"
},
{
"range": [
{
"fixed": "945c2126f6db8f3bea7eeebe307c01fe92bca007"
}
],
"source": "REFERENCES_COMMIT"
}
]
}
},
{
"repo": "https://github.com/jackc/pgx",
"type": "GIT",
"events": [
{
"introduced": "0"
},
{
"fixed": "14690df4c533758df97f7cc561cb9062155045c6"
},
{
"introduced": "4fc4f9a60337af3bd7c6abdf6c71460712d112fc"
},
{
"fixed": "da6f2c98f2664b215b40b1606551fdfcc7f3ea5c"
},
{
"fixed": "adbb38f298c76e283ffc7c7a3f571036fea47fd4"
},
{
"fixed": "c543134753a0c5d22881c12404025724cb05ffd8"
},
{
"fixed": "f94eb0e2f96782042c96801b5ac448f44f0a81df"
}
],
"database_specific": {
"extracted_events": [
{
"cpe": "cpe:2.3:a:jackc:pgx:*:*:*:*:*:go:*:*",
"range": [
{
"introduced": "0"
},
{
"fixed": "4.18.2"
}
],
"source": "CPE_RANGE"
},
{
"cpe": "cpe:2.3:a:jackc:pgx:*:*:*:*:*:go:*:*",
"range": [
{
"introduced": "5.0.0"
},
{
"fixed": "5.5.4"
}
],
"source": "CPE_RANGE"
},
{
"range": [
{
"fixed": "adbb38f298c76e283ffc7c7a3f571036fea47fd4"
}
],
"source": "REFERENCES_COMMIT"
},
{
"range": [
{
"fixed": "c543134753a0c5d22881c12404025724cb05ffd8"
}
],
"source": "REFERENCES_COMMIT"
},
{
"range": [
{
"fixed": "f94eb0e2f96782042c96801b5ac448f44f0a81df"
}
],
"source": "REFERENCES_COMMIT"
}
]
}
}
],
"versions": [
"v2.3.2",
"v2.3.1",
"v2.3.0",
"v2.2.0",
"v2.1.1",
"v2.1.0",
"v2.0.7",
"v2.0.6",
"v2.0.5",
"v2.0.4",
"v2.0.3",
"v2.0.2",
"v2.0.1",
"v2.0.0",
"v2.0.0-rc3",
"v2.0.0-rc2",
"v2.0.0-rc1",
"v2.0.0-alpha1",
"v1.1.0",
"v1.0.0",
"v4.18.1",
"v5.5.3",
"v5.5.2",
"v5.5.1",
"v5.5.0",
"v5.4.3",
"v5.4.2",
"v5.4.1",
"v5.4.0",
"v5.3.1",
"v5.3.0",
"v4.18.0",
"v5.2.0",
"v5.1.1",
"v5.1.0",
"v5.0.4",
"v5.0.3",
"v5.0.2",
"v5.0.1",
"v5.0.0",
"v4.17.2",
"v4.17.1",
"v4.17.0",
"v4.16.1",
"v4.16.0",
"v4.15.0",
"v4.14.1",
"v4.14.0",
"v4.13.0",
"v4.12.0",
"v4.11.0",
"v4.10.1",
"v4.10.0",
"v4.9.2",
"v4.9.1",
"v4.9.0",
"v4.8.1",
"v4.8.0",
"v4.7.2",
"v4.7.1",
"v4.7.0",
"v4.6.0",
"v4.5.0",
"v4.4.1",
"v4.4.0",
"v4.3.0",
"v4.2.1",
"v4.2.0",
"v4.1.2",
"v4.1.1",
"v4.1.0",
"v4.0.1",
"v4.0.0",
"v4.0.0-rc2",
"v4.0.0-rc1",
"v4.0.0-pre2",
"v4.0.0-pre1",
"v3.2.0",
"v3.1.0",
"v3.0.1",
"v3.0.0",
"v2.11.0",
"v2.10.0",
"v2.9.0",
"v2.8.1",
"v2.8.0",
"v2.7.1",
"v2.7.0",
"v2.6.0",
"v2.5.0",
"v2.4.0"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2024-27304.json"
}
}
],
"modified": "2026-10-28T02:30:46.917218221Z",
"provider": "osv",
"references": [
"https://www.youtube.com/watch?v=Tfg1B8u1yvE",
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/27xxx/CVE-2024-27304.json",
"https://github.com/jackc/pgproto3/security/advisories/GHSA-7jwh-3vrq-q3m8",
"https://github.com/jackc/pgx/security/advisories/GHSA-mrww-27vc-gghv",
"https://nvd.nist.gov/vuln/detail/CVE-2024-27304",
"https://github.com/jackc/pgproto3/commit/945c2126f6db8f3bea7eeebe307c01fe92bca007",
"https://github.com/jackc/pgx/commit/adbb38f298c76e283ffc7c7a3f571036fea47fd4",
"https://github.com/jackc/pgx/commit/c543134753a0c5d22881c12404025724cb05ffd8",
"https://github.com/jackc/pgx/commit/f94eb0e2f96782042c96801b5ac448f44f0a81df"
],
"provider_metadata": {
"cwe_ids": [
"CWE-190",
"CWE-89"
],
"cna_assigner": "GitHub_M",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/27xxx/CVE-2024-27304.json"
}
},
"related_cves": [
{
"value": "CVE-2024-27304",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 515036,
"published_at": "2024-03-06T19:07:08.491+00:00"
}