Vulnerability CriticalRUSTSEC-2017-0004 · base64
RUSTSEC-2017-0004: Integer overflow leads to heap-based buffer overflow in encode_config_buf
Short answerA security vulnerability in the base64 crate: Integer overflow leads to heap-based buffer overflow in encode_config_buf. Critical severity (CVSS 9.8). Fixed in 0.5.2: update to a fixed version.
| Crate | base64 |
|---|---|
| Type | Vulnerability |
| Affected versions | Before 0.5.2. |
| Fixed in | 0.5.2 |
| Severity | Critical, CVSS 9.8 CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| Published | 2017-05-03 |
| Last changed | 2023-11-08 |
| Also known as | CVE-2017-1000430, GHSA-x67x-vg9m-65c3 |
What to do
- See which version you have:
cargo tree -i base64(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p base64. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for examplebase64 = "0.5.2") 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
Affected versions of this crate suffered from an integer overflow bug when calculating the size of a buffer to use when encoding base64 using the encode_config_buf and encode_config functions. If the input string was large, this would cause a buffer to be allocated that was too small. Since this function writes to the buffer using unsafe code, it would allow an attacker to write beyond the buffer, causing memory corruption and possibly the execution of arbitrary code.
This flaw was corrected by using checked arithmetic to calculate the size of the buffer.
References
- Package: crates.io/crates/base64
- Advisory: rustsec.org/advisories/RUSTSEC-2017-0004.html
- Web: github.com/alicemaz/rust-base64/commit/24ead980daf11ba563e4fb2516187a56a71ad319
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 cratebase64: security historyEvery advisory for this crate, and whether it is safe to use today.Read it next →Did this answer your question?