Use After Free Affecting rocket package, versions <0.4.7


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.13% (49th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Use After Free vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-RUST-ROCKET-1089468
  • published29 Mar 2021
  • disclosed9 Feb 2021
  • creditUnknown

Introduced: 9 Feb 2021

CVE-2021-29935  (opens in a new tab)
CWE-416  (opens in a new tab)

How to fix?

Upgrade rocket to version 0.4.7 or higher.

Overview

rocket is a web framework for Rust.

Affected versions of this package are vulnerable to Use After Free. 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.

CVSS Scores

version 3.1