CVE-2023-38497 – Cargo not respecting umask when extracting crate archives
https://notcve.org/view.php?id=CVE-2023-38497
Cargo downloads the Rust project’s dependencies and compiles the project. Cargo prior to version 0.72.2, bundled with Rust prior to version 1.71.1, did not respect the umask when extracting crate archives on UNIX-like systems. If the user downloaded a crate containing files writeable by any local user, another local user could exploit this to change the source code compiled and executed by the current user. To prevent existing cached extractions from being exploitable, the Cargo binary version 0.72.2 included in Rust 1.71.1 or later will purge caches generated by older Cargo versions automatically. As a workaround, configure one's system to prevent other local users from accessing the Cargo directory, usually located in `~/.cargo`. • https://en.wikipedia.org/wiki/Umask https://github.com/rust-lang/cargo/commit/d78bbf4bde3c6b95caca7512f537c6f9721426ff https://github.com/rust-lang/cargo/pull/12443 https://github.com/rust-lang/cargo/security/advisories/GHSA-j3xp-wfr4-hx87 https://github.com/rust-lang/wg-security-response/tree/main/patches/CVE-2023-38497 https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QGKE6PGM4HIQUHPJRBQAHMELINSGN4H4 https://lists.fedoraproject.org/archives/list/package-announce@lists.f • CWE-276: Incorrect Default Permissions CWE-278: Insecure Preserved Inherited Permissions CWE-732: Incorrect Permission Assignment for Critical Resource •
CVE-2022-46176 – Cargo did not verify SSH host keys
https://notcve.org/view.php?id=CVE-2022-46176
Cargo is a Rust package manager. The Rust Security Response WG was notified that Cargo did not perform SSH host key verification when cloning indexes and dependencies via SSH. An attacker could exploit this to perform man-in-the-middle (MITM) attacks. This vulnerability has been assigned CVE-2022-46176. All Rust versions containing Cargo before 1.66.1 are vulnerable. • http://www.openwall.com/lists/oss-security/2023/11/05/6 http://www.openwall.com/lists/oss-security/2023/11/06/5 https://github.com/rust-lang/cargo/security/advisories/GHSA-r5w3-xm58-jv6j https://github.com/rust-lang/wg-security-response/tree/main/patches/CVE-2022-46176 • CWE-347: Improper Verification of Cryptographic Signature •
CVE-2022-36114 – Extracting malicious crates can fill the file system
https://notcve.org/view.php?id=CVE-2022-36114
Cargo is a package manager for the rust programming language. It was discovered that Cargo did not limit the amount of data extracted from compressed archives. An attacker could upload to an alternate registry a specially crafted package that extracts way more data than its size (also known as a "zip bomb"), exhausting the disk space on the machine using Cargo to download the package. Note that by design Cargo allows code execution at build time, due to build scripts and procedural macros. The vulnerabilities in this advisory allow performing a subset of the possible damage in a harder to track down way. • https://github.com/rust-lang/cargo/commit/d1f9553c825f6d7481453be8d58d0e7f117988a7 https://github.com/rust-lang/cargo/security/advisories/GHSA-2hvr-h6gw-qrxp • CWE-400: Uncontrolled Resource Consumption •
CVE-2022-36113 – Extracting malicious crates can corrupt arbitrary files
https://notcve.org/view.php?id=CVE-2022-36113
Cargo is a package manager for the rust programming language. After a package is downloaded, Cargo extracts its source code in the ~/.cargo folder on disk, making it available to the Rust projects it builds. To record when an extraction is successful, Cargo writes "ok" to the .cargo-ok file at the root of the extracted source code once it extracted all the files. It was discovered that Cargo allowed packages to contain a .cargo-ok symbolic link, which Cargo would extract. Then, when Cargo attempted to write "ok" into .cargo-ok, it would actually replace the first two bytes of the file the symlink pointed to with ok. • https://github.com/rust-lang/cargo/commit/97b80919e404b0768ea31ae329c3b4da54bed05a https://github.com/rust-lang/cargo/security/advisories/GHSA-rfj2-q3h3-hm5j • CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') CWE-59: Improper Link Resolution Before File Access ('Link Following') •