rustsec-2024-0404
Vulnerability from osv_rustsec
Published
2024-09-08 12:00
Modified
2025-10-28 06:02
Summary
Unsoundness in anstream
Details
When given a valid UTF8 string "ö\x1b😀", the function in crates/anstream/src/adapter/strip.rs will be confused. The UTF8 bytes are \xc3\xb6 then \x1b then \xf0\x9f\x98\x80.
When looping over "non-printable bytes" \x1b\xf0 will be considered as some non-printable sequence.
This will produce a broken str from the incorrectly segmented bytes via str::from_utf8_unchecked, and that should never happen.
Full credit goes to @Ralith who reviewed this code and asked @burakemir to follow up.
{
"affected": [
{
"database_specific": {
"categories": [],
"cvss": null,
"informational": "unsound"
},
"ecosystem_specific": {
"affected_functions": null,
"affects": {
"arch": [],
"functions": [
"anstream::adapter::strip_str"
],
"os": []
}
},
"package": {
"ecosystem": "crates.io",
"name": "anstream",
"purl": "pkg:cargo/anstream"
},
"ranges": [
{
"events": [
{
"introduced": "0.0.0-0"
},
{
"fixed": "0.6.8"
}
],
"type": "SEMVER"
}
],
"versions": []
}
],
"aliases": [
"GHSA-2rxc-gjrp-vjhx"
],
"database_specific": {
"license": "CC0-1.0"
},
"details": "When given a valid UTF8 string \"\u00f6\\x1b\ud83d\ude00\", the function in\ncrates/anstream/src/adapter/strip.rs will be confused. The UTF8\nbytes are \\xc3\\xb6 then \\x1b then \\xf0\\x9f\\x98\\x80.\n\nWhen looping over \"non-printable bytes\" \\x1b\\xf0 will be\nconsidered as some non-printable sequence.\n\nThis will produce a broken str from the incorrectly segmented\nbytes via str::from_utf8_unchecked, and that should never happen.\n\nFull credit goes to @Ralith who reviewed this code and\nasked @burakemir to follow up.",
"id": "RUSTSEC-2024-0404",
"modified": "2025-10-28T06:02:18Z",
"published": "2024-09-08T12:00:00Z",
"references": [
{
"type": "PACKAGE",
"url": "https://crates.io/crates/anstream"
},
{
"type": "ADVISORY",
"url": "https://rustsec.org/advisories/RUSTSEC-2024-0404.html"
},
{
"type": "REPORT",
"url": "https://github.com/rust-cli/anstyle/issues/156"
}
],
"related": [],
"severity": [],
"summary": "Unsoundness in anstream"
}
Loading…
Loading…
Sightings
| Author | Source | Type | Date |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Loading…
Loading…