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

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.

Published: 2023-08-24 Last update: 2024-11-21 Assigner: [email protected] Source: [email protected]

Conclusion & alert: CVE-2023-40030 is rated Low Risk (38.8/100): CVSS Medium severity, with low exploitation likelihood (EPSS 0.19%). Mandatory action: Monitor for updates and reassess as exploit intelligence or EPSS changes.

Risk is dynamic; we continuously reassess and refresh what is shown on this page as upstream context changes.

Exploit prediction scoring system (EPSS) score for CVE-2023-40030

EPSS lead: Daily EPSS estimates relative likelihood of exploitation; percentile ranks this CVE among scored vulnerabilities (higher = more severe relative rank).

# Date Old EPSS score New EPSS score Delta (New - Old)
1 2026-05-19 0.10% 0.19% +0.10%
2 2025-11-21 0.33% 0.10% -0.23%
3 2025-11-18 0.33%

Full EPSS history (13 records total)

Common vulnerability scoring system (CVSS) metrics for CVE-2023-40030

CVSS metrics for this CVE.

Base score Version Severity Vector Exploitability Impact Score source
6.1 3.1 MEDIUM
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N Click to expand
Attack vector (AV:N)
Could be attacked over the internet or any normal routed network—not just someone sitting at the machine.
Attack complexity (AC:L)
Once they can reach the bug, pulling it off is straightforward—no weird race conditions or rare setup.
Privileges required (PR:N)
No account or special rights needed—anonymous or random user is enough.
User interaction (UI:R)
A real person has to do something—click, install, enable—otherwise it doesn’t land.
Scope (S:C)
Breaking this can reach past the original component and bite other resources—bigger blast radius.
Confidentiality (C:L)
Some sensitive info could get out, but not a total data dump.
Integrity (I:L)
Attackers could change some data, but it’s limited—not everything goes.
Availability (A:N)
Service keeps running; no real outage angle.
2.8 2.7 [email protected]
6.1 3.1 MEDIUM
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N Click to expand
Attack vector (AV:N)
Could be attacked over the internet or any normal routed network—not just someone sitting at the machine.
Attack complexity (AC:L)
Once they can reach the bug, pulling it off is straightforward—no weird race conditions or rare setup.
Privileges required (PR:N)
No account or special rights needed—anonymous or random user is enough.
User interaction (UI:R)
A real person has to do something—click, install, enable—otherwise it doesn’t land.
Scope (S:C)
Breaking this can reach past the original component and bite other resources—bigger blast radius.
Confidentiality (C:L)
Some sensitive info could get out, but not a total data dump.
Integrity (I:L)
Attackers could change some data, but it’s limited—not everything goes.
Availability (A:N)
Service keeps running; no real outage angle.
2.8 2.7 [email protected]

Weakness enumeration for CVE-2023-40030

GitHub Security Advisory for CVE-2023-40030

GHSA-wrrj-h57r-vx9p · Severity: low · Ecosystem: rust — Malicious dependencies can inject arbitrary JavaScript into cargo-generated timing reports

OS Trackers for CVE-2023-40030

vendor priority summary link
alpine medium CVE-2023-40030: 1 source package rows (rust); 12 state rows across 7 repos (3.18-community, 3.19-main, 3.20-main, 3.21-main, 3.22-main, edge-community, edge-main); fixed 0, open 12. https://security.alpinelinux.org/vuln/CVE-2023-40030
debian not yet assigned CVE-2023-40030 not yet assigned priority: Debian including 2 source packages (cargo, rust-cargo), 7 status rows across 5 suites (bookworm, bullseye, forky, sid, trixie): open 4, resolved 3. https://security-tracker.debian.org/tracker/CVE-2023-40030
suse medium CVE-2023-40030 severity moderate: SUSE including 54 source package names (cargo, cargo-1.72.0-150400.24.24.1, …), 354 product×package rows across 23 product lines (SUSE CaaS Platform 4.0, SUSE Enterprise Storage 7, … (23 product lines)): Known Not Affected 320, Fixed 26, Will Not Fix 8. https://www.suse.com/security/cve/CVE-2023-40030/
ubuntu medium CVE-2023-40030 medium priority: Ubuntu including 2 source packages (cargo, rustc), 24 status rows across 12 suites (bionic, focal, jammy, lunar, mantic, noble, oracular, plucky, questing, trusty, upstream, xenial): DNE 8, needs-triage 5, not-affected 5, ignored 4, released 2. https://ubuntu.com/security/CVE-2023-40030

Affected software / configurations for CVE-2023-40030

Vendor Product Version Raw CPE
rust-lang rust >= 1.60.0, < 1.72.0 cpe:2.3:a:rust-lang:rust:*:*:*:*:*:*:*:*

References for CVE-2023-40030

cvelogic Threat Intelligence