PT-2024-3776 · Npgsql · Npgsql

Paul-Gerste-Sonarsource

·

Published

2024-05-09

·

Updated

2024-12-12

·

CVE-2024-32655

CVSS v3.1

8.1

High

VectorAV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
Name of the Vulnerable Software and Affected Versions Npgsql versions prior to 4.0.14 Npgsql versions prior to 4.1.13 Npgsql versions prior to 5.0.18 Npgsql versions prior to 6.0.11 Npgsql versions prior to 7.0.7 Npgsql versions prior to 8.0.3
Description 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.
Recommendations For versions prior to 4.0.14, update to version 4.0.14 or later. For versions prior to 4.1.13, update to version 4.1.13 or later. For versions prior to 5.0.18, update to version 5.0.18 or later. For versions prior to 6.0.11, update to version 6.0.11 or later. For versions prior to 7.0.7, update to version 7.0.7 or later. For versions prior to 8.0.3, update to version 8.0.3 or later. As a temporary workaround, consider restricting access to the WriteBind() method until a patch is available.

Exploit

Fix

Integer Overflow

SQL injection

RCE

Weakness Enumeration

Related Identifiers

BDU:2024-04128
CVE-2024-32655
GHSA-X9VC-6HFV-HG8C

Affected Products

Npgsql