CVE-2023-40030: Malicious dependencies can inject arbitrary JavaScript into cargo-generated timing reports
The Rust Security Response WG was notified that Cargo did not escape Cargo feature names when including them in the report generated by cargo build --timings
. A malicious package included as a dependency may inject nearly arbitrary HTML here, potentially leading to XSS if the report is subsequently uploaded somewhere.
The severity of this vulnerability is “low” for users relying on dependencies from git, local paths, or alternative registries. Users who solely depend on crates.io are unaffected.
Note that by design Cargo allows code execution at build time, due to build scripts and procedural macros. The vulnerability in this advisory allows performing a subset of the possible damage in a harder to track down way. Your dependencies must still be trusted if you want to be protected from attacks, as it’s possible to perform the same attacks with build scripts and procedural macros.
References
- github.com/advisories/GHSA-wrrj-h57r-vx9p
- github.com/rust-lang/cargo
- github.com/rust-lang/cargo/commit/9835622853f08be9a4b58ebe29dcec8f43b64b33
- github.com/rust-lang/cargo/commit/f975722a0eac934c0722f111f107c4ea2f5c4365
- github.com/rust-lang/cargo/security/advisories/GHSA-wrrj-h57r-vx9p
- nvd.nist.gov/vuln/detail/CVE-2023-40030
Detect and mitigate CVE-2023-40030 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →