CVE-2021-28877
In the standard library in Rust before 1.51.0, the Zip implementation calls...
In the standard library in Rust before 1.51.0, the Zip implementation calls __iterator_get_unchecked() for the same index more than once when nested. This bug can lead to a memory safety violation due to an unmet safety requirement for the TrustedRandomAccess trait.
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
- None
- Integrity
- None
- Availability
- High
Exploit likelihood
What each source reports
NVD Score used
7.5
In the standard library in Rust before 1.51.0, the Zip implementation calls __iterator_get_unchecked() for the same index more than once when nested. This bug can lead to a memory safety violation due to an unmet safety requirement for the TrustedRandomAccess trait.
- Record
CVE-2021-28877- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - CVSS 2.0
- 5.0 Medium
AV:N/AC:L/Au:N/C:N/I:N/A:P - Weakness
- CWE-119
- Updated
- 2026-11-02
CVE List No score
In the standard library in Rust before 1.51.0, the Zip implementation calls __iterator_get_unchecked() for the same index more than once when nested. This bug can lead to a memory safety violation due to an unmet safety requirement for the TrustedRandomAccess trait.
- Record
CVE-2021-28877- Updated
- 2026-11-02
EUVDEUVD-2021-15530 No score
In the standard library in Rust before 1.51.0, the Zip implementation calls __iterator_get_unchecked() for the same index more than once when nested. This bug can lead to a memory safety violation due to an unmet safety requirement for the TrustedRandomAccess trait.
- Record
EUVD-2021-15530- Updated
- 2026-11-03
GitHub AdvisoriesGHSA-r23x-h32h-x9jh
7.5
In the standard library in Rust before 1.51.0, the Zip implementation calls...
In the standard library in Rust before 1.51.0, the Zip implementation calls __iterator_get_unchecked() for the same index more than once when nested. This bug can lead to a memory safety violation due to an unmet safety requirement for the TrustedRandomAccess trait.
- Record
GHSA-r23x-h32h-x9jh- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-119
- Updated
- 2026-11-02
OSV
7.5
In the standard library in Rust before 1.51.0, the Zip implementation calls __iterator_get_unchecked() for the same index more than once when nested. This bug can lead to a memory safety violation due to an unmet safety requirement for the TrustedRandomAccess trait.
- Record
CVE-2021-28877- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Updated
- 2026-11-02
OSVDEBIAN-CVE-2021-28877
7.5
In the standard library in Rust before 1.51.0, the Zip implementation calls __iterator_get_unchecked() for the same index more than once when nested. This bug can lead to a memory safety violation due to an unmet safety requirement for the TrustedRandomAccess trait.
- Record
DEBIAN-CVE-2021-28877- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Updated
- 2026-11-02
Show 5 moreShow less
OSVOESA-2021-1214
9.8
rust security update
Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety.
Security Fix(es):
In the standard library in Rust before 1.49.0, String::retain() function has a panic safety problem. It allows creation of a non-UTF-8 Rust string when the provided closure panics. This bug could result in a memory safety violation when other string APIs assume that UTF-8 encoding is used on the same string.(CVE-2020-36317)
In the standard library in Rust before 1.50.0, read_to_end() does not validate the return value from Read in an unsafe context. This bug could lead to a buffer overflow.(CVE-2021-28875)
In the standard library in Rust before 1.52.0, the Zip implementation calls __iterator_get_unchecked() more than once for the same index (under certain conditions) when next_back() and next() are used together. This bug could lead to a memory safety violation due to an unmet safety requirement for the TrustedRandomAccess trait.(CVE-2021-28878)
In the standard library in Rust before 1.51.0, the Zip implementation calls __iterator_get_unchecked() for the same index more than once when nested. This bug can lead to a memory safety violation due to an unmet safety requirement for the TrustedRandomAccess trait.(CVE-2021-28877)
In the standard library in Rust before 1.52.0, the Zip implementation has a panic safety issue. It calls __iterator_get_unchecked() more than once for the same index when the underlying iterator panics (in certain conditions). This bug could lead to a memory safety violation due to an unmet safety requirement for the TrustedRandomAccess trait.(CVE-2021-28876)
In the standard library in Rust before 1.52.0, the Zip implementation can report an incorrect size due to an integer overflow. This bug can lead to a buffer overflow when a consumed Zip iterator is used again.(CVE-2021-28879)
In the standard library in Rust before 1.49.0, VecDeque::make_contiguous has a bug that pops the same element more than once under certain condition. This bug could result in a use-after-free or double free.(CVE-2020-36318)
In the standard library in Rust before 1.52.0, there is an optimization for joining strings that can cause uninitialized bytes to be exposed (or the program to crash) if the borrowed string changes after its length is checked.(CVE-2020-36323)
- Record
OESA-2021-1214- CVSS 3.1
- 9.8 Critical
CVSS: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 Critical
CVSS: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 Critical
CVSS: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 Critical
CVSS: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-28877
7.5
In the standard library in Rust before 1.51.0, the Zip implementation calls __iterator_get_unchecked() for the same index more than once when nested. This bug can lead to a memory safety violation due to an unmet safety requirement for the TrustedRandomAccess trait.
- Record
UBUNTU-CVE-2021-28877- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
rustcDebian:12 |
before 1.53.0+dfsg1-1 | 1.53.0+dfsg1-1 |
rustcDebian:13 |
before 1.53.0+dfsg1-1 | 1.53.0+dfsg1-1 |
rustcDebian:14 |
before 1.53.0+dfsg1-1 | 1.53.0+dfsg1-1 |
rustopenEuler:20.03-LTS-SP1 From an advisory covering 8 CVEs |
before 1.51.0-1.oe1 | 1.51.0-1.oe1 |
rust-toolset-1.52Red 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-buildRed 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-cargoRed 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-docRed 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-clippyRed 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-rlsRed Hat:devtools:2021 From an advisory covering 7 CVEs |
before 0:1.52.1-2.el7_9 | 0:1.52.1-2.el7_9 |
Show 36 moreShow less
| Package | Affected | Fixed |
|---|---|---|
rust-toolset-1.52-runtimeRed 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-rustRed 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-analysisRed 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-commonRed 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-debuginfoRed 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-docRed 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-gdbRed 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-lldbRed 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-srcRed 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-staticRed 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-rustfmtRed Hat:devtools:2021 From an advisory covering 7 CVEs |
before 0:1.52.1-2.el7_9 | 0:1.52.1-2.el7_9 |
cargoRed 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-debuginfoRed 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-docRed 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 |
clippyRed 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-debuginfoRed 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 |
rlsRed 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-debuginfoRed 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 |
rustRed 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-analysisRed 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-commonRed 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-debuginfoRed 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-debugsourceRed 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-docRed 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-gdbRed 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-lldbRed 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-srcRed 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-staticRed 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-toolsetRed 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 |
rustfmtRed 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-debuginfoRed 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 |
rustRocky 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-toolsetRocky 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 |
rustcUbuntu: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 less1.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 |
rustcUbuntu: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 less1.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 |
rustcUbuntu:20.04:LTS |
before 1.51.0+dfsg1+llvm-1~exp3ubuntu1~20.04.2, 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 4 moreShow less1.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.1 |
1.51.0+dfsg1+llvm-1~exp3ubuntu1~20.04.2 |
History
| Recorded | Changed | Sources |
|---|---|---|
| affected, facts | ||
| aliases | EUVD | |
| first indexed | CVE List, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2021-28877 is a high vulnerability (CVSS 7.5) in Rust-lang Rust, published April 11, 2021. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 1.39%, the 72nd percentile. Fixed in rustc 1.53.0+dfsg1-1.
References
github.com/rust-lang/rust/pull/80670
security.gentoo.org/glsa/202210-09
nvd.nist.gov/vuln/detail/CVE-2021-28877
github.com/advisories/GHSA-r23x-h32h-x9jh
security-tracker.debian.org/tracker/CVE-2021-28877
openeuler.org/en/security/safety-bulletin/detail.html?id=openEuler-SA-2021-1214
Show 37 moreShow less
nvd.nist.gov/vuln/detail/CVE-2020-36317
nvd.nist.gov/vuln/detail/CVE-2021-28875
nvd.nist.gov/vuln/detail/CVE-2021-28878
nvd.nist.gov/vuln/detail/CVE-2021-28876
nvd.nist.gov/vuln/detail/CVE-2021-28879
nvd.nist.gov/vuln/detail/CVE-2020-36318
nvd.nist.gov/vuln/detail/CVE-2020-36323
access.redhat.com/errata/RHSA-2021:3042
access.redhat.com/security/updates/classification
access.redhat.com/documentation/en-us/red_hat_developer_tools/1/html/using_rust_1.52.1_toolset
bugzilla.redhat.com/show_bug.cgi?id=1949194
bugzilla.redhat.com/show_bug.cgi?id=1949198
bugzilla.redhat.com/show_bug.cgi?id=1949204
bugzilla.redhat.com/show_bug.cgi?id=1949207
bugzilla.redhat.com/show_bug.cgi?id=1949211
bugzilla.redhat.com/show_bug.cgi?id=1950396
bugzilla.redhat.com/show_bug.cgi?id=1950398
security.access.redhat.com/data/csaf/v2/advisories/2021/rhsa-2021_3042.json
access.redhat.com/security/cve/CVE-2020-36323
cve.org/CVERecord?id=CVE-2020-36323
access.redhat.com/security/cve/CVE-2021-28875
cve.org/CVERecord?id=CVE-2021-28875
access.redhat.com/security/cve/CVE-2021-28876
cve.org/CVERecord?id=CVE-2021-28876
access.redhat.com/security/cve/CVE-2021-28877
cve.org/CVERecord?id=CVE-2021-28877
access.redhat.com/security/cve/CVE-2021-28878
cve.org/CVERecord?id=CVE-2021-28878
access.redhat.com/security/cve/CVE-2021-28879
cve.org/CVERecord?id=CVE-2021-28879
access.redhat.com/security/cve/CVE-2021-31162
cve.org/CVERecord?id=CVE-2021-31162
nvd.nist.gov/vuln/detail/CVE-2021-31162
access.redhat.com/errata/RHSA-2021:3063
security.access.redhat.com/data/csaf/v2/advisories/2021/rhsa-2021_3063.json
errata.rockylinux.org/RLSA-2021:3063
ubuntu.com/security/CVE-2021-28877