Rapid7 Vulnerability & Exploit Database

Amazon Linux AMI 2: CVE-2023-40030: Security patch for rust (ALAS-2024-2426)

Free InsightVM Trial No Credit Card Necessary
2024 Attack Intel Report Latest research by Rapid7 Labs
Back to Search

Amazon Linux AMI 2: CVE-2023-40030: Security patch for rust (ALAS-2024-2426)

Severity
4
CVSS
(AV:L/AC:M/Au:N/C:P/I:P/A:P)
Published
08/24/2023
Created
01/24/2024
Added
01/23/2024
Modified
01/23/2024

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.

Solution(s)

  • amazon-linux-ami-2-upgrade-cargo
  • amazon-linux-ami-2-upgrade-clippy
  • amazon-linux-ami-2-upgrade-rust
  • amazon-linux-ami-2-upgrade-rust-analysis
  • amazon-linux-ami-2-upgrade-rust-analyzer
  • amazon-linux-ami-2-upgrade-rust-debugger-common
  • amazon-linux-ami-2-upgrade-rust-debuginfo
  • amazon-linux-ami-2-upgrade-rust-doc
  • amazon-linux-ami-2-upgrade-rust-gdb
  • amazon-linux-ami-2-upgrade-rust-src
  • amazon-linux-ami-2-upgrade-rust-std-static
  • amazon-linux-ami-2-upgrade-rust-toolset
  • amazon-linux-ami-2-upgrade-rustfmt

insightVM

Advanced vulnerability management analytics and reporting.
Key Features
  • Lightweight Endpoint Agent
  • Live Dashboards
  • Real Risk Prioritization
  • IT-Integrated Remediation Projects
  • Cloud, Virtual, and Container Assessment
  • Integrated Threat Feeds
  • Easy-to-Use RESTful API
  • Automation-Assisted Patching
  • Automated Containment
Free InsightVM Trial View All Features

With Rapid7 live dashboards, I have a clear view of all the assets on my network, which ones can be exploited, and what I need to do in order to reduce the risk in my environment in real-time. No other tool gives us that kind of value and insight.

– Scott Cheney, Manager of Information Security, Sierra View Medical Center

;