7.3high
Use after free in Rocket
- Severity
- 7.3high CVSS:3.1 by NVD
- Exploit likelihood
- 1.03% (higher than 64% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- mitre
- Also known as
- GHSA-vcw4-8ph6-7vw8RUSTSEC-2021-0044
Description
An issue was discovered in the rocket crate before 0.4.7 for Rust. uri::Formatter can have a use-after-free if a user-provided function panics.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Unspecified product | n/a | CVE List |
| rocket (crates.io) | before 0.4.7, from 0.0.0-0 before 0.4.7 | GitHub Advisory Database, RustSec Advisory Database |
| rocket rocket | before 0.4.7 | NVD |
All scores
| GitHub | 7.3high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L |
| RustSec Advisory Database | 7.3high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L |
| NVD | 7.3high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L |
| NVD | 7.5high CVSS:2.0 | AV:N/AC:L/Au:N/C:P/I:P/A:P |
Classification
What each source says
CVE List
An issue was discovered in the rocket crate before 0.4.7 for Rust. uri::Formatter can have a use-after-free if a user-provided function panics.
GitHub Advisory Database
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.
RustSec Advisory Database
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.
NVD (es)
Se detectó un problema en la crate rocket versiones anteriores a 0.4.7 para Rust. La función uri::Formatter puede presentar un uso de la memoria previamente liberada si una función proporcionada por el usuario entra en pánico.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-29935 changed 2024-08-03 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-vcw4-8ph6-7vw8 changed 2023-11-08 | CC-BY-4.0 |
| RustSec Advisory Database | RUSTSEC-2021-0044 changed 2023-11-08 | CC0-1.0 |
| NVD | CVE-2021-29935 changed 2026-06-17 | Public domain |