Vulnerabilities in pkg:nuget/Npgsql
PACKAGECVE-2024-32655 is a HIGH (CVSS 8.1) sql injection vulnerability (CWE-190: Integer Overflow or Wraparound) affecting Npgsql libraries in the NuGet ecosystem. The issue involves npgsql vulnerable to sql injection via protocol message size overflow. Remediation is available by upgrading affected packages to version 8.0.3, 4.0.14, 4.1.13, 5.0.18, 6.0.11, 7.0.7.
pkg:nuget/Npgsql
Vulnerability advisories affecting package pkg:nuget/Npgsql. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-x9vc-6hfv-hg8c | CVE-2024-32655 | HIGH | Npgsql vulnerable to SQL Injection via Protocol Message Size Overflow |
CVE-2024-32655 at a Glance
Security Impact
CVSS: 8.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2024-32655
To remediate this vulnerability, upgrade all affected Npgsql dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade Npgsql to 8.0.3
Upgrade Npgsql to 4.0.14
Upgrade Npgsql to 4.1.13
Upgrade Npgsql to 5.0.18
Upgrade Npgsql to 6.0.11
Upgrade Npgsql to 7.0.7
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for Npgsql
How to Check if You Are Affected
To determine whether your application is affected by CVE-2024-32655, inspect your project dependencies for Npgsql:
inspect dependencies for Npgsql
Analyze the terminal output to locate any version of Npgsql in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 8.0.3), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-190: Integer Overflow or Wraparound, where the product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. this occurs when an integer value is incremented to a value that is too large to store in the associated representation. when this occurs, the value may become a very small or negative number. In Npgsql, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-32655 Affected Npgsql Versions
6 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
Npgsql
|
NuGet |
≥ 8.0.0
< 8.0.3
|
8.0.3
|
|
Npgsql
|
NuGet |
< 4.0.14
|
4.0.14
|
|
Npgsql
|
NuGet |
≥ 4.1.0
< 4.1.13
|
4.1.13
|
|
Npgsql
|
NuGet |
≥ 5.0.0
< 5.0.18
|
5.0.18
|
|
Npgsql
|
NuGet |
≥ 6.0.0
< 6.0.11
|
6.0.11
|
|
Npgsql
|
NuGet |
≥ 7.0.0
< 7.0.7
|
7.0.7
|
References
Frequently Asked Questions
What is CVE-2024-32655?
Which Npgsql versions are affected?
What version fixes CVE-2024-32655?
Is Npgsql affected?
What is the CVSS score of CVE-2024-32655?
What CWE is associated with CVE-2024-32655?
How can I check NuGet dependencies for CVE-2024-32655?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-x9vc-6hfv-hg8c",
"modified" : "2024-12-12T22:27:07Z",
"published" : "2024-05-09T15:12:49Z",
"aliases" : [ "CVE-2024-32655" ],
"summary" : "Npgsql vulnerable to SQL Injection via Protocol Message Size Overflow",
"details" : "### Summary\nThe `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.\n\nThis 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.\n\nAttackers 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.\n\n### Impact\nAttackers can issue arbitrary SQL statements to the database on behalf of the application. The final impact depends on the application that uses Npgsql, the data it stores in Postgres, etc.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "NuGet",
"name" : "Npgsql"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "8.0.0"
}, {
"fixed" : "8.0.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "NuGet",
"name" : "Npgsql"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.0.14"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 4.0.13"
}
}, {
"package" : {
"ecosystem" : "NuGet",
"name" : "Npgsql"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.1.0"
}, {
"fixed" : "4.1.13"
} ]
} ]
}, {
"package" : {
"ecosystem" : "NuGet",
"name" : "Npgsql"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "5.0.0"
}, {
"fixed" : "5.0.18"
} ]
} ]
}, {
"package" : {
"ecosystem" : "NuGet",
"name" : "Npgsql"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "6.0.0"
}, {
"fixed" : "6.0.11"
} ]
} ]
}, {
"package" : {
"ecosystem" : "NuGet",
"name" : "Npgsql"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "7.0.0"
}, {
"fixed" : "7.0.7"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/npgsql/npgsql/security/advisories/GHSA-x9vc-6hfv-hg8c"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-32655"
}, {
"type" : "WEB",
"url" : "https://github.com/npgsql/npgsql/commit/091655eed0c84e502ab424950c930339d17c1928"
}, {
"type" : "WEB",
"url" : "https://github.com/npgsql/npgsql/commit/3183efb2bdcca159c8c2e22af57e18ea8f853cf0"
}, {
"type" : "WEB",
"url" : "https://github.com/npgsql/npgsql/commit/67acbe027e28477ac2199e15cfb554bb2ffaf169"
}, {
"type" : "WEB",
"url" : "https://github.com/npgsql/npgsql/commit/703d9af8fa48dfe8c0180e36edb8278f34342d7b"
}, {
"type" : "WEB",
"url" : "https://github.com/npgsql/npgsql/commit/a22a42d8141d7a3528f43c02c095a409507cf1af"
}, {
"type" : "WEB",
"url" : "https://github.com/npgsql/npgsql/commit/e34e2ba8042e666d9af54a1b255fba4d5b11df56"
}, {
"type" : "WEB",
"url" : "https://github.com/npgsql/npgsql/commit/f7e7ead0702d776a8f551f5786c4cac2d65c4bc6"
}, {
"type" : "WEB",
"url" : "https://www.youtube.com/watch?v=Tfg1B8u1yvE"
}, {
"type" : "WEB",
"url" : "https://github.com/npgsql/npgsql/releases/tag/v8.0.3"
}, {
"type" : "WEB",
"url" : "https://github.com/npgsql/npgsql/releases/tag/v7.0.7"
}, {
"type" : "WEB",
"url" : "https://github.com/npgsql/npgsql/releases/tag/v6.0.11"
}, {
"type" : "WEB",
"url" : "https://github.com/npgsql/npgsql/releases/tag/v5.0.18"
}, {
"type" : "WEB",
"url" : "https://github.com/npgsql/npgsql/releases/tag/v4.1.13"
}, {
"type" : "WEB",
"url" : "https://github.com/npgsql/npgsql/releases/tag/v4.0.14"
}, {
"type" : "WEB",
"url" : "https://github.com/npgsql/npgsql/files/14309397/npgsql-protocol-overflow-poc.zip"
}, {
"type" : "WEB",
"url" : "https://github.com/npgsql/npgsql/files/14309386/Npgsql.Security.Advisory.pdf"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/npgsql/npgsql"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-190", "CWE-89" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-05-09T15:12:49Z",
"nvd_published_at" : "2024-05-14T15:36:51Z"
}
}