Every CVE Search/ Get API key

CVE-2021-31162

In the standard library in Rust before 1.53.0, a double free can occur in the Vec::from_iter...

9.8 CriticalFix available

In the standard library in Rust before 1.52.0, a double free can occur in the Vec::from_iter function if freeing the element panics.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
Low
Privileges needed
None
User interaction
None

What an attacker can affect

Confidentiality
High
Integrity
High
Availability
High

Exploit likelihood

2.89%Up 2.3 points since Apr 14, 2021
90%50%10%1%

What each source reports

NVD Score used 9.8

In the standard library in Rust before 1.52.0, a double free can occur in the Vec::from_iter function if freeing the element panics.

Record
CVE-2021-31162
CVSS 3.1
9.8 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS 2.0
7.5 HighAV:N/AC:L/Au:N/C:P/I:P/A:P
Weakness
CWE-415
Updated
2026-11-02
CVE List No score

In the standard library in Rust before 1.52.0, a double free can occur in the Vec::from_iter function if freeing the element panics.

Record
CVE-2021-31162
Updated
2026-11-02
EUVDEUVD-2021-18076 No score

In the standard library in Rust before 1.52.0, a double free can occur in the Vec::from_iter function if freeing the element panics.

Record
EUVD-2021-18076
Updated
2026-11-03
GitHub AdvisoriesGHSA-fjcw-72x2-rmmv 9.8

In the standard library in Rust before 1.53.0, a double free can occur in the Vec::from_iter...

In the standard library in Rust before 1.53.0, a double free can occur in the Vec::from_iter function if freeing the element panics.

Record
GHSA-fjcw-72x2-rmmv
CVSS 3.1
9.8 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Weakness
CWE-415
Updated
2026-11-02
OSVALPINE-CVE-2021-31162 9.8

In the standard library in Rust before 1.52.0, a double free can occur in the Vec::from_iter function if freeing the element panics.

Record
ALPINE-CVE-2021-31162
CVSS 3.1
9.8 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-03
OSVBELL-CVE-2021-31162 9.8

CVE-2021-31162 does not affect BellSoft software

Record
BELL-CVE-2021-31162
CVSS 3.1
9.8 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-02
Show 7 moreShow less
OSV 9.8

In the standard library in Rust before 1.52.0, a double free can occur in the Vec::from_iter function if freeing the element panics.

Record
CVE-2021-31162
CVSS 3.1
9.8 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVDEBIAN-CVE-2021-31162 9.8

In the standard library in Rust before 1.52.0, a double free can occur in the Vec::from_iter function if freeing the element panics.

Record
DEBIAN-CVE-2021-31162
CVSS 3.1
9.8 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVRHSA-2021:3042 9.8

Red Hat Security Advisory: rust-toolset-1.52 and rust-toolset-1.52-rust security and enhancement update

Record
RHSA-2021:3042
CVSS 3.1
9.8 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVRHSA-2021:3063 9.8

Red Hat Security Advisory: rust-toolset:rhel8 security, bug fix, and enhancement update

Record
RHSA-2021:3063
CVSS 3.1
9.8 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVRLSA-2021:3063 9.8

Moderate: rust-toolset:rhel8 security, bug fix, and enhancement update

Rust Toolset provides the Rust programming language compiler rustc, the cargo build tool and dependency manager, and required libraries.

The following packages have been upgraded to a later upstream version: rust (1.52.1). (BZ#1953002)

Security Fix(es):

  • rust: optimization for joining strings can cause uninitialized bytes to be exposed (CVE-2020-36323)

  • rust: heap-based buffer overflow in read_to_end() because it does not validate the return value from Read in an unsafe context (CVE-2021-28875)

  • rust: panic safety issue in Zip implementation (CVE-2021-28876)

  • rust: memory safety violation in Zip implementation for nested iter::Zips (CVE-2021-28877)

  • rust: memory safety violation in Zip implementation when next_back() and next() are used together (CVE-2021-28878)

  • rust: integer overflow in the Zip implementation can lead to a buffer overflow (CVE-2021-28879)

  • rust: double free in Vec::from_iter function if freeing the element panics (CVE-2021-31162)

For more details about the security issue(s), including the impact, a CVSS score, acknowledgments, and other related information, refer to the CVE page(s) listed in the References section.

For information on usage, see Using Rust Toolset linked in the References section.

Record
RLSA-2021:3063
CVSS 3.1
9.8 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVUBUNTU-CVE-2021-31162 9.8

In the standard library in Rust before 1.52.0, a double free can occur in the Vec::from_iter function if freeing the element panics.

Record
UBUNTU-CVE-2021-31162
CVSS 3.1
9.8 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVMGASA-2021-0251 No score

Updated rust packages fix security vulnerabilities

This Rust update to version 1.52.1 includes security fixes for CVE-2020-36323, CVE-2021-28876, CVE-2021-28878, CVE-2021-28879, and CVE-2021-31162. These are memory safety bugs in the Rust standard library. Because it is statically linked, affected applications will need to be rebuilt to benefit from the fixes. The actual security implications will depend on how these APIs are used in each particular case.

This update also provides new features and bugfixes included in Rust since the previously packaged version 1.49.0. See the referenced release notes for details.

The mozjs78 package is also updated from version 78.7.0 to 78.11.0 (ESR).

Record
MGASA-2021-0251
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
chromium-rust
Alpine:v3.24
before 1.51.0-r2
1.51.0-r2
rust
Alpine:v3.14
1.48.0 up to 1.51.0-r2
1.51.0-r2
rust
Alpine:v3.15
1.48.0 up to 1.51.0-r2
1.51.0-r2
rust
Alpine:v3.16
1.48.0 up to 1.51.0-r2
1.51.0-r2
rust
Alpine:v3.17
1.48.0 up to 1.51.0-r2
1.51.0-r2
rust
Alpine:v3.18
1.48.0 up to 1.51.0-r2
1.51.0-r2
rust
Alpine:v3.19
1.48.0 up to 1.51.0-r2
1.51.0-r2
rust
Alpine:v3.20
1.48.0 up to 1.51.0-r2
1.51.0-r2
rust
Alpine:v3.21
1.48.0 up to 1.51.0-r2
1.51.0-r2
rust
Alpine:v3.22
1.48.0 up to 1.51.0-r2
1.51.0-r2
Show 57 moreShow less
Affected packages
PackageAffectedFixed
rust
Alpine:v3.23
1.48.0 up to 1.51.0-r2
1.51.0-r2
rust
Alpine:v3.24
1.48.0 up to 1.51.0-r2
1.51.0-r2
rustc
Debian:12
before 1.53.0+dfsg1-1
1.53.0+dfsg1-1
rustc
Debian:13
before 1.53.0+dfsg1-1
1.53.0+dfsg1-1
rustc
Debian:14
before 1.53.0+dfsg1-1
1.53.0+dfsg1-1
rust
Mageia:8
From an advisory covering 5 CVEs
before 1.52.1-1.mga8
1.52.1-1.mga8
alacritty
Mageia:8
From an advisory covering 5 CVEs
before 0.7.1-1.1.mga8
0.7.1-1.1.mga8
cargo-c
Mageia:8
From an advisory covering 5 CVEs
before 0.7.0-1.1.mga8
0.7.0-1.1.mga8
dust
Mageia:8
From an advisory covering 5 CVEs
before 0.5.1-1.1.mga8
0.5.1-1.1.mga8
librsvg
Mageia:8
From an advisory covering 5 CVEs
before 2.50.3-1.1.mga8
2.50.3-1.1.mga8
mozjs68
Mageia:8
From an advisory covering 5 CVEs
before 68.11.0-1.1.mga8
68.11.0-1.1.mga8
mozjs78
Mageia:8
From an advisory covering 5 CVEs
before 78.11.0-1.mga8
78.11.0-1.mga8
neovim-gtk
Mageia:8
From an advisory covering 5 CVEs
before 0.2.0-0.git20190512.2.1.mga8
0.2.0-0.git20190512.2.1.mga8
ripgrep
Mageia:8
From an advisory covering 5 CVEs
before 12.1.1-1.1.mga8
12.1.1-1.1.mga8
rust-toolset-1.52
Red Hat:devtools:2021
From an advisory covering 7 CVEs
before 0:1.52.1-1.el7_9
0:1.52.1-1.el7_9
rust-toolset-1.52-build
Red Hat:devtools:2021
From an advisory covering 7 CVEs
before 0:1.52.1-1.el7_9
0:1.52.1-1.el7_9
rust-toolset-1.52-cargo
Red Hat:devtools:2021
From an advisory covering 7 CVEs
before 0:1.52.1-2.el7_9
0:1.52.1-2.el7_9
rust-toolset-1.52-cargo-doc
Red Hat:devtools:2021
From an advisory covering 7 CVEs
before 0:1.52.1-2.el7_9
0:1.52.1-2.el7_9
rust-toolset-1.52-clippy
Red Hat:devtools:2021
From an advisory covering 7 CVEs
before 0:1.52.1-2.el7_9
0:1.52.1-2.el7_9
rust-toolset-1.52-rls
Red Hat:devtools:2021
From an advisory covering 7 CVEs
before 0:1.52.1-2.el7_9
0:1.52.1-2.el7_9
rust-toolset-1.52-runtime
Red Hat:devtools:2021
From an advisory covering 7 CVEs
before 0:1.52.1-1.el7_9
0:1.52.1-1.el7_9
rust-toolset-1.52-rust
Red Hat:devtools:2021
From an advisory covering 7 CVEs
before 0:1.52.1-2.el7_9
0:1.52.1-2.el7_9
rust-toolset-1.52-rust-analysis
Red Hat:devtools:2021
From an advisory covering 7 CVEs
before 0:1.52.1-2.el7_9
0:1.52.1-2.el7_9
rust-toolset-1.52-rust-debugger-common
Red Hat:devtools:2021
From an advisory covering 7 CVEs
before 0:1.52.1-2.el7_9
0:1.52.1-2.el7_9
rust-toolset-1.52-rust-debuginfo
Red Hat:devtools:2021
From an advisory covering 7 CVEs
before 0:1.52.1-2.el7_9
0:1.52.1-2.el7_9
rust-toolset-1.52-rust-doc
Red Hat:devtools:2021
From an advisory covering 7 CVEs
before 0:1.52.1-2.el7_9
0:1.52.1-2.el7_9
rust-toolset-1.52-rust-gdb
Red Hat:devtools:2021
From an advisory covering 7 CVEs
before 0:1.52.1-2.el7_9
0:1.52.1-2.el7_9
rust-toolset-1.52-rust-lldb
Red Hat:devtools:2021
From an advisory covering 7 CVEs
before 0:1.52.1-2.el7_9
0:1.52.1-2.el7_9
rust-toolset-1.52-rust-src
Red Hat:devtools:2021
From an advisory covering 7 CVEs
before 0:1.52.1-2.el7_9
0:1.52.1-2.el7_9
rust-toolset-1.52-rust-std-static
Red Hat:devtools:2021
From an advisory covering 7 CVEs
before 0:1.52.1-2.el7_9
0:1.52.1-2.el7_9
rust-toolset-1.52-rustfmt
Red Hat:devtools:2021
From an advisory covering 7 CVEs
before 0:1.52.1-2.el7_9
0:1.52.1-2.el7_9
cargo
Red Hat:enterprise_linux:8::appstream
From an advisory covering 7 CVEs
before 0:1.52.1-1.module+el8.4.0+11282+0729bac9
0:1.52.1-1.module+el8.4.0+11282+0729bac9
cargo-debuginfo
Red Hat:enterprise_linux:8::appstream
From an advisory covering 7 CVEs
before 0:1.52.1-1.module+el8.4.0+11282+0729bac9
0:1.52.1-1.module+el8.4.0+11282+0729bac9
cargo-doc
Red Hat:enterprise_linux:8::appstream
From an advisory covering 7 CVEs
before 0:1.52.1-1.module+el8.4.0+11282+0729bac9
0:1.52.1-1.module+el8.4.0+11282+0729bac9
clippy
Red Hat:enterprise_linux:8::appstream
From an advisory covering 7 CVEs
before 0:1.52.1-1.module+el8.4.0+11282+0729bac9
0:1.52.1-1.module+el8.4.0+11282+0729bac9
clippy-debuginfo
Red Hat:enterprise_linux:8::appstream
From an advisory covering 7 CVEs
before 0:1.52.1-1.module+el8.4.0+11282+0729bac9
0:1.52.1-1.module+el8.4.0+11282+0729bac9
rls
Red Hat:enterprise_linux:8::appstream
From an advisory covering 7 CVEs
before 0:1.52.1-1.module+el8.4.0+11282+0729bac9
0:1.52.1-1.module+el8.4.0+11282+0729bac9
rls-debuginfo
Red Hat:enterprise_linux:8::appstream
From an advisory covering 7 CVEs
before 0:1.52.1-1.module+el8.4.0+11282+0729bac9
0:1.52.1-1.module+el8.4.0+11282+0729bac9
rust
Red Hat:enterprise_linux:8::appstream
From an advisory covering 7 CVEs
before 0:1.52.1-1.module+el8.4.0+11282+0729bac9
0:1.52.1-1.module+el8.4.0+11282+0729bac9
rust-analysis
Red Hat:enterprise_linux:8::appstream
From an advisory covering 7 CVEs
before 0:1.52.1-1.module+el8.4.0+11282+0729bac9
0:1.52.1-1.module+el8.4.0+11282+0729bac9
rust-debugger-common
Red Hat:enterprise_linux:8::appstream
From an advisory covering 7 CVEs
before 0:1.52.1-1.module+el8.4.0+11282+0729bac9
0:1.52.1-1.module+el8.4.0+11282+0729bac9
rust-debuginfo
Red Hat:enterprise_linux:8::appstream
From an advisory covering 7 CVEs
before 0:1.52.1-1.module+el8.4.0+11282+0729bac9
0:1.52.1-1.module+el8.4.0+11282+0729bac9
rust-debugsource
Red Hat:enterprise_linux:8::appstream
From an advisory covering 7 CVEs
before 0:1.52.1-1.module+el8.4.0+11282+0729bac9
0:1.52.1-1.module+el8.4.0+11282+0729bac9
rust-doc
Red Hat:enterprise_linux:8::appstream
From an advisory covering 7 CVEs
before 0:1.52.1-1.module+el8.4.0+11282+0729bac9
0:1.52.1-1.module+el8.4.0+11282+0729bac9
rust-gdb
Red Hat:enterprise_linux:8::appstream
From an advisory covering 7 CVEs
before 0:1.52.1-1.module+el8.4.0+11282+0729bac9
0:1.52.1-1.module+el8.4.0+11282+0729bac9
rust-lldb
Red Hat:enterprise_linux:8::appstream
From an advisory covering 7 CVEs
before 0:1.52.1-1.module+el8.4.0+11282+0729bac9
0:1.52.1-1.module+el8.4.0+11282+0729bac9
rust-src
Red Hat:enterprise_linux:8::appstream
From an advisory covering 7 CVEs
before 0:1.52.1-1.module+el8.4.0+11282+0729bac9
0:1.52.1-1.module+el8.4.0+11282+0729bac9
rust-std-static
Red Hat:enterprise_linux:8::appstream
From an advisory covering 7 CVEs
before 0:1.52.1-1.module+el8.4.0+11282+0729bac9
0:1.52.1-1.module+el8.4.0+11282+0729bac9
rust-toolset
Red Hat:enterprise_linux:8::appstream
From an advisory covering 7 CVEs
before 0:1.52.1-1.module+el8.4.0+11282+0729bac9
0:1.52.1-1.module+el8.4.0+11282+0729bac9
rustfmt
Red Hat:enterprise_linux:8::appstream
From an advisory covering 7 CVEs
before 0:1.52.1-1.module+el8.4.0+11282+0729bac9
0:1.52.1-1.module+el8.4.0+11282+0729bac9
rustfmt-debuginfo
Red Hat:enterprise_linux:8::appstream
From an advisory covering 7 CVEs
before 0:1.52.1-1.module+el8.4.0+11282+0729bac9
0:1.52.1-1.module+el8.4.0+11282+0729bac9
rust
Rocky Linux:8
From an advisory covering 7 CVEs
before 0:1.52.1-1.module+el8.4.0+641+ca238f88
0:1.52.1-1.module+el8.4.0+641+ca238f88
rust-toolset
Rocky Linux:8
From an advisory covering 7 CVEs
before 0:1.52.1-1.module+el8.4.0+641+ca238f88
0:1.52.1-1.module+el8.4.0+641+ca238f88
rustc
Ubuntu:Pro:14.04:LTS
All versions, plus listed versions
1.15.1+dfsg0-1~exp1ubuntu2~14.04.71.17.0+dfsg2-8~ubuntu0.14.04.31.21.0+dfsg1+llvm-0ubuntu3~14.04.51.22.1+dfsg1+llvm-0ubuntu2~14.04.21.24.1+dfsg1+llvm-0ubuntu1~14.04.1
Show 5 moreShow less
1.25.0+dfsg1+llvm-0ubuntu1~14.04.11.28.0+dfsg1+llvm-0ubuntu1~14.04.11.30.0+dfsg1+llvm-2ubuntu1~14.04.11.31.0+dfsg1+llvm-2ubuntu1~14.04.11.31.0+dfsg1+llvm-2ubuntu1~14.04.1ubuntu1
None known
rustc
Ubuntu:Pro:16.04:LTS
All versions, plus listed versions
1.7.0+dfsg1-11.15.1+dfsg0-1~exp1ubuntu2~16.04.31.17.0+dfsg2-8~ubuntu0.16.04.21.21.0+dfsg1+llvm-0ubuntu3~16.04.11.22.1+dfsg1+llvm-0ubuntu2~16.04.2
Show 15 moreShow less
1.24.1+dfsg1+llvm-0ubuntu1~16.04.11.25.0+dfsg1+llvm-0ubuntu1~16.04.11.28.0+dfsg1+llvm-0ubuntu1~16.04.11.30.0+dfsg1+llvm-2ubuntu1~16.04.11.31.0+dfsg1+llvm-2ubuntu1~16.04.11.32.0+dfsg1+llvm-1ubuntu1~16.04.11.34.1+dfsg2+llvm-0ubuntu1~16.04.11.35.0+dfsg0.1+llvm-0ubuntu1~16.04.11.36.0+dfsg1+llvm-2ubuntu1~16.04.11.37.0+dfsg1+llvm-1ubuntu1~16.04.11.39.0+dfsg1+llvm-3ubuntu1~16.04.11.41.0+dfsg1+llvm-0ubuntu1~16.04.11.43.0+dfsg1+llvm-1~exp1ubuntu2~16.04.11.47.0+dfsg1+llvm-1ubuntu1~16.04.11.47.0+dfsg1+llvm-1ubuntu1~16.04.1ubuntu2
None known
rustc
Ubuntu:20.04:LTS
before 1.53.0+dfsg1+llvm-4ubuntu1~20.04.1, plus listed versions
1.37.0+dfsg1+llvm-1ubuntu11.38.0+dfsg0.2+llvm-0ubuntu11.38.0+dfsg0.2+llvm-0ubuntu21.39.0+dfsg1+llvm-3ubuntu11.40.0+dfsg1+llvm-5ubuntu1
Show 5 moreShow less
1.41.0+dfsg1+llvm-0ubuntu11.41.0+dfsg1+llvm-0ubuntu21.43.0+dfsg1+llvm-1~exp1ubuntu1~20.04.11.47.0+dfsg1+llvm-1ubuntu1~20.04.11.51.0+dfsg1+llvm-1~exp3ubuntu1~20.04.2
1.53.0+dfsg1+llvm-4ubuntu1~20.04.1
rustc
Ubuntu:22.04:LTS
before 1.53.0+dfsg1+llvm-4ubuntu1, plus listed versions
1.51.0+dfsg1+llvm-1~exp3ubuntu1
1.53.0+dfsg1+llvm-4ubuntu1

History

History
RecordedChangedSources
affected, facts
affectedOSV
aliasesEUVD
first indexedCVE List, GitHub Advisories, NVD, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2021-31162 is a critical vulnerability (CVSS 9.8) in Rust-lang Rust, published April 14, 2021. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 2.89%, the 86th percentile. Fixed in chromium-rust 1.51.0-r2.

References

Show 51 moreShow less
MoveEnter Open