SQL Injection Affecting npgsql package, versions [,4.0.14) [4.1.0,4.1.13) [5.0.0,5.0.18) [6.0.0-preview2,6.0.11) [7.0.0-preview.1,7.0.7) [8.0.0-preview.1,8.0.3)


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    Exploit Maturity
    Proof of concept
    EPSS
    0.05% (19th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-DOTNET-NPGSQL-6825563
  • published 9 May 2024
  • disclosed 9 May 2024
  • credit Paul Gerste

How to fix?

Upgrade Npgsql to version 4.0.14, 4.1.13, 5.0.18, 6.0.11, 7.0.7, 8.0.3 or higher.

Overview

Npgsql is a .NET data provider for PostgreSQL.

Affected versions of this package are vulnerable to SQL Injection by overflowing the sum of the integer and parameter lengths in NpgsqlConnector.FrontendMessages.cs, allowing arbitrary SQL to be injected into a PostgreSQL protocol message if enough of the relevant parameters can be controlled by the attacker.

PoC

"\x51\x00\x00\x00\x11" + "DROP TABLE users;" + "A" * 0xffffffee

CVSS Scores

version 3.1
Expand this section

Snyk

Recommended
8.1 high
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    High
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    None
  • Scope (S)
    Unchanged
  • Confidentiality (C)
    High
  • Integrity (I)
    High
  • Availability (A)
    High