Advisory Database
  • Advisories
  • Dependency Scanning
  1. cargo
  2. ›
  3. cargo
  4. ›
  5. CVE-2023-40030

CVE-2023-40030: Malicious dependencies can inject arbitrary JavaScript into cargo-generated timing reports

August 24, 2023

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

Code Behaviors & Features

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 →

Affected versions

All versions starting from 1.60.0 before 1.72

Fixed versions

  • 1.72

Solution

Upgrade to version 1.72 or above.

Weakness

  • CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Source file

cargo/cargo/CVE-2023-40030.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:15:06 +0000.