CVE-2023-40030
Last modified
CVE-2023-40030 is a medium-severity vulnerability rated 6.1/10 on the CVSS scale. 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`. EPSS estimates a 0.85% chance of exploitation in the next 30 days.
Description
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.
Metrics
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Weakness Enumeration
Affected Software
| Vendor | Product | Versions |
|---|---|---|
| Rust-Lang | Rust | >= 1.60.0, < 1.72.0 |
References
- https://github.com/rust-lang/cargo/pull/12291Issue Tracking, Patch
- https://github.com/rust-lang/cargo/pull/12291Issue Tracking, Patch
Timeline
- Published
- Last Modified
- Status
- Modified
Frequently Asked Questions
What is CVE-2023-40030?
How severe is CVE-2023-40030?
How do I fix CVE-2023-40030?
How Strix Helps
- How Strix found a critical auth bypass in etcdStrix autonomously discovered a critical authentication bypass in etcd, later designated CVE-2026-33413.
- Autonomous PentestingAI agents that find and validate exploitable vulnerabilities like this one across your applications.
- PR ReviewsPentest every pull request so vulnerable code is caught before it ships to production.
- AI Penetration TestingHow AI-driven penetration testing continuously covers your attack surface.
Related CVEs from 2023
- CVE-2023-40025Argo CD is a declarative, GitOps continuous delivery tool fo…7.1
- CVE-2023-40026Argo CD is a declarative continuous deployment framework for…4.3
- CVE-2023-40027Keystone is an open source headless CMS for Node.js — built …5.3
- CVE-2023-40028Ghost is an open source content management system. Versions …6.5
- CVE-2023-40029Argo CD is a declarative continuous deployment for Kubernete…9.6
- CVE-2023-4003 One Identity Password Manager version 5.9.7.1 - An unauthen…6.8
- CVE-2023-40031Notepad++ is a free and open-source source code editor. Vers…7.8
- CVE-2023-40032libvips is a demand-driven, horizontally threaded image proc…5.5
- CVE-2023-40033Flarum is an open source forum software. Flarum is affected …7.1
- CVE-2023-40034Woodpecker is a community fork of the Drone CI system. In af…8.1
- CVE-2023-40035Craft is a CMS for creating custom digital experiences on th…7.2
- CVE-2023-40036Notepad++ is a free and open-source source code editor. Vers…5.5
Are you affected by CVE-2023-40030?
Run a free Strix scan to check your systems for this vulnerability.
Scan your code nowSource: NVD / NIST
