
Cloud Vulnerability DB
A community-led vulnerabilities database
CVE-2021-28875 affects the standard library in Rust versions before 1.50.0. The vulnerability is related to the read_to_end() function not validating the return value from Read in an unsafe context (NVD, CVE). The issue was discovered in January 2021 and had been present since Rust 1.20, approximately 2.5 years prior to discovery (Rust Issue).
The vulnerability exists in the read_to_end_with_reservation() function where a malicious Read implementation could return overly large values from read(), which would result in the guard's drop implementation setting the buffer's length to greater than its capacity. This could lead to a buffer overflow condition. The vulnerability has a CVSS v3.1 Base Score of 7.5 HIGH (Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H) (NVD).
The vulnerability could lead to a buffer overflow condition, which could potentially result in memory corruption and program crashes. In particular, this could affect the read_to_string() function if the shortened buffer doesn't end on a UTF-8 boundary (Rust PR).
The vulnerability can be triggered through a malicious implementation of the Read trait that returns values larger than the provided buffer size. A proof-of-concept exists that demonstrates the bug causing a segmentation fault with double free or corruption (Rust Issue).
The issue was fixed in Rust 1.50.0 by adding validation to ensure that the returned length is not larger than the buffer passed to the method. Users should upgrade to Rust version 1.50.0 or later to receive the fix (Rust PR).
Source: This report was generated using AI
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."