CVE-2023-40030 Malicious dependencies can inject arbitrary JavaScript into cargo-generated timing reports
- Published
- Updated
- Exploit status
- No public exploit known
- CISA SSVC
- No known exploitation · automatable: no · technical impact: partial
- Technology
- UbuntuDebian
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.
Upgrade path
13 packages: 5 fixed, 7 with no fix yet.
| Package | Affected | Fixed in | Status |
|---|---|---|---|
| debian/cargo(Debian 12) | = 0.66.0+ds1-1; = 0.66.0+ds2-1; = 0.66.0+ds2-2; = 0.70.1+ds1-1 +5 more | No fix listed | No fix yet |
| debian/rust-cargo(Debian 12) | = 0.66.0-1; = 0.66.0-2; = 0.66.0-3; = 0.66.0-4 +30 more | No fix listed | No fix yet |
| ubuntu/cargo(Ubuntu 22.04) | All versions | No fix listed | No fix yet |
| ubuntu/cargo(Ubuntu Pro 16.04) | = 0.8.0-1; = 0.16.0-0ubuntu1~16.04.1; = 0.18.0-0ubuntu0.16.04.1; = 0.22.0-0ubuntu0.16.04.1 +17 more | No fix listed | No fix yet |
| ubuntu/cargo(Ubuntu Pro 18.04) | = 0.19.0-0ubuntu1; = 0.22.0-0ubuntu1; = 0.22.0-0ubuntu2; = 0.23.0-0ubuntu1 +24 more | No fix listed | No fix yet |
| ubuntu/cargo(Ubuntu Pro 20.04) | = 0.37.0-3ubuntu2; = 0.38.0-0ubuntu1; = 0.39.0+really0.38.0-0ubuntu1; = 0.39.0+really0.39.0-0ubuntu1 +16 more | No fix listed | No fix yet |
| ubuntu/cargo(Ubuntu Pro 22.04) | = 0.52.0-0ubuntu1; = 0.53.0-0ubuntu2; = 0.54.0-0ubuntu1; = 0.54.0-0ubuntu2 +8 more | No fix listed | No fix yet |
| crates.io cargo(crates.io) | >= 1.60.0, < 1.72 | 1.72 | Fixed |
| debian/rust-cargo(Debian 13) | < 0.76.0-1 | 0.76.0-1 | Fixed |
| debian/rust-cargo(Debian 14) | < 0.76.0-1 | 0.76.0-1 | Fixed |
| rust-lang rust | >= 1.60.0, < 1.72.0 | 1.72.0 | Fixed |
| ubuntu/rustc(Ubuntu 24.04) | < 1.73.0+dfsg0ubuntu1-0ubuntu1; = 1.71.1+dfsg0ubuntu2-0ubuntu1 | 1.73.0+dfsg0ubuntu1-0ubuntu1 | Fixed |
| rust-lang cargo | = >= 1.60.0, < 1.72 | No fix listed | Versions listed |
Affected products
| Product | Affected versions | Fixed in |
|---|---|---|
| crates.io cargo(crates.io) | >= 1.60.0, < 1.72 | 1.72 |
| debian/cargo(Debian:12) | All versions | No fix listed |
| debian/cargo(Debian:12) | = 0.66.0+ds1-1 | No fix listed |
| debian/cargo(Debian:12) | = 0.66.0+ds2-1 | No fix listed |
| debian/cargo(Debian:12) | = 0.66.0+ds2-2 | No fix listed |
| debian/cargo(Debian:12) | = 0.70.1+ds1-1 | No fix listed |
| debian/cargo(Debian:12) | = 0.70.1+ds1-1~exp1 | No fix listed |
| debian/cargo(Debian:12) | = 0.70.1+ds1-2 | No fix listed |
| debian/cargo(Debian:12) | = 0.70.1+ds1-3 | No fix listed |
| debian/cargo(Debian:12) | = 0.70.1-1~exp1 | No fix listed |
| debian/rust-cargo(Debian:12) | All versions | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.66.0-1 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.66.0-2 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.66.0-3 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.66.0-4 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.66.0-5 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.66.0-6 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.70.1-1 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.70.1-2 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.70.1-3 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.76.0-1 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.76.0-2 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.76.0-3 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.76.0-4 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.81.0-1 | No fix listed |
Show 107 more
| Product | Affected versions | Fixed in |
|---|---|---|
| debian/rust-cargo(Debian:12) | = 0.81.0-2 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.81.0-3 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.82.0-1 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.83.0-1 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.83.0-2 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.84.0-1 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.85.0-1 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.86.0-1 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.86.0-2 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.86.0-3 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.86.0-4 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.91.0-1 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.91.0-2 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.91.0-3 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.91.0-4 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.91.0-5 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.96.0-1 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.96.0-2 | No fix listed |
| debian/rust-cargo(Debian:12) | = 0.99.0-1 | No fix listed |
| debian/rust-cargo(Debian:13) | < 0.76.0-1 | 0.76.0-1 |
| debian/rust-cargo(Debian:14) | < 0.76.0-1 | 0.76.0-1 |
| rust-lang cargo | = >= 1.60.0, < 1.72 | No fix listed |
| ubuntu/cargo(Ubuntu:22.04) | All versions | No fix listed |
| ubuntu/rustc(Ubuntu:24.04) | < 1.73.0+dfsg0ubuntu1-0ubuntu1 | 1.73.0+dfsg0ubuntu1-0ubuntu1 |
| rust-lang rust | >= 1.60.0, < 1.72.0 | 1.72.0 |
| ubuntu/cargo(Ubuntu:Pro:16.04) | All versions | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:16.04) | = 0.8.0-1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:16.04) | = 0.16.0-0ubuntu1~16.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:16.04) | = 0.18.0-0ubuntu0.16.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:16.04) | = 0.22.0-0ubuntu0.16.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:16.04) | = 0.23.0-0ubuntu0.16.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:16.04) | = 0.25.0-1ubuntu1~16.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:16.04) | = 0.26.0-0ubuntu2~16.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:16.04) | = 0.29.0-1ubuntu1~16.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:16.04) | = 0.31.0-3ubuntu1~16.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:16.04) | = 0.32.0-1~exp1ubuntu1~16.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:16.04) | = 0.33.0-1ubuntu1~16.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:16.04) | = 0.35.0-0ubuntu1~16.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:16.04) | = 0.36.0-0ubuntu1~16.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:16.04) | = 0.37.0-3ubuntu1~16.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:16.04) | = 0.38.0-0ubuntu1~16.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:16.04) | = 0.40.0-3ubuntu1~16.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:16.04) | = 0.42.0-0ubuntu1~16.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:16.04) | = 0.44.1-0ubuntu1~16.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:16.04) | = 0.47.0-1~exp1ubuntu1~16.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:16.04) | = 0.47.0-1~exp1ubuntu1~16.04.1+esm1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | All versions | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.19.0-0ubuntu1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.22.0-0ubuntu1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.22.0-0ubuntu2 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.23.0-0ubuntu1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.24.0-1ubuntu1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.25.0-1ubuntu1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.26.0-0ubuntu1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.26.0-0ubuntu2 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.29.0-1ubuntu1~18.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.31.0-3ubuntu1~18.04.4 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.32.0-1~exp1ubuntu1~18.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.33.0-1ubuntu1~18.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.35.0-0ubuntu1~18.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.36.0-0ubuntu1~18.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.37.0-3ubuntu1~18.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.38.0-0ubuntu1~18.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.40.0-3ubuntu1~18.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.42.0-0ubuntu1~18.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.44.1-0ubuntu1~18.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.47.0-1~exp1ubuntu1~18.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.52.0-0ubuntu1~18.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.54.0-0ubuntu1~18.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.58.0-0ubuntu1~18.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.60.0ubuntu1-0ubuntu1~18.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.62.0ubuntu0libgit2-0ubuntu0.18.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.66.0+ds0ubuntu0.libgit2-0ubuntu0.18.04 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:18.04) | = 0.66.0+ds0ubuntu0.libgit2-0ubuntu0.18.04.1~esm1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:20.04) | All versions | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:20.04) | = 0.37.0-3ubuntu2 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:20.04) | = 0.38.0-0ubuntu1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:20.04) | = 0.39.0-0ubuntu1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:20.04) | = 0.39.0+really0.38.0-0ubuntu1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:20.04) | = 0.39.0+really0.39.0-0ubuntu1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:20.04) | = 0.40.0-3ubuntu1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:20.04) | = 0.40.0-3ubuntu2 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:20.04) | = 0.41.0-0ubuntu1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:20.04) | = 0.42.0-0ubuntu1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:20.04) | = 0.44.1-0ubuntu1~20.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:20.04) | = 0.47.0-1~exp1ubuntu1~20.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:20.04) | = 0.52.0-0ubuntu1~20.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:20.04) | = 0.54.0-0ubuntu1~20.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:20.04) | = 0.58.0-0ubuntu1~20.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:20.04) | = 0.60.0ubuntu1-0ubuntu1~20.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:20.04) | = 0.62.0ubuntu0libgit2-0ubuntu0.20.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:20.04) | = 0.66.0+ds0ubuntu0.libgit2-0ubuntu0.20.04 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:20.04) | = 0.67.1+ds0ubuntu0.libgit2-0ubuntu0.20.04.2 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:20.04) | = 0.67.1+ds0ubuntu0.libgit2-0ubuntu0.20.04.2+esm1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:22.04) | All versions | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:22.04) | = 0.52.0-0ubuntu1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:22.04) | = 0.53.0-0ubuntu2 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:22.04) | = 0.54.0-0ubuntu1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:22.04) | = 0.54.0-0ubuntu2 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:22.04) | = 0.57.0+ubuntu-0ubuntu1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:22.04) | = 0.58.0-0ubuntu1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:22.04) | = 0.60.0ubuntu1-0ubuntu1~22.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:22.04) | = 0.62.0ubuntu0libgit2-0ubuntu0.22.04.1 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:22.04) | = 0.66.0+ds0ubuntu0.libgit2-0ubuntu0.22.04 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:22.04) | = 0.67.1+ds0ubuntu0.libgit2-0ubuntu0.22.04.2 | No fix listed |
| ubuntu/cargo(Ubuntu:Pro:22.04) | = 0.67.1+ds0ubuntu0.libgit2-0ubuntu0.22.04.2+esm1 | No fix listed |
| ubuntu/rustc(Ubuntu:24.04) | = 1.71.1+dfsg0ubuntu2-0ubuntu1 | No fix listed |
References
- https://github.com/rust-lang/cargo/security/advisories/GHSA-wrrj-h57r-vx9p issue-tracking vendor-advisory
- https://github.com/rust-lang/cargo/commit/9835622853f08be9a4b58ebe29dcec8f43b64b33 issue-tracking patch
- https://github.com/rust-lang/cargo/commit/f975722a0eac934c0722f111f107c4ea2f5c4365 issue-tracking patch
- github.com product
- Debian Security Tracker CVE-2023-40030 vendor-advisory
- github.com
- https://github.com/rust-lang/cargo/pull/12291 issue-tracking patch
- Ubuntu CVE tracker issue-tracking vendor-advisory
- www.cve.org issue-tracking
- bugs.debian.org issue-tracking
- bugs.debian.org issue-tracking