🔍 CVE-2024-32655

8.1
CVSS Score
HIGH
2024-05-14
2026-06-17 07:30
✅ 완료

🇰🇷 한글 설명

Npgsql의 WriteBind() 메서드에서 매개변수 길이 합이 int 범위를 초과할 때 정수 오버플로우가 발생하여 메시지 크기가 잘못 계산됩니다. 데이터베이스가 작은 바이트만 읽고 나머지를 새로운 메시지로 해석하게 되어, 공격자가 임의의 PostgreSQL 프로토콜 메시지를 주입하여 SQL 명령을 실행할 수 있습니다.

💡 쉬운 설명

Npgsql이 데이터베이스로 보내는 메시지 크기를 잘못 계산하면서, 공격자가 추가 SQL 명령을 몰래 삽입할 수 있게 됩니다. 이를 통해 권한 없이 데이터베이스를 조작할 수 있습니다.

🇺🇸 원문 (English)

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.

📍 영향받는 시스템

Npgsql 4.0.x (14 미만), 4.1.x (13 미만), 5.0.x (18 미만), 6.0.x (11 미만), 7.0.x (7 미만), 8.0.x (3 미만)

⚔️ 공격 벡터

큰 바이너리 매개변수를 포함한 쿼리를 PostgreSQL 연결로 전송하여 메시지 오버플로우 유발 후 프로토콜 메시지 주입

🛡️ 대응 방법

Npgsql을 4.0.14, 4.1.13, 5.0.18, 6.0.11, 7.0.7, 8.0.3 이상으로 업그레이드

🔧 검증 코드

프로젝트 파일에서 현재 설치된 Npgsql 버전을 확인하여 영향받는 버전(위 버전보다 낮은 경우) 여부 판단

Shell / Script
find . -name '*.csproj' -o -name 'project.assets.json' 2>/dev/null | xargs grep -i npgsql 2>/dev/null | grep -i version | head -1

📊 CVSS Vector String

CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H

💻 영향받는 소프트웨어

PostgreSQL