Vulnerability HighRUSTSEC-2024-0020 · whoami
RUSTSEC-2024-0020: Stack buffer overflow with whoami on several Unix platforms
Short answerA security vulnerability in the whoami crate: Stack buffer overflow with whoami on several Unix platforms. GitHub rates it High. Fixed in 1.5.0: update to a fixed version.
| Crate | whoami |
|---|---|
| Type | Vulnerability (denial-of-service, memory-corruption) |
| Affected versions | From 0.5.3 before 1.5.0. |
| Fixed in | 1.5.0 |
| Severity | High (GitHub rating) |
| Published | 2024-02-28 |
| Last changed | 2024-04-11 |
| Also known as | GHSA-w5w5-8vfh-xcjq |
| Affected functions | whoami::realname, whoami::realname_os, whoami::username, whoami::username_os |
What to do
- See which version you have:
cargo tree -i whoami(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p whoami. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for examplewhoami = "1.5.0") or update the dependency that pulls it in. - Check again with
cargo audit, or paste your Cargo.lock into our Cargo.toml checker.
Details from the advisory
With versions of the whoami crate >= 0.5.3 and < 1.5.0, calling any of these functions leads to an immediate stack buffer overflow on illumos and Solaris:
whoami::usernamewhoami::realnamewhoami::username_oswhoami::realname_os
With versions of the whoami crate >= 0.5.3 and < 1.0.1, calling any of the above functions also leads to a stack buffer overflow on these platforms:
- Bitrig
- DragonFlyBSD
- FreeBSD
- NetBSD
- OpenBSD
This occurs because of an incorrect definition of the passwd struct on those platforms.
As a result of this issue, denial of service and data corruption have both been observed in the wild. The issue is possibly exploitable as well.
This vulnerability also affects other Unix platforms that aren't Linux or macOS.
This issue has been addressed in whoami 1.5.0.
For more information, see this GitHub issue.
References
- Package: crates.io/crates/whoami
- Advisory: rustsec.org/advisories/RUSTSEC-2024-0020.html
- Report: github.com/ardaku/whoami/issues/91
From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.
Up next
Same cratewhoami: security historyEvery advisory for this crate, and whether it is safe to use today.Read it next →Did this answer your question?