ferris-says has undefined behavior when not using UTF-8GHSA-v363-rrf2-5fmj
Fix: rust-lang/ferris-says#21GHSA-v363-rrf2-5fmj is a security vulnerability in ferris-says. A fix is available for ferris-says — see the affected versions and patch details below.
Real-World Exposure
ferris-says🦀ferris-saysReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects crates.io packages — download data is not available via public APIs for these ecosystems.
Description
Affected versions receive a &[u8] from the caller through a safe API, and pass it directly to the unsafe str::from_utf8_unchecked function.
The behavior of ferris_says::say is undefined if the bytes from the caller don't happen to be valid UTF-8.
The flaw was corrected in ferris-says#21 by using the safe str::from_utf8 instead, and returning an error on invalid input. However this fix has not yet been published to crates.io as a patch version for 0.2.
Separately, ferris-says#32 has introduced a different API for version 0.3 which accepts input as &str rather than &[u8], so is unaffected by this bug.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🦀crates.io | ferris-says | ≥ 0.1.2 | No fix |
| 🦀crates.io | ferris-says | ≥ 0.3.0&&< 0.3.1 | 0.3.1cargo update -p ferris-says --precise 0.3.1 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for ferris-says, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
A fix is available for GHSA-v363-rrf2-5fmj; check the affected-versions list above or the advisory for the patched release of ferris-says, then make sure no transitive dependency still pins the vulnerable range.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
Frequently Asked Questions
Is GHSA-v363-rrf2-5fmj in your dependencies?
Find it across crates.io, including transitive dependencies.