{"answers":{"affected":"It affects 7 products.","exploited":"It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-21658 exists.","fix":"Upgrade to a fixed version.","what":"CVE-2022-21658 is a high-severity vulnerability in Apple Ipados, published on 20 Jan 2022. It can only be exploited from the same machine or local network, with no action from the victim."},"fix_prompt":"Check this codebase for CVE-2022-21658 and fix it if it is affected.\n\nWhat it is: CVE-2022-21658 is a high-severity vulnerability in Apple Ipados, published on 20 Jan 2022. It can only be exploited from the same machine or local network, with no action from the victim.\nExploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-21658 exists.\n\nAffected product: Apple Ipados. No package-level version data is available, so check the vendor advisory linked from the reference page.\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2022-21658/ (Markdown: https://insights.sbomify.com/CVE-2022-21658/index.md)","id":"CVE-2022-21658","markdown":"https://insights.sbomify.com/CVE-2022-21658/index.md","name":"CVE-2022-21658","record":{"aliases":["ALSA-2022:1894","AZL-8337","DEBIAN-CVE-2022-21658","GHSA-r9cc-f5pr-p3j2","MGASA-2022-0044","RHSA-2022:1894","RLSA-2022:1894","SUSE-SU-2022:0149-1","SUSE-SU-2022:0171-1","SUSE-SU-2022:0175-1","SUSE-SU-2022:0200-1","SUSE-SU-2022:0491-1","SUSE-SU-2022:0843-1","UBUNTU-CVE-2022-21658","openSUSE-SU-2022:0149-1","openSUSE-SU-2022:0171-1","openSUSE-SU-2022:0175-1","openSUSE-SU-2022:0491-1","openSUSE-SU-2022:0843-1","openSUSE-SU-2024:11767-1","openSUSE-SU-2024:11768-1","openSUSE-SU-2024:11769-1"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["data_modify","privilege_escalation"],"network_reachable":"adjacent_or_local","non_default_config":false,"product_category":"Rust standard library","requires_auth":"low_privilege","summary":"An attacker can exploit a race condition in the Rust standard library to trick privileged programs into deleting unauthorized files or directories.","user_interaction":"not_required","vuln_class":"race_condition"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[{"product":"ipados","vendor":"apple"},{"product":"iphone_os","vendor":"apple"},{"product":"macos","vendor":"apple"},{"product":"tvos","vendor":"apple"},{"product":"watchos","vendor":"apple"},{"product":"fedora","vendor":"fedoraproject"},{"product":"rust","vendor":"rust-lang"}],"cvss":{"score":7.3,"severity":"high","source":"cna","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:N/I:L/A:H","version":"3.1"},"cwes":[{"id":"CWE-367","name":"Time-of-check Time-of-use (TOCTOU) Race Condition"},{"id":"CWE-363","name":"Race Condition Enabling Link Following"}],"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.","ecosystems":["AlmaLinux:8","Red Hat:enterprise_linux:8::appstream","Rocky Linux:8","SUSE:Enterprise Storage 6","SUSE:Enterprise Storage 7","SUSE:Linux Enterprise High Performance Computing 15 SP1-ESPOS","SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSS","SUSE:Linux Enterprise High Performance Computing 15 SP2-ESPOS","SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSS","SUSE:Linux Enterprise High Performance Computing 15-ESPOS","SUSE:Linux Enterprise High Performance Computing 15-LTSS","SUSE:Linux Enterprise Module for Development Tools 15 SP3","SUSE:Linux Enterprise Real Time 15 SP2","SUSE:Linux Enterprise Server 15 SP1-BCL","SUSE:Linux Enterprise Server 15 SP1-LTSS","SUSE:Linux Enterprise Server 15 SP2-BCL","SUSE:Linux Enterprise Server 15 SP2-LTSS","SUSE:Linux Enterprise Server 15-LTSS","SUSE:Linux Enterprise Server for SAP Applications 15","SUSE:Linux Enterprise Server for SAP Applications 15 SP1","SUSE:Linux Enterprise Server for SAP Applications 15 SP2","SUSE:Manager Proxy 4.1","SUSE:Manager Retail Branch Server 4.1","SUSE:Manager Server 4.1","SUSE:Package Hub 15 SP3","openSUSE:Leap 15.3","openSUSE:Tumbleweed"],"exploits":{"exploitdb":0,"first_seen":"2022-01-21","github_poc":1,"max_poc_stars":2,"metasploit":0,"nuclei":0,"refs":[{"date":"2022-01-21T06:09:16Z","kind":"github_poc","ref":"https://github.com/sagittarius-a/cve-2022-21658","stars":2,"title":"POC for cve-2022-21658"}],"tier":"weaponised"},"has_fix":true,"headline":"Race condition in std::fs::remove_dir_all in rustlang","id":"CVE-2022-21658","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":null,"product":"apple:ipados","products":["apple:ipados","apple:iphone_os","apple:macos","apple:tvos","apple:watchos","fedoraproject:fedora"],"type":"race_condition","year":"2022"},"n_packages":78,"n_references":15,"next":{"headline":"Observable Response Discrepancy in Flask-AppBuilder","id":"CVE-2022-21659"},"packages":[{"ecosystem":"AlmaLinux:8","fixed":["1.58.1-1.module_el8.6.0+2748+176088b3"],"introduced":["0"],"last_affected":[],"package":"cargo","purl":"pkg:rpm/almalinux/cargo","source":"ALSA-2022:1894"},{"ecosystem":"AlmaLinux:8","fixed":["1.58.1-1.module_el8.6.0+2748+176088b3"],"introduced":["0"],"last_affected":[],"package":"cargo-doc","purl":"pkg:rpm/almalinux/cargo-doc","source":"ALSA-2022:1894"},{"ecosystem":"AlmaLinux:8","fixed":["1.58.1-1.module_el8.6.0+2748+176088b3"],"introduced":["0"],"last_affected":[],"package":"clippy","purl":"pkg:rpm/almalinux/clippy","source":"ALSA-2022:1894"},{"ecosystem":"AlmaLinux:8","fixed":["1.58.1-1.module_el8.6.0+2748+176088b3"],"introduced":["0"],"last_affected":[],"package":"rls","purl":"pkg:rpm/almalinux/rls","source":"ALSA-2022:1894"},{"ecosystem":"AlmaLinux:8","fixed":["1.58.1-1.module_el8.6.0+2748+176088b3"],"introduced":["0"],"last_affected":[],"package":"rust","purl":"pkg:rpm/almalinux/rust","source":"ALSA-2022:1894"},{"ecosystem":"AlmaLinux:8","fixed":["1.58.1-1.module_el8.6.0+2748+176088b3"],"introduced":["0"],"last_affected":[],"package":"rust-analysis","purl":"pkg:rpm/almalinux/rust-analysis","source":"ALSA-2022:1894"},{"ecosystem":"AlmaLinux:8","fixed":["1.58.1-1.module_el8.6.0+2748+176088b3"],"introduced":["0"],"last_affected":[],"package":"rust-debugger-common","purl":"pkg:rpm/almalinux/rust-debugger-common","source":"ALSA-2022:1894"},{"ecosystem":"AlmaLinux:8","fixed":["1.58.1-1.module_el8.6.0+2748+176088b3"],"introduced":["0"],"last_affected":[],"package":"rust-doc","purl":"pkg:rpm/almalinux/rust-doc","source":"ALSA-2022:1894"},{"ecosystem":"AlmaLinux:8","fixed":["1.58.1-1.module_el8.6.0+2748+176088b3"],"introduced":["0"],"last_affected":[],"package":"rust-gdb","purl":"pkg:rpm/almalinux/rust-gdb","source":"ALSA-2022:1894"},{"ecosystem":"AlmaLinux:8","fixed":["1.58.1-1.module_el8.6.0+2748+176088b3"],"introduced":["0"],"last_affected":[],"package":"rust-lldb","purl":"pkg:rpm/almalinux/rust-lldb","source":"ALSA-2022:1894"},{"ecosystem":"AlmaLinux:8","fixed":["1.58.1-1.module_el8.6.0+2748+176088b3"],"introduced":["0"],"last_affected":[],"package":"rust-src","purl":"pkg:rpm/almalinux/rust-src","source":"ALSA-2022:1894"},{"ecosystem":"AlmaLinux:8","fixed":["1.58.1-1.module_el8.6.0+2748+176088b3"],"introduced":["0"],"last_affected":[],"package":"rust-std-static","purl":"pkg:rpm/almalinux/rust-std-static","source":"ALSA-2022:1894"},{"ecosystem":"AlmaLinux:8","fixed":["1.58.1-1.module_el8.6.0+2748+176088b3"],"introduced":["0"],"last_affected":[],"package":"rust-std-static-wasm32-unknown-unknown","purl":"pkg:rpm/almalinux/rust-std-static-wasm32-unknown-unknown","source":"ALSA-2022:1894"},{"ecosystem":"AlmaLinux:8","fixed":["1.58.1-1.module_el8.6.0+2748+176088b3"],"introduced":["0"],"last_affected":[],"package":"rust-std-static-wasm32-wasi","purl":"pkg:rpm/almalinux/rust-std-static-wasm32-wasi","source":"ALSA-2022:1894"},{"ecosystem":"AlmaLinux:8","fixed":["1.58.1-1.module_el8.6.0+2748+176088b3"],"introduced":["0"],"last_affected":[],"package":"rust-toolset","purl":"pkg:rpm/almalinux/rust-toolset","source":"ALSA-2022:1894"},{"ecosystem":"AlmaLinux:8","fixed":["1.58.1-1.module_el8.6.0+2748+176088b3"],"introduced":["0"],"last_affected":[],"package":"rustfmt","purl":"pkg:rpm/almalinux/rustfmt","source":"ALSA-2022:1894"},{"ecosystem":"Red Hat:enterprise_linux:8::appstream","fixed":["0:1.58.1-1.module+el8.6.0+14021+586eff1a"],"introduced":["0"],"last_affected":[],"package":"cargo","purl":"pkg:rpm/redhat/cargo","source":"RHSA-2022:1894"},{"ecosystem":"Red Hat:enterprise_linux:8::appstream","fixed":["0:1.58.1-1.module+el8.6.0+14021+586eff1a"],"introduced":["0"],"last_affected":[],"package":"cargo-debuginfo","purl":"pkg:rpm/redhat/cargo-debuginfo","source":"RHSA-2022:1894"},{"ecosystem":"Red Hat:enterprise_linux:8::appstream","fixed":["0:1.58.1-1.module+el8.6.0+14021+586eff1a"],"introduced":["0"],"last_affected":[],"package":"cargo-doc","purl":"pkg:rpm/redhat/cargo-doc","source":"RHSA-2022:1894"},{"ecosystem":"Red Hat:enterprise_linux:8::appstream","fixed":["0:1.58.1-1.module+el8.6.0+14021+586eff1a"],"introduced":["0"],"last_affected":[],"package":"clippy","purl":"pkg:rpm/redhat/clippy","source":"RHSA-2022:1894"},{"ecosystem":"Red Hat:enterprise_linux:8::appstream","fixed":["0:1.58.1-1.module+el8.6.0+14021+586eff1a"],"introduced":["0"],"last_affected":[],"package":"clippy-debuginfo","purl":"pkg:rpm/redhat/clippy-debuginfo","source":"RHSA-2022:1894"},{"ecosystem":"Red Hat:enterprise_linux:8::appstream","fixed":["0:1.58.1-1.module+el8.6.0+14021+586eff1a"],"introduced":["0"],"last_affected":[],"package":"rls","purl":"pkg:rpm/redhat/rls","source":"RHSA-2022:1894"},{"ecosystem":"Red Hat:enterprise_linux:8::appstream","fixed":["0:1.58.1-1.module+el8.6.0+14021+586eff1a"],"introduced":["0"],"last_affected":[],"package":"rls-debuginfo","purl":"pkg:rpm/redhat/rls-debuginfo","source":"RHSA-2022:1894"},{"ecosystem":"Red Hat:enterprise_linux:8::appstream","fixed":["0:1.58.1-1.module+el8.6.0+14021+586eff1a"],"introduced":["0"],"last_affected":[],"package":"rust","purl":"pkg:rpm/redhat/rust","source":"RHSA-2022:1894"},{"ecosystem":"Red Hat:enterprise_linux:8::appstream","fixed":["0:1.58.1-1.module+el8.6.0+14021+586eff1a"],"introduced":["0"],"last_affected":[],"package":"rust-analysis","purl":"pkg:rpm/redhat/rust-analysis","source":"RHSA-2022:1894"},{"ecosystem":"Red Hat:enterprise_linux:8::appstream","fixed":["0:1.58.1-1.module+el8.6.0+14021+586eff1a"],"introduced":["0"],"last_affected":[],"package":"rust-debugger-common","purl":"pkg:rpm/redhat/rust-debugger-common","source":"RHSA-2022:1894"},{"ecosystem":"Red Hat:enterprise_linux:8::appstream","fixed":["0:1.58.1-1.module+el8.6.0+14021+586eff1a"],"introduced":["0"],"last_affected":[],"package":"rust-debuginfo","purl":"pkg:rpm/redhat/rust-debuginfo","source":"RHSA-2022:1894"},{"ecosystem":"Red Hat:enterprise_linux:8::appstream","fixed":["0:1.58.1-1.module+el8.6.0+14021+586eff1a"],"introduced":["0"],"last_affected":[],"package":"rust-debugsource","purl":"pkg:rpm/redhat/rust-debugsource","source":"RHSA-2022:1894"},{"ecosystem":"Red Hat:enterprise_linux:8::appstream","fixed":["0:1.58.1-1.module+el8.6.0+14021+586eff1a"],"introduced":["0"],"last_affected":[],"package":"rust-doc","purl":"pkg:rpm/redhat/rust-doc","source":"RHSA-2022:1894"},{"ecosystem":"Red Hat:enterprise_linux:8::appstream","fixed":["0:1.58.1-1.module+el8.6.0+14021+586eff1a"],"introduced":["0"],"last_affected":[],"package":"rust-gdb","purl":"pkg:rpm/redhat/rust-gdb","source":"RHSA-2022:1894"},{"ecosystem":"Red Hat:enterprise_linux:8::appstream","fixed":["0:1.58.1-1.module+el8.6.0+14021+586eff1a"],"introduced":["0"],"last_affected":[],"package":"rust-lldb","purl":"pkg:rpm/redhat/rust-lldb","source":"RHSA-2022:1894"},{"ecosystem":"Red Hat:enterprise_linux:8::appstream","fixed":["0:1.58.1-1.module+el8.6.0+14021+586eff1a"],"introduced":["0"],"last_affected":[],"package":"rust-src","purl":"pkg:rpm/redhat/rust-src","source":"RHSA-2022:1894"},{"ecosystem":"Red Hat:enterprise_linux:8::appstream","fixed":["0:1.58.1-1.module+el8.6.0+14021+586eff1a"],"introduced":["0"],"last_affected":[],"package":"rust-std-static","purl":"pkg:rpm/redhat/rust-std-static","source":"RHSA-2022:1894"},{"ecosystem":"Red Hat:enterprise_linux:8::appstream","fixed":["0:1.58.1-1.module+el8.6.0+14021+586eff1a"],"introduced":["0"],"last_affected":[],"package":"rust-std-static-wasm32-unknown-unknown","purl":"pkg:rpm/redhat/rust-std-static-wasm32-unknown-unknown","source":"RHSA-2022:1894"},{"ecosystem":"Red Hat:enterprise_linux:8::appstream","fixed":["0:1.58.1-1.module+el8.6.0+14021+586eff1a"],"introduced":["0"],"last_affected":[],"package":"rust-std-static-wasm32-wasi","purl":"pkg:rpm/redhat/rust-std-static-wasm32-wasi","source":"RHSA-2022:1894"},{"ecosystem":"Red Hat:enterprise_linux:8::appstream","fixed":["0:1.58.1-1.module+el8.6.0+14021+586eff1a"],"introduced":["0"],"last_affected":[],"package":"rust-toolset","purl":"pkg:rpm/redhat/rust-toolset","source":"RHSA-2022:1894"},{"ecosystem":"Red Hat:enterprise_linux:8::appstream","fixed":["0:1.58.1-1.module+el8.6.0+14021+586eff1a"],"introduced":["0"],"last_affected":[],"package":"rustfmt","purl":"pkg:rpm/redhat/rustfmt","source":"RHSA-2022:1894"},{"ecosystem":"Red Hat:enterprise_linux:8::appstream","fixed":["0:1.58.1-1.module+el8.6.0+14021+586eff1a"],"introduced":["0"],"last_affected":[],"package":"rustfmt-debuginfo","purl":"pkg:rpm/redhat/rustfmt-debuginfo","source":"RHSA-2022:1894"},{"ecosystem":"Rocky Linux:8","fixed":["0:1.58.1-1.module+el8.6.0+826+60f85975"],"introduced":["0"],"last_affected":[],"package":"rust","purl":"pkg:rpm/rocky-linux/rust?distro=rocky-linux-8-6-legacy\u0026epoch=0","source":"RLSA-2022:1894"},{"ecosystem":"Rocky Linux:8","fixed":["0:1.58.1-1.module+el8.6.0+826+60f85975"],"introduced":["0"],"last_affected":[],"package":"rust-toolset","purl":"pkg:rpm/rocky-linux/rust-toolset?distro=rocky-linux-8-6-legacy\u0026epoch=0","source":"RLSA-2022:1894"}],"prev":{"headline":"X.509 Extended Key Usage and Trust Purposes bypass in Envoy","id":"CVE-2022-21657"},"products":["rust"],"published":"2022-01-20","related":[{"cvss_score":10,"headline":"Apple iOS, iPadOS, and macOS Out-of-Bounds Write","id":"CVE-2025-43300","kev_date_added":"2025-08-21","published":"2025-08-21"},{"cvss_score":10,"headline":"Apple Multiple Products WebKit Out-of-Bounds Write","id":"CVE-2025-24201","kev_date_added":"2025-03-13","published":"2025-03-11"},{"cvss_score":10,"headline":"Apple Multiple Products Use-After-Free","id":"CVE-2025-24085","kev_date_added":"2025-01-29","published":"2025-01-27"},{"cvss_score":9.8,"headline":"Apple Multiple Products Memory Corruption","id":"CVE-2025-31200","kev_date_added":"2025-04-17","published":"2025-04-16"},{"cvss_score":9.8,"headline":"Apple Multiple Products Arbitrary Read and Write","id":"CVE-2025-31201","kev_date_added":"2025-04-17","published":"2025-04-16"},{"cvss_score":9.8,"headline":"Apple Memory Corruption","id":"CVE-2022-22587","kev_date_added":"2022-01-28","published":"2022-03-18"},{"cvss_score":9.8,"headline":"Apple iOS, iPadOS, and macOS WebKit Remote Code Execution","id":"CVE-2021-1870","kev_date_added":"2021-11-03","published":"2021-04-02"}],"sources":[{"class":"attribution","licence":"MIT","name":"AlmaLinux","prefix":"ALSA"},{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"Red Hat","prefix":"RHSA"},{"class":"attribution","licence":"BSD","name":"Rocky Linux","prefix":"RLSA"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"},{"class":"open","licence":"CC0","name":"PoC-in-GitHub"}],"ssvc":{"automatable":"no","exploitation":"poc","technical_impact":"partial"},"state":"PUBLISHED","updated":"2025-04-22","vendors":["rust-lang"]},"summary":"An attacker can exploit a race condition in the Rust standard library to trick privileged programs into deleting unauthorized files or directories.","url":"https://insights.sbomify.com/CVE-2022-21658/"}