QID 354768

Date Published: 2023-02-28

QID 354768: Amazon Linux Security Advisory for rust : ALAS2-2023-1959

cargo is a package manager for the rust programming language.
After a package is downloaded, cargo extracts its source code in the ~/.cargo folder on disk, making it available to the rust projects it builds.
To reco rd when an extraction is successful, cargo writes "ok" to the .cargo-ok file at the root of the extracted source code once it extracted all the files.
It was discovered that cargo allowed packages to contain a .cargo-ok symbolic l ink, which cargo would extract.
Then, when cargo attempted to write "ok" into .cargo-ok, it would actually replace the first two bytes of the file the symlink pointed to with ok.
This would allow an attacker to corrupt one file on the machine using cargo to extract the package.
Note that by design cargo allows code execution at build time, due to build scripts and procedural macros.
The vulnerabilities in this advisory allow performing a subset of the poss ible damage in a harder to track down way.
Your dependencies must still be trusted if you want to be protected from attacks, as its possible to perform the same attacks with build scripts and procedural macros.
The vulnerability is present in all versions of cargo.
Rust 1.64, to be released on september 22nd, will include a fix for it.
Since the vulnerability is just a more limited way to accomplish what a malicious build scripts or procedural macros can do, we decided not to publish rust point releases backporting the security fix.
Patch files are available for rust 1.63.0 are available in the wg-security-response repository for people building their own toolchain.
( CVE-2022-36113) cargo is a package manager for the rust programming language.
( CVE-2022-36114)



Note: The preceding description block is extracted directly from the security advisory. Using automation, we have attempted to clean and format it as much as possible without introducing additional issues.

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

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

    CVEs related to QID 354768

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