CVE catalog

CVE-2023-40030

cargo: CVE-2023-40030

[CVE catalog]

Severity
Medium · CVSS 6.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Published
Source
[NVD] · [CVE record]
EPSS
0.90% · Oct 27, 2026

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.

Vulnerable and fixed packages

Distribution-reported package versions and fixes. These do not depend on matching against the OpenFactory package catalog.

DistributionPackageReleaseVersionStatus
Debiancargobookworm0.66.0+ds1-1vulnerable
Debianrust-cargosid0.99.0-1fixed
Debianrust-cargoforky0.99.0-1fixed
Debianrust-cargotrixie0.86.0-2fixed
Debianrust-cargobookworm0.66.0-1vulnerable
Ubuntucargopro0.52.0-0ubuntu1vulnerable
Ubuntucargopro0.53.0-0ubuntu2vulnerable
Ubuntucargopro0.54.0-0ubuntu1vulnerable
Ubuntucargopro0.54.0-0ubuntu2vulnerable
Ubuntucargopro0.57.0+ubuntu-0ubuntu1vulnerable
Ubuntucargopro0.58.0-0ubuntu1vulnerable
Ubuntucargopro0.60.0ubuntu1-0ubuntu1~22.04.1vulnerable
Ubuntucargopro0.62.0ubuntu0libgit2-0ubuntu0.22.04.1vulnerable
Ubuntucargopro0.66.0+ds0ubuntu0.libgit2-0ubuntu0.22.04vulnerable
Ubuntucargopro0.67.1+ds0ubuntu0.libgit2-0ubuntu0.22.04.2vulnerable
Ubuntucargopro0.67.1+ds0ubuntu0.libgit2-0ubuntu0.22.04.2+esm1vulnerable
Ubunturustc24.041.71.1+dfsg0ubuntu2-0ubuntu1vulnerable
Ubunturustc24.041.73.0+dfsg0ubuntu1-0ubuntu1fixed
Opensuserust1.72tumbleweed1.72.1-1.1fixed
Suserustlinux enterprise module for development tools 15 sp41.72.0-150400.24.24.1fixed
Suserust1.72linux enterprise module for development tools 15 sp41.72.0-150400.9.3.1fixed
Suserustlinux enterprise module for development tools 15 sp51.72.0-150400.24.24.1fixed
Suserust1.72linux enterprise module for development tools 15 sp51.72.0-150400.9.3.1fixed
Opensuserustleap 15.41.72.0-150400.24.24.1fixed
Opensuserust1.72leap 15.41.72.0-150400.9.3.1fixed
Opensuserustleap 15.51.72.0-150400.24.24.1fixed
Opensuserust1.72leap 15.51.72.0-150400.9.3.1fixed

Fixed-version evidence

DistributionPackageTypeReleaseFixed versionUrgencyOriginBugs
Debiancargosourcebookworm(unfixed)not yet assignedNot reported[1059305]
Debianrust-cargosourcesid0.76.0-1not yet assignedNot reported[1059306]
Debianrust-cargosourceforky0.76.0-1not yet assignedNot reported[1059306]
Debianrust-cargosourcetrixie0.76.0-1not yet assignedNot reported[1059306]
Debianrust-cargosourcebookworm(unfixed)not yet assignedNot reported[1059306]
Ubunturustcdeb24.041.73.0+dfsg0ubuntu1-0ubuntu1Not reportedUBUNTU-CVE-2023-40030Not reported
Opensuserust1.72rpmtumbleweed1.72.1-1.1Not reportedOPENSUSE-SU-2024:13262-1Not reported
Suserustrpmlinux enterprise module for development tools 15 sp41.72.0-150400.24.24.1Not reportedSUSE-SU-2023:3722-1Not reported
Suserust1.72rpmlinux enterprise module for development tools 15 sp41.72.0-150400.9.3.1Not reportedSUSE-SU-2023:3722-1Not reported
Suserustrpmlinux enterprise module for development tools 15 sp51.72.0-150400.24.24.1Not reportedSUSE-SU-2023:3722-1Not reported
Suserust1.72rpmlinux enterprise module for development tools 15 sp51.72.0-150400.9.3.1Not reportedSUSE-SU-2023:3722-1Not reported
Opensuserustrpmleap 15.41.72.0-150400.24.24.1Not reportedSUSE-SU-2023:3722-1Not reported
Opensuserust1.72rpmleap 15.41.72.0-150400.9.3.1Not reportedSUSE-SU-2023:3722-1Not reported
Opensuserustrpmleap 15.51.72.0-150400.24.24.1Not reportedSUSE-SU-2023:3722-1Not reported
Opensuserust1.72rpmleap 15.51.72.0-150400.9.3.1Not reportedSUSE-SU-2023:3722-1Not reported

[Debian bug #1059305][Debian bug #1059306]

Notes

[bookworm] cargo: Minor issue [bookworm] rust-cargo: Minor issue

OpenFactory catalog packages

[Debian 12 (Bookworm)]

  • [cargo]Affected
    Details (2)
    • 0.66.0+ds1-1 · amd64 · bookworm

      Affected

      dsa · cargo · debian · bookworm; dsa · cargo · debian · 12

    • 0.66.0+ds1-1 · arm64 · bookworm

      Affected

      dsa · cargo · debian · bookworm; dsa · cargo · debian · 12

  • [cargo-doc]Affected

    Source package: [cargo]

    Details (2)
    • 0.66.0+ds1-1 · all · bookworm

      Affected

      dsa · cargo · debian · bookworm; dsa · cargo · debian · 12

    • 0.66.0+ds1-1 · all · bookworm

      Affected

      dsa · cargo · debian · bookworm; dsa · cargo · debian · 12

  • Source package: [rust-cargo]

    Details (2)
    • 0.66.0-1 · amd64 · bookworm

      Affected

      dsa · rust-cargo · debian · bookworm; dsa · rust-cargo · debian · 12

    • 0.66.0-1 · arm64 · bookworm

      Affected

      dsa · rust-cargo · debian · bookworm; dsa · rust-cargo · debian · 12

[Debian 13 (Trixie)]

  • Source package: [rust-cargo]

    Details (2)
    • 0.86.0-2 · amd64 · trixie

      Fixed · Fixed: 0.76.0-1

      dsa · rust-cargo · debian · 13

    • 0.86.0-2 · arm64 · trixie

      Fixed · Fixed: 0.76.0-1

      dsa · rust-cargo · debian · 13

Observed:

References