CVE-2022-21658: Race condition in std::fs::remove_dir_all in rustlang

Published Jan 20, 2022
·
Updated

LLVM. A race condition was addressed with additional validation.

Other sources

Rust is a multi-paradigm, general-purpose programming language designed for performance and safety, especially safe concurrency. The Rust Security Response WG was notified that the std::fs::removedirall standard library function is vulnerable a race condition enabling symlink following (CWE-363). An attacker could use this security issue to trick a privileged program into deleting files and directories the attacker couldn't otherwise access or delete. Rust 1.0.0 through Rust 1.58.0 is affected by this vulnerability with 1.58.1 containing a patch. Note that the following build targets don't have usable APIs to properly mitigate the attack, and are thus still vulnerable even with a patched toolchain: macOS before version 10.10 (Yosemite) and REDOX. We recommend everyone to update to Rust 1.58.1 as soon as possible, especially people developing programs expected to run in privileged contexts (including system daemons and setuid binaries), as those have the highest risk of being affected by this. Note that adding checks in your codebase before calling removedirall will not mitigate the vulnerability, as they would also be vulnerable to race conditions like removedirall itself. The existing mitigation is working as intended outside of race conditions.

Credit

Florian Weimer@@fweimer

Affected Software

13 affected componentsFixes available
Apple tvOS<15.4
15.4
Apple WatchOS<8.5
8.5
Apple macOS Monterey<12.3
12.3
Apple iOS<15.4
15.4
Apple iPadOS<15.4
15.4
rust-lang Rust>=1.0.0<=1.58.0
Fedoraproject Fedora=34
Fedoraproject Fedora=35
Apple iPadOS<15.4
Apple iPhone OS<15.4
Apple macOS>=12.0.0<12.3
Apple tvOS<15.4
Apple WatchOS<8.5

Event History

Jan 20, 2022
CVE Published
via MITRE·12:00 AM
Data Sourced
via MITRE·12:00 AM
DescriptionSeverityWeakness

Parent advisories

This vulnerability appears in the following advisories.

Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is CVE-2022-21658?

CVE-2022-21658 is a vulnerability in LLVM that was addressed with additional validation.

2

Which software versions are affected by CVE-2022-21658?

CVE-2022-21658 affects macOS Monterey 12.3, watchOS up to 8.5, iOS up to 15.4, iPadOS up to 15.4, and tvOS up to 15.4.

3

How severe is CVE-2022-21658?

The severity of CVE-2022-21658 is not specified.

4

How can I fix CVE-2022-21658?

To fix CVE-2022-21658, update your software to the specified versions provided by Apple.

5

Where can I find more information about CVE-2022-21658?

More information about CVE-2022-21658 can be found on the following Apple support pages: [link1], [link2], [link3].

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203