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. Learn more

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 IDSNYK-RUST-SQLX-7707749
  • published18 Aug 2024
  • disclosed15 Aug 2024
  • creditUnknown

Introduced: 15 Aug 2024

CVE NOT AVAILABLE CWE-192  (opens 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