QID 357011

Date Published: 2024-02-05

QID 357011: Amazon Linux Security Advisory for rust : ALAS2-2024-2426

cargo downloads a rust projects 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.
( CVE-2023-40030)



Note: The preceding description block is extracted directly from the security advisory.

Successful exploitation of this vulnerability could lead to a securitybreach or could affect integrity, availability, and confidentiality.

  • CVSS V3 rated as High - 6.1 severity.
  • CVSS V2 rated as Medium - 5.4 severity.
  • Solution
    Please refer to Amazon advisory: ALAS2-2024-2426 for affected packages and patching details, or update with your package manager.
    Vendor References

    CVEs related to QID 357011

    Software Advisories
    Advisory ID Software Component Link
    ALAS2-2024-2426 amazon linux 2 URL Logo alas.aws.amazon.com/AL2/ALAS-2024-2426.html