cve.bz

CVE-2023-40030 rust-lang rust: Cross-site Scripting

6.1 mediumEPSS 0.9%Fix available

Medium (6.1) in rust-lang rust. EPSS 0.9% estimated probability of exploitation activity in the next 30 days. Fixed in cargo 1.72.

On this page
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.

Severity

CVSS 3.1

6.1 medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
EPSS
0.9% (unchanged from 0.9% a week ago; 0.9% 30 days ago) estimated probability of exploitation activity in the next 30 days; 60th percentile. Scored 2026-11-21. A forecast for this CVE across the internet, not for your own systems.
CISA's assessment (SSVC)
Exploitation: none · Automatable: no · Technical impact: partial, assessed 2024-09-30. From CISA's Vulnrichment in the CVE List: whether it is exploited, whether exploiting it can be automated, and how much control it gives.
CWE
CWE-79 Improper Neutralization of Input During Web Page Generation (Cross-site Scripting)
OWASP Top 10
A05:2025 Injection
Published
Modified
NVD analysis
Analyzed, since modified
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2023-40030 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2023-40030?via=ask-ai-copy and https://cve.bz/cve/CVE-2023-40030?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2023-40030 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the NVD's CPE matches.

ProductAffected
rust-lang:rustfrom 1.60.0 before 1.72.0

Packages (OSV)

AdvisoryEcosystemPackageAffectedFixed in
GHSA-wrrj-h57r-vx9pcrates.iocargo>=1.60.0 <1.721.72

Linux distributions

DistributionReleasePackageFixed inAdvisory
Debian12cargo, rust-cargono fix listedDEBIAN-CVE-2023-40030
Debian13, 14rust-cargo0.76.0-1DEBIAN-CVE-2023-40030
Ubuntu24.04:LTSrustc1.73.0+dfsg0ubuntu1-0ubuntu1UBUNTU-CVE-2023-40030
UbuntuPro:16.04:LTS, Pro:18.04:LTS, Pro:20.04:LTS and 1 morecargono fix listedUBUNTU-CVE-2023-40030
SUSELinux Enterprise Module for Development Tools 15 SP4, Linux Enterprise Module for Development Tools 15 SP5rust1.72.0-150400.24.24.1SUSE-SU-2023:3722-1
SUSELinux Enterprise Module for Development Tools 15 SP4, Linux Enterprise Module for Development Tools 15 SP5rust1.721.72.0-150400.9.3.1SUSE-SU-2023:3722-1
openSUSELeap 15.4, Leap 15.5rust1.72.0-150400.24.24.1SUSE-SU-2023:3722-1
openSUSELeap 15.4, Leap 15.5rust1.721.72.0-150400.9.3.1SUSE-SU-2023:3722-1
openSUSETumbleweedrust1.721.72.1-1.1openSUSE-SU-2024:13262-1
Azure Linux2rust1.72.0-2AZL-28511
Alpaquita23rustno fix listedBELL-CVE-2023-40030
Alpaquitastreamrust1.72.0-r1BELL-CVE-2023-40030

From the distributions' data via OSV.dev: the Debian Security Tracker; Ubuntu Security Notices © Canonical Ltd., CC BY-SA 4.0; SUSE security data, CC BY 4.0; Microsoft's Azure Linux vulnerability data, MIT; BellSoft's OSV database, MIT. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Debian · Ubuntu · SUSE · openSUSE · Alpaquita.

Attack patterns (CAPEC)

  • CAPEC-63 Cross-Site Scripting (XSS) Likelihood: High · Severity: Very High
  • CAPEC-85 AJAX Footprinting Likelihood: High · Severity: Low
  • CAPEC-209 XSS Using MIME Type Mismatch Severity: Medium
  • CAPEC-588 DOM-Based XSS Likelihood: High · Severity: Very High
  • CAPEC-591 Reflected XSS Likelihood: High · Severity: Very High
  • CAPEC-592 Stored XSS Likelihood: High · Severity: Very High

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits.

References

Check your stackJSON