Binary Protocol Misinterpretation caused by Truncating or Overflowing Casts Affecting sqlx package, versions <0.8.1


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team

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-RUST-SQLX-7707749
  • published 18 Aug 2024
  • disclosed 15 Aug 2024
  • credit Unknown

Introduced: 15 Aug 2024

CVE NOT AVAILABLE CWE-192 Open this link in a new tab

How to fix?

Upgrade sqlx to version 0.8.1 or higher.

Overview

Affected versions of this package are vulnerable to Binary Protocol Misinterpretation caused by Truncating or Overflowing Casts due to the improper handling of encoding values larger than 4GiB, which can cause the length prefix in the protocol to overflow. An attacker can manipulate the server into interpreting the rest of the string as binary protocol commands or other data by sending specially crafted input that exceeds this size limit.

Mititgation

This vulnerability can be mitigated by rejecting any input over 4 GiB, or any input that could encode to a string longer than 4 GiB. Also, Encode::size_hint() can be used for sanity checks, but implementing middleware to limit the size of request bodies is recommended.

CVSS Scores

version 3.1
Expand this section

Snyk

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