CVE-2020-35861
JSON

7.5high

Out of bounds read in bumpalo

Severity
7.5high CVSS:3.1 by NVD
Exploit likelihood
1.51% (higher than 75% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
mitre
Also known as
GHSA-vqx7-pw4r-29rrRUSTSEC-2020-0006

Description

An issue was discovered in the bumpalo crate before 3.2.1 for Rust. The realloc feature allows the reading of unknown memory. Attackers can potentially read cryptographic keys.

Affected

Product or packageVersionsReported by
Unspecified productn/aCVE List
bumpalo (crates.io)from 3.0.0 before 3.2.1GitHub Advisory Database, RustSec Advisory Database
bumpalo_project bumpalofrom 3.0.0 before 3.2.1NVD

All scores

GitHub7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
RustSec Advisory Database7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
NVD7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
NVD5.0medium CVSS:2.0AV:N/AC:L/Au:N/C:P/I:N/A:N

Classification

What each source says

CVE List

An issue was discovered in the bumpalo crate before 3.2.1 for Rust. The realloc feature allows the reading of unknown memory. Attackers can potentially read cryptographic keys.

RustSec Advisory Database

When reallocing, if we allocate new space, we need to copy the old allocation's bytes into the new space. There are old_size number of bytes in the old allocation, but we were accidentally copying new_size number of bytes, which could lead to copying bytes into the realloc'd space from past the chunk that we're bump allocating out of, from unknown memory.

If an attacker can cause reallocs, and can read the realoced data back, this could allow them to read things from other regions of memory that they shouldn't be able to. For example, if some crypto keys happened to live in memory right after a chunk we were bump allocating out of, this could allow the attacker to read the crypto keys.

Beyond just fixing the bug and adding a regression test, I've also taken two additional steps:

  1. While we were already running the testsuite under valgrind in CI, because valgrind exits with the same code that the program did, if there are invalid reads/writes that happen not to trigger a segfault, the program can still exit OK and we will be none the wiser. I've enabled the --error-exitcode=1 flag for valgrind in CI so that tests eagerly fail in these scenarios.

  2. I've written a quickcheck test to exercise realloc. Without the bug fix in this patch, this quickcheck immediately triggers invalid reads when run under valgrind. We didn't previously have quickchecks that exercised realloc because realloc isn't publicly exposed directly, and instead can only be indirectly called. This new quickcheck test exercises realloc via bumpalo::collections::Vec::resize and bumpalo::collections::Vec::shrink_to_fit calls.

NVD (es)

Se detectó un problema en la crate bumpalo versiones anteriores a 3.2.1 para Rust. La funcionalidad realloc permite una lectura de memoria desconocida. Los atacantes pueden potencialmente leer claves criptográficas.

References

Sources

SourceRecordLicence
CVE ListCVE-2020-35861 changed 2024-08-04CVE Terms of Use
GitHub Advisory DatabaseGHSA-vqx7-pw4r-29rr changed 2023-11-08CC-BY-4.0
RustSec Advisory DatabaseRUSTSEC-2020-0006 changed 2023-11-08CC0-1.0
NVDCVE-2020-35861 changed 2026-06-17Public domain