CVE-2022-21658 Race condition in std::fs::remove_dir_all in rustlang
- Published
- Updated
- Exploit status
- No public exploit known
- CISA SSVC
- Proof of concept public · automatable: no · technical impact: partial
- Technology
- UbuntuDebian
Description
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::remove_dir_all 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 remove_dir_all will not mitigate the vulnerability, as they would also be vulnerable to race conditions like remove_dir_all itself. The existing mitigation is working as intended outside of race conditions.
Upgrade path
13 packages: 10 fixed, 2 with no fix yet.
| Package | Affected | Fixed in | Status |
|---|---|---|---|
| ubuntu/rustc(Ubuntu Pro 14.04) | = 1.15.1+dfsg0-1~exp1ubuntu2~14.04.7; = 1.17.0+dfsg2-8~ubuntu0.14.04.3; = 1.21.0+dfsg1+llvm-0ubuntu3~14.04.5; = 1.22.1+dfsg1+llvm-0ubuntu2~14.04.2 +7 more | No fix listed | No fix yet |
| ubuntu/rustc(Ubuntu Pro 16.04) | = 1.7.0+dfsg1-1; = 1.15.1+dfsg0-1~exp1ubuntu2~16.04.3; = 1.17.0+dfsg2-8~ubuntu0.16.04.2; = 1.21.0+dfsg1+llvm-0ubuntu3~16.04.1 +17 more | No fix listed | No fix yet |
| apple iPadOS | < 15.4 | 15.4 | Fixed |
| apple iphone os | < 15.4 | 15.4 | Fixed |
| apple macos | >= 12.0.0, < 12.3 | 12.3 | Fixed |
| apple tvOS | < 15.4 | 15.4 | Fixed |
| apple watchOS | < 8.5 | 8.5 | Fixed |
| debian/rustc(Debian 12) | < 1.57.0+dfsg1-1 | 1.57.0+dfsg1-1 | Fixed |
| debian/rustc(Debian 13) | < 1.57.0+dfsg1-1 | 1.57.0+dfsg1-1 | Fixed |
| debian/rustc(Debian 14) | < 1.57.0+dfsg1-1 | 1.57.0+dfsg1-1 | Fixed |
| rust-lang rust | = < 1.58.1; >= 1.0.0, <= 1.58.0 | after 1.58.0 | Fixed |
| ubuntu/rustc(Ubuntu 20.04) | < 1.59.0+dfsg1~ubuntu1~llvm-1~ubuntu1~20.04.2; = 1.37.0+dfsg1+llvm-1ubuntu1; = 1.38.0+dfsg0.2+llvm-0ubuntu1; = 1.38.0+dfsg0.2+llvm-0ubuntu2 +9 more | 1.59.0+dfsg1~ubuntu1~llvm-1~ubuntu1~20.04.2 | Fixed |
| fedoraproject fedora | = 34; = 35 | No fix listed | Versions listed |
Affected products
| Product | Affected versions | Fixed in |
|---|---|---|
| rust-lang rust | = < 1.58.1 | No fix listed |
| rust-lang rust | >= 1.0.0, <= 1.58.0 | No fix listed |
| fedoraproject fedora | = 34 | No fix listed |
| fedoraproject fedora | = 35 | No fix listed |
| apple iPadOS | < 15.4 | 15.4 |
| apple iphone os | < 15.4 | 15.4 |
| apple macos | >= 12.0.0, < 12.3 | 12.3 |
| apple tvOS | < 15.4 | 15.4 |
| apple watchOS | < 8.5 | 8.5 |
| debian/rustc(Debian:12) | < 1.57.0+dfsg1-1 | 1.57.0+dfsg1-1 |
| debian/rustc(Debian:14) | < 1.57.0+dfsg1-1 | 1.57.0+dfsg1-1 |
| debian/rustc(Debian:13) | < 1.57.0+dfsg1-1 | 1.57.0+dfsg1-1 |
| ubuntu/rustc(Ubuntu:Pro:14.04) | All versions | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:14.04) | = 1.15.1+dfsg0-1~exp1ubuntu2~14.04.7 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:14.04) | = 1.17.0+dfsg2-8~ubuntu0.14.04.3 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:14.04) | = 1.21.0+dfsg1+llvm-0ubuntu3~14.04.5 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:14.04) | = 1.22.1+dfsg1+llvm-0ubuntu2~14.04.2 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:14.04) | = 1.24.1+dfsg1+llvm-0ubuntu1~14.04.1 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:14.04) | = 1.25.0+dfsg1+llvm-0ubuntu1~14.04.1 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:14.04) | = 1.28.0+dfsg1+llvm-0ubuntu1~14.04.1 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:14.04) | = 1.30.0+dfsg1+llvm-2ubuntu1~14.04.1 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:14.04) | = 1.31.0+dfsg1+llvm-2ubuntu1~14.04.1 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:14.04) | = 1.31.0+dfsg1+llvm-2ubuntu1~14.04.1ubuntu1 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:16.04) | All versions | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:16.04) | = 1.7.0+dfsg1-1 | No fix listed |
Show 32 more
| Product | Affected versions | Fixed in |
|---|---|---|
| ubuntu/rustc(Ubuntu:Pro:16.04) | = 1.15.1+dfsg0-1~exp1ubuntu2~16.04.3 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:16.04) | = 1.17.0+dfsg2-8~ubuntu0.16.04.2 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:16.04) | = 1.21.0+dfsg1+llvm-0ubuntu3~16.04.1 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:16.04) | = 1.22.1+dfsg1+llvm-0ubuntu2~16.04.2 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:16.04) | = 1.24.1+dfsg1+llvm-0ubuntu1~16.04.1 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:16.04) | = 1.25.0+dfsg1+llvm-0ubuntu1~16.04.1 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:16.04) | = 1.28.0+dfsg1+llvm-0ubuntu1~16.04.1 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:16.04) | = 1.30.0+dfsg1+llvm-2ubuntu1~16.04.1 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:16.04) | = 1.31.0+dfsg1+llvm-2ubuntu1~16.04.1 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:16.04) | = 1.32.0+dfsg1+llvm-1ubuntu1~16.04.1 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:16.04) | = 1.34.1+dfsg2+llvm-0ubuntu1~16.04.1 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:16.04) | = 1.35.0+dfsg0.1+llvm-0ubuntu1~16.04.1 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:16.04) | = 1.36.0+dfsg1+llvm-2ubuntu1~16.04.1 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:16.04) | = 1.37.0+dfsg1+llvm-1ubuntu1~16.04.1 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:16.04) | = 1.39.0+dfsg1+llvm-3ubuntu1~16.04.1 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:16.04) | = 1.41.0+dfsg1+llvm-0ubuntu1~16.04.1 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:16.04) | = 1.43.0+dfsg1+llvm-1~exp1ubuntu2~16.04.1 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:16.04) | = 1.47.0+dfsg1+llvm-1ubuntu1~16.04.1 | No fix listed |
| ubuntu/rustc(Ubuntu:Pro:16.04) | = 1.47.0+dfsg1+llvm-1ubuntu1~16.04.1ubuntu2 | No fix listed |
| ubuntu/rustc(Ubuntu:20.04) | < 1.59.0+dfsg1~ubuntu1~llvm-1~ubuntu1~20.04.2 | 1.59.0+dfsg1~ubuntu1~llvm-1~ubuntu1~20.04.2 |
| ubuntu/rustc(Ubuntu:20.04) | = 1.37.0+dfsg1+llvm-1ubuntu1 | No fix listed |
| ubuntu/rustc(Ubuntu:20.04) | = 1.38.0+dfsg0.2+llvm-0ubuntu1 | No fix listed |
| ubuntu/rustc(Ubuntu:20.04) | = 1.38.0+dfsg0.2+llvm-0ubuntu2 | No fix listed |
| ubuntu/rustc(Ubuntu:20.04) | = 1.39.0+dfsg1+llvm-3ubuntu1 | No fix listed |
| ubuntu/rustc(Ubuntu:20.04) | = 1.40.0+dfsg1+llvm-5ubuntu1 | No fix listed |
| ubuntu/rustc(Ubuntu:20.04) | = 1.41.0+dfsg1+llvm-0ubuntu1 | No fix listed |
| ubuntu/rustc(Ubuntu:20.04) | = 1.41.0+dfsg1+llvm-0ubuntu2 | No fix listed |
| ubuntu/rustc(Ubuntu:20.04) | = 1.43.0+dfsg1+llvm-1~exp1ubuntu1~20.04.1 | No fix listed |
| ubuntu/rustc(Ubuntu:20.04) | = 1.47.0+dfsg1+llvm-1ubuntu1~20.04.1 | No fix listed |
| ubuntu/rustc(Ubuntu:20.04) | = 1.51.0+dfsg1+llvm-1~exp3ubuntu1~20.04.2 | No fix listed |
| ubuntu/rustc(Ubuntu:20.04) | = 1.53.0+dfsg1+llvm-4ubuntu1~20.04.1 | No fix listed |
| ubuntu/rustc(Ubuntu:20.04) | = 1.57.0+dfsg1+llvm-0ubuntu1~20.04.1 | No fix listed |
References
- Debian Security Tracker CVE-2022-21658 vendor-advisory
- github.com exploit issue-tracking mitigation third-party-advisory
- github.com patch third-party-advisory
- github.com patch third-party-advisory
- github.com patch third-party-advisory
- github.com patch third-party-advisory
- blog.rust-lang.org exploit issue-tracking mitigation vendor-advisory
- FEDORA-2022-1bafa3fc91 vendor-advisory
- FEDORA-2022-2c73789458 vendor-advisory
- FEDORA-2022-1b76e3a192 vendor-advisory
- FEDORA-2022-06569a0a60 vendor-advisory
- support.apple.com third-party-advisory
- support.apple.com third-party-advisory
- support.apple.com third-party-advisory
- support.apple.com third-party-advisory
- GLSA-202210-09 third-party-advisory vendor-advisory
- ubuntu.com issue-tracking
- groups.google.com issue-tracking
- rustsec.org issue-tracking
- github.com issue-tracking
- www.cve.org issue-tracking