Advisory

GHSA-vcw4-8ph6-7vw8

Also known as: CVE-2021-29935, RUSTSEC-2021-0044

Summary

Use after free in Rocket

Details

Affected versions of this crate transmuted a &str to a &'static str before pushing it into a StackVec, this value was then popped later in the same function.

This was assumed to be safe because the reference would be valid while the method's stack was active. In between the push and the pop, however, a function f was called that could invoke a user provided function.

If the user provided panicked, then the assumption used by the function was no longer true and the transmute to &'static would create an illegal static reference to the string. This could result in a freed string being used during (such as in a Drop implementation) or after (e.g through catch_unwind) the panic unwinding.

This flaw was corrected in commit e325e2f by using a guard object to ensure that the &'static str was dropped inside the function.

Severity

High Basis: The source's own band: HIGH

Dates

Published
2021-08-25 20:54 UTC
Modified
2023-11-08 04:05 UTC

Affected packages and fixes

rocket

crates.io · All systems

Affected

  • introduced 0, fixed 0.4.7 (semver)

Fixed versions

0.4.7

Fix

  • Fixed version 0.4.7
    cargo update -p rocket --precise 0.4.7

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences