Npgsql Vulnerable to SQL Injection via Protocol Message Size Overflow
Npgsql is the .NET data provider for PostgreSQL. The `WriteBind()` method in `src/Npgsql/Internal/NpgsqlConnector.FrontendMessages.cs` uses `int` variables to store the message length and the sum of parameter lengths. Both variables overflow when the sum of parameter lengths becomes too large. This causes Npgsql to write a message size that is too small when constructing a Postgres protocol message to send it over the network to the database. When parsing the message, the database will only read a small number of bytes and treat any following bytes as new messages while they belong to the old message. Attackers can abuse this to inject arbitrary Postgres protocol messages into the connection, leading to the execution of arbitrary SQL statements on the application's behalf. This vulnerability is fixed in 4.0.14, 4.1.13, 5.0.18, 6.0.11, 7.0.7, and 8.0.3.
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2024-32655
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 5 Nov 2026, 01:21 UTC · Revision 1
Source evidence
Npgsql Vulnerable to SQL Injection via Protocol Message Size Overflow
core-osv · Original sourcePublished 9 May 2024, 14:29 UTC
Npgsql is the .NET data provider for PostgreSQL. The `WriteBind()` method in `src/Npgsql/Internal/NpgsqlConnector.FrontendMessages.cs` uses `int` variables to store the message length and the sum of parameter lengths. Both variables overflow when the sum of parameter lengths becomes too large. This causes Npgsql to write a message size that is too small when constructing a Postgres protocol message to send it over the network to the database. When parsing the message, the database will only read a small number of bytes and treat any following bytes as new messages while they belong to the old message. Attackers can abuse this to inject arbitrary Postgres protocol messages into the connection, leading to the execution of arbitrary SQL statements on the application's behalf. This vulnerability is fixed in 4.0.14, 4.1.13, 5.0.18, 6.0.11, 7.0.7, and 8.0.3.
osv:CVE-2024-32655
Complete source record
{
"id": "ef2f58d4759c85bfe1690c1ca63c37c825e9c5847f07cdc75fcedd4200f74e14",
"url": "https://osv.dev/vulnerability/CVE-2024-32655",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "Npgsql Vulnerable to SQL Injection via Protocol Message Size Overflow",
"summary": "Npgsql is the .NET data provider for PostgreSQL. The `WriteBind()` method in `src/Npgsql/Internal/NpgsqlConnector.FrontendMessages.cs` uses `int` variables to store the message length and the sum of parameter lengths. Both variables overflow when the sum of parameter lengths becomes too large. This causes Npgsql to write a message size that is too small when constructing a Postgres protocol message to send it over the network to the database. When parsing the message, the database will only read a small number of bytes and treat any following bytes as new messages while they belong to the old message. Attackers can abuse this to inject arbitrary Postgres protocol messages into the connection, leading to the execution of arbitrary SQL statements on the application's behalf. This vulnerability is fixed in 4.0.14, 4.1.13, 5.0.18, 6.0.11, 7.0.7, and 8.0.3.",
"evidence": "osv:CVE-2024-32655",
"products": [],
"severity": "high",
"structured": {
"id": "CVE-2024-32655",
"aliases": [
"CVE-2024-32655",
"GHSA-x9vc-6hfv-hg8c"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/npgsql/npgsql",
"type": "GIT",
"events": [
{
"introduced": "640341e3689ea8c698933c301031a7970e783b8a"
},
{
"fixed": "e34e2ba8042e666d9af54a1b255fba4d5b11df56"
},
{
"introduced": "623a0898193fb01e7ad64f4ed2770ac3b317ce27"
},
{
"fixed": "db69b1c964e532d30a18ec5e11d8a4491f4be661"
},
{
"introduced": "ef1ad7a5d94b8a10d20ae9ddaf7b834de0d4baba"
},
{
"fixed": "6342a44414e1c861bebb173796e1c1ebf5713d1a"
},
{
"introduced": "655a0191b986404928db466f512bac5d4c6afd3a"
},
{
"fixed": "3419c993b672e1bdf1f1e1730d2bc306ca6cc066"
},
{
"introduced": "f844598e07e0b68174dae88a51071ab89a867d3c"
},
{
"fixed": "8882a3983a3552c92ba9ba1ca171a664bba53b60"
},
{
"introduced": "507e2d9760dff4090ab71326a7d8b9ae721db553"
},
{
"fixed": "c5aab163a27a328af4cdb2e2285c7dcc46b2d1d8"
},
{
"fixed": "091655eed0c84e502ab424950c930339d17c1928"
},
{
"fixed": "3183efb2bdcca159c8c2e22af57e18ea8f853cf0"
},
{
"fixed": "67acbe027e28477ac2199e15cfb554bb2ffaf169"
},
{
"fixed": "703d9af8fa48dfe8c0180e36edb8278f34342d7b"
},
{
"fixed": "a22a42d8141d7a3528f43c02c095a409507cf1af"
},
{
"fixed": "f7e7ead0702d776a8f551f5786c4cac2d65c4bc6"
}
],
"database_specific": {
"extracted_events": [
{
"range": [
{
"introduced": "4.0.0"
},
{
"fixed": "4.0.14"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StringRangeExpression"
},
{
"range": [
{
"introduced": "4.1.0"
},
{
"fixed": "4.1.13"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StringRangeExpression"
},
{
"range": [
{
"introduced": "5.0.0"
},
{
"fixed": "5.0.18"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StringRangeExpression"
},
{
"range": [
{
"introduced": "6.0.0"
},
{
"fixed": "6.0.11"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StringRangeExpression"
},
{
"range": [
{
"introduced": "7.0.0"
},
{
"fixed": "7.0.7"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StringRangeExpression"
},
{
"range": [
{
"introduced": "8.0.0"
},
{
"fixed": "8.0.3"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StringRangeExpression"
},
{
"range": [
{
"fixed": "091655eed0c84e502ab424950c930339d17c1928"
}
],
"source": "REFERENCES_COMMIT"
},
{
"range": [
{
"fixed": "3183efb2bdcca159c8c2e22af57e18ea8f853cf0"
}
],
"source": "REFERENCES_COMMIT"
},
{
"range": [
{
"fixed": "67acbe027e28477ac2199e15cfb554bb2ffaf169"
}
],
"source": "REFERENCES_COMMIT"
},
{
"range": [
{
"fixed": "703d9af8fa48dfe8c0180e36edb8278f34342d7b"
}
],
"source": "REFERENCES_COMMIT"
},
{
"range": [
{
"fixed": "a22a42d8141d7a3528f43c02c095a409507cf1af"
}
],
"source": "REFERENCES_COMMIT"
},
{
"range": [
{
"fixed": "e34e2ba8042e666d9af54a1b255fba4d5b11df56"
}
],
"source": "REFERENCES_COMMIT"
},
{
"range": [
{
"fixed": "f7e7ead0702d776a8f551f5786c4cac2d65c4bc6"
}
],
"source": "REFERENCES_COMMIT"
},
{
"range": [
{
"fixed": "e34e2ba8042e666d9af54a1b255fba4d5b11df56"
}
],
"source": "REFERENCES_TAG",
"original_tag": "v4.0.14"
},
{
"range": [
{
"fixed": "db69b1c964e532d30a18ec5e11d8a4491f4be661"
}
],
"source": "REFERENCES_TAG",
"original_tag": "v4.1.13"
},
{
"range": [
{
"fixed": "6342a44414e1c861bebb173796e1c1ebf5713d1a"
}
],
"source": "REFERENCES_TAG",
"original_tag": "v5.0.18"
},
{
"range": [
{
"fixed": "3419c993b672e1bdf1f1e1730d2bc306ca6cc066"
}
],
"source": "REFERENCES_TAG",
"original_tag": "v6.0.11"
},
{
"range": [
{
"fixed": "8882a3983a3552c92ba9ba1ca171a664bba53b60"
}
],
"source": "REFERENCES_TAG",
"original_tag": "v7.0.7"
},
{
"range": [
{
"fixed": "c5aab163a27a328af4cdb2e2285c7dcc46b2d1d8"
}
],
"source": "REFERENCES_TAG",
"original_tag": "v8.0.3"
}
]
}
}
],
"versions": [
"v4.0.13",
"v5.0.17",
"v8.0.2",
"v8.0.1",
"v8.0.0",
"v6.0.10",
"v7.0.6",
"v7.0.4",
"v6.0.9",
"v7.0.2",
"v6.0.8",
"v7.0.1",
"v7.0.0",
"v5.0.15",
"v6.0.7",
"v5.0.14",
"v6.0.6",
"v4.1.12",
"v4.1.11",
"v4.1.10",
"v6.0.5",
"v5.0.13",
"v6.0.4",
"v5.0.12",
"v6.0.3",
"v6.0.2",
"v6.0.1",
"v5.0.11",
"v6.0.0",
"v5.0.10",
"v4.0.12",
"v5.0.7",
"v5.0.5",
"v4.0.11",
"v4.1.9",
"v5.0.2",
"v4.1.8",
"v5.0.0",
"v4.1.7",
"v4.1.6",
"v4.1.5",
"v4.1.4",
"v4.1.3.1",
"v4.1.3",
"v4.1.2",
"v4.1.1",
"v4.0.10",
"v4.0.8",
"v4.0.9",
"v4.0.7",
"v4.0.6",
"v4.0.5",
"v4.0.4.1",
"v4.0.4",
"v4.0.2",
"v4.0.1",
"v4.0.0"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2024-32655.json"
}
}
],
"modified": "2026-10-28T02:30:41.588616831Z",
"provider": "osv",
"references": [
"https://github.com/npgsql/npgsql/releases/tag/v4.0.14",
"https://github.com/npgsql/npgsql/releases/tag/v4.1.13",
"https://github.com/npgsql/npgsql/releases/tag/v5.0.18",
"https://github.com/npgsql/npgsql/releases/tag/v6.0.11",
"https://github.com/npgsql/npgsql/releases/tag/v7.0.7",
"https://github.com/npgsql/npgsql/releases/tag/v8.0.3",
"https://www.youtube.com/watch?v=Tfg1B8u1yvE",
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/32xxx/CVE-2024-32655.json",
"https://github.com/npgsql/npgsql/security/advisories/GHSA-x9vc-6hfv-hg8c",
"https://nvd.nist.gov/vuln/detail/CVE-2024-32655",
"https://github.com/npgsql/npgsql/commit/091655eed0c84e502ab424950c930339d17c1928",
"https://github.com/npgsql/npgsql/commit/3183efb2bdcca159c8c2e22af57e18ea8f853cf0",
"https://github.com/npgsql/npgsql/commit/67acbe027e28477ac2199e15cfb554bb2ffaf169",
"https://github.com/npgsql/npgsql/commit/703d9af8fa48dfe8c0180e36edb8278f34342d7b",
"https://github.com/npgsql/npgsql/commit/a22a42d8141d7a3528f43c02c095a409507cf1af",
"https://github.com/npgsql/npgsql/commit/e34e2ba8042e666d9af54a1b255fba4d5b11df56",
"https://github.com/npgsql/npgsql/commit/f7e7ead0702d776a8f551f5786c4cac2d65c4bc6"
],
"provider_metadata": {
"cwe_ids": [
"CWE-190",
"CWE-89"
],
"cna_assigner": "GitHub_M",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/32xxx/CVE-2024-32655.json"
}
},
"related_cves": [
{
"value": "CVE-2024-32655",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 508962,
"published_at": "2024-05-09T14:29:14.067+00:00"
}