Read the docs
TI-2023-20920 Aliases CVE-2023-40030GHSA-wrrj-h57r-vx9p

Malicious dependencies can inject arbitrary JavaScript into cargo-generated timing reports

Priority LOW 29CWE-79Published · Updated

Key facts

Attack vector
Network
Privileges required
None
User interaction
Required
Attack complexity
Low
Impact type
Cross-site scripting
Confidentiality · integrity · availability
Low · Low · None
Fix status
Fixed

Attack profile from CVSS 3.1 · CNA. Fix status from CNA and GitHub. Impact type from CWE-79.

Summary

Cargo downloads a Rust project’s dependencies and compiles the project. Starting in Rust 1.60.0 and prior to 1.72, 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 cross-site scripting if the report is subsequently uploaded somewhere. The vulnerability affects users relying on dependencies from git, local paths, or alternative registries. Users who solely depend on crates.io are unaffected. Rust 1.60.0 introduced `cargo build --timings`, which produces a report of how long the different steps of the build process took. It includes lists of Cargo features for each crate. Prior to Rust 1.72, Cargo feature names were allowed to contain almost any characters (with some exceptions as used by the feature syntax), but it would produce a future incompatibility warning about them since Rust 1.49. crates.io is far more stringent about what it considers a valid feature name and has not allowed such feature names. As the feature names were included unescaped in the timings report, they could be used to inject Javascript into the page, for example with a feature name like `features = ["<img src='' onerror=alert(0)"]`. If this report were subsequently uploaded to a domain that uses credentials, the injected Javascript could access resources from the website visitor. This issue was fixed in Rust 1.72 by turning the future incompatibility warning into an error. Users should still exercise care in which package they download, by only including trusted dependencies in their projects. Please note that even with these vulnerabilities fixed, by design Cargo allows arbitrary code execution at build time thanks to build scripts and procedural macros: a malicious dependency will be able to cause damage regardless of these vulnerabilities. crates.io has server-side checks preventing this attack, and there are no packages on crates.io exploiting these vulnerabilities. crates.io users still need to excercise care in choosing their dependencies though, as remote code execution is allowed by design there as well.

Why it matters now

Exploitation None reported CISA SSVC · not in CISA KEV
EPSS 0.00895 59th percentileScored 2026-11-07
Fix Fixed cargo (rust-lang): 1.72cargo (crates.io): 1.72

SSVC decision points

CISA ADP · SSVC 2.0.3

Exploitation
None
Automatable
No
Technical impact
Partial

The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.

Affected products

VendorProductAffected versionsFixed inStatusSource
rust-langcargo1.60.0 to before 1.721.72Patch availableCNA
—cargo (crates.io)1.60.0 to before 1.721.72Patch availableGHSA-wrrj-h57r-vx9p
  • cargo Vendorrust-lang Affected 1.60.0 to before 1.72 Fixed in 1.72 Patch available CNA
  • cargo (crates.io) Vendor— Affected 1.60.0 to before 1.72 Fixed in 1.72 Patch available GHSA-wrrj-h57r-vx9p

CPE configurations NVD · 1

CPEVersionsRoleVendor
cpe:2.3:a:rust-lang:rust:*:*:*:*:*:*:*:*1.60.0 to before 1.72.0Vulnerablerust-lang
  • cpe:2.3:a:rust-lang:rust:*:*:*:*:*:*:*:* Versions 1.60.0 to before 1.72.0 Vulnerable ·rust-lang

Remediation

  • Fix · CNA cargo (rust-lang) Fixed in 1.72
  • Fix · GHSA-wrrj-h57r-vx9p cargo (crates.io) Fixed in 1.72 Advisory →

Vendor assessments

Red Hat

Red Hat's page for this CVE →

Not affected: 1 product
  • Red Hat

Timeline

  1. 2026-10-02 Threatist record created from CVE-2023-40030
  2. 2026-10-03 Alias added: GHSA-wrrj-h57r-vx9p

References

  • TI-2024-16197 Rusts's `std::process::Command` did not properly escape arguments of batch files on Windows CVSS 3.1CRITICAL 10.0
  • TI-2024-03325 Command injection vulnerability in programing languages on Microsoft Windows operating system. CVSS 3.1CRITICAL 9.8
  • TI-2022-06036 Race condition in std::fs::remove_dir_all in rustlang CVSS 3.1HIGH 7.3
  • TI-2018-16034 The Rust Programming Language Standard Library version 1.29.0, 1.28.0, 1.27.2, 1.27.1… CVSS 3.0CRITICAL 9.8
  • TI-2021-11383 In the standard library in Rust before 1.52.0, a double free can occur in the… CVSS 3.1CRITICAL 9.8
  • TI-2021-09849 In the standard library in Rust before 1.52.0, the Zip implementation can report an… CVSS 3.1CRITICAL 9.8
See all 23 →

Sources