{"answers":{"affected":"3 open source packages ship an affected version, including remove_dir_all.","exploited":"There is no known exploitation of GHSA-mc8h-8q98-g5hr in the wild and no public exploit code.","fix":"Upgrade remove_dir_all to 0.8.0 or later.","what":"GHSA-mc8h-8q98-g5hr is a vulnerability in remove_dir_all, published on 24 Feb 2023. It can only be exploited from the same machine or local network, with no action from the victim."},"fix_prompt":"Check this codebase for GHSA-mc8h-8q98-g5hr and fix it if it is affected.\n\nWhat it is: GHSA-mc8h-8q98-g5hr is a vulnerability in remove_dir_all, published on 24 Feb 2023. It can only be exploited from the same machine or local network, with no action from the victim.\nExploitation: There is no known exploitation of GHSA-mc8h-8q98-g5hr in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- remove_dir_all (crates.io): affected all versions; fixed in 0.8.0\n- remove_dir_all (crates.io): affected all versions; fixed in 0.8.0\n- remove_dir_all (crates.io): affected from 0.0.0-0; fixed in 0.8.0\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/GHSA-mc8h-8q98-g5hr/ (Markdown: https://insights.sbomify.com/GHSA-mc8h-8q98-g5hr/index.md)","id":"GHSA-mc8h-8q98-g5hr","markdown":"https://insights.sbomify.com/GHSA-mc8h-8q98-g5hr/index.md","name":"GHSA-mc8h-8q98-g5hr","record":{"aliases":["RUSTSEC-2023-0018"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["data_modify","privilege_escalation"],"network_reachable":"adjacent_or_local","non_default_config":false,"product_category":"Rust file deletion library","requires_auth":"none","summary":"A race condition in the remove_dir_all crate allows attackers to trick privileged processes into deleting arbitrary files via symlink manipulation.","user_interaction":"not_required","vuln_class":"race_condition"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"The remove_dir_all crate is a Rust library that offers additional features over the Rust\nstandard library fs::remove_dir_all function.\n\nIt was possible to trick a privileged process doing a recursive delete in an\nattacker controlled directory into deleting privileged files, on all operating systems.\n\nFor instance, consider deleting a tree called 'etc' in a parent directory\ncalled 'p'. Between calling `remove_dir_all(\"a\")` and remove_dir_all(\"a\")\nactually starting its work, the attacker can move 'p' to 'p-prime', and\nreplace 'p' with a symlink to '/'. Then the privileged process deletes 'p/etc'\nwhich is actually /etc, and now your system is broken. There are some\nmitigations for this exact scenario, such as CWD relative file lookup, but\nthey are not guaranteed - any code using absolute paths will not have that\nprotection in place.\n\nThe same attack could be performed at any point in the directory tree being\ndeleted: if 'a' contains a child directory called 'etc', attacking the\ndeletion by replacing 'a' with a link is possible.\n\nThe new code in this release mitigates the attack within the directory tree\nbeing deleted by using file-handle relative operations: to open 'a/etc', the\npath 'etc' relative to 'a' is opened, where 'a' is represented by a file\ndescriptor (Unix) or handle (Windows). With the exception of the entry points\ninto the directory deletion logic, this is robust against manipulation of the\ndirectory hierarchy, and remove_dir_all will only delete files and directories\ncontained in the tree it is deleting.\n\nThe entry path however is a challenge - as described above, there are some\npotential mitigations, but since using them must be done by the calling code,\nit is hard to be confident about the security properties of the path based\ninterface.\n\nThe new extension trait `RemoveDir` provides an interface where it is much\nharder to get it wrong.\n\n`somedir.remove_dir_contents(\"name-of-child\")`.\n\nCallers can then make their own security evaluation about how to securely get\na directory handle. That is still not particularly obvious, and we're going to\nfollow up with a helper of some sort (probably in the `fs_at` crate). Once\nthat is available, the path based entry points will get deprecated.\n\nIn the interim, processes that might run with elevated privileges should\nfigure out how to securely identify the directory they are going to delete, to\navoid the initial race. Pragmatically, other processes should be fine with the\npath based entry points : this is the same interface `std::fs::remove_dir_all`\noffers, and an unprivileged process running in an attacker controlled\ndirectory can't do anything that the attacker can't already do.","ecosystems":["crates.io"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"Race Condition Enabling Link Following and Time-of-check Time-of-use (TOCTOU)","id":"GHSA-mc8h-8q98-g5hr","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"crates.io","product":null,"products":[],"type":"race_condition","year":"2023"},"n_packages":3,"n_references":null,"packages":[{"ecosystem":"crates.io","fixed":["0.8.0"],"introduced":["0"],"last_affected":[],"package":"remove_dir_all","purl":null,"source":"GHSA-mc8h-8q98-g5hr"},{"ecosystem":"crates.io","fixed":["0.8.0"],"introduced":["0"],"last_affected":[],"package":"remove_dir_all","purl":"pkg:cargo/remove_dir_all","source":"GHSA-mc8h-8q98-g5hr"},{"ecosystem":"crates.io","fixed":["0.8.0"],"introduced":["0.0.0-0"],"last_affected":[],"package":"remove_dir_all","purl":"pkg:cargo/remove_dir_all","source":"RUSTSEC-2023-0018"}],"products":null,"published":"2023-02-24","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"open","licence":"CC0 1.0","name":"RustSec","prefix":"RUSTSEC"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"A race condition in the remove_dir_all crate allows attackers to trick privileged processes into deleting arbitrary files via symlink manipulation.","url":"https://insights.sbomify.com/GHSA-mc8h-8q98-g5hr/"}