Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
.NET NuGet

GHSA-x9vc-6hfv-hg8c

HIGH

Npgsql vulnerable to SQL Injection via Protocol Message Size Overflow

Also known asCVE-2024-32655
Published
May 9, 2024
Updated
Dec 12, 2024
Affected
6 pkgs
Patched
6 / 6
Exploits
None indexed

EPSS Exploitation Probability

via FIRST.org ↗
1.7%probability of exploitation in next 30 days
Lower Risk74th percentile-0.35%
1.09%1.58%2.08%2.57%2.1%1.7%Dec 25Apr 26Jun 26

EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.

Blast Radius

6 pkgs affected
.NETNpgsql.NETNpgsql.NETNpgsql.NETNpgsql.NETNpgsql.NETNpgsql

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects NuGet packages — download data is not available via public APIs for these ecosystems.

Description

Summary

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.

Impact

Attackers 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.

Affected Packages

6 total 6 fixed
EcosystemPackageVulnerable rangeFix
.NETNuGetNpgsql8.0.0&&< 8.0.38.0.3
.NETNuGetNpgsqlall versions4.0.14
.NETNuGetNpgsql4.1.0&&< 4.1.134.1.13
.NETNuGetNpgsql5.0.0&&< 5.0.185.0.18
.NETNuGetNpgsql6.0.0&&< 6.0.116.0.11
.NETNuGetNpgsql7.0.0&&< 7.0.77.0.7

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for Npgsql. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.

  2. Fix

    Update Npgsql to 8.0.3 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-x9vc-6hfv-hg8c is resolved across your whole dependency graph.

  3. Workarounds

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

  4. How O3 protects you

    O3 pinpoints whether GHSA-x9vc-6hfv-hg8c is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.

Tailored to GHSA-x9vc-6hfv-hg8c. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Frequently Asked Questions

### Summary 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 t
O3 Security · Impact-Aware SCA

Is GHSA-x9vc-6hfv-hg8c in your dependencies?

O3 detects GHSA-x9vc-6hfv-hg8c across NuGet dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.