UBUNTU-CVE-2023-40030

Source
https://ubuntu.com/security/CVE-2023-40030
Import Source
https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2023/UBUNTU-CVE-2023-40030.json
JSON Data
https://api.osv.dev/v1/vulns/UBUNTU-CVE-2023-40030
Related
Published
2023-08-24T23:15:00Z
Modified
2025-01-13T10:24:23Z
Severity
  • 6.1 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N CVSS Calculator
Summary
[none]
Details

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.

References

Affected packages

Ubuntu:Pro:16.04:LTS / cargo

Package

Name
cargo
Purl
pkg:deb/ubuntu/cargo@0.47.0-1~exp1ubuntu1~16.04.1+esm1?arch=source&distro=esm-apps/xenial

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected

Affected versions

0.*

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
0.23.0-0ubuntu0.16.04.1
0.25.0-1ubuntu1~16.04.1
0.26.0-0ubuntu2~16.04.1
0.29.0-1ubuntu1~16.04.1
0.31.0-3ubuntu1~16.04.1
0.32.0-1~exp1ubuntu1~16.04.1
0.33.0-1ubuntu1~16.04.1
0.35.0-0ubuntu1~16.04.1
0.36.0-0ubuntu1~16.04.1
0.37.0-3ubuntu1~16.04.1
0.38.0-0ubuntu1~16.04.1
0.40.0-3ubuntu1~16.04.1
0.42.0-0ubuntu1~16.04.1
0.44.1-0ubuntu1~16.04.1
0.47.0-1~exp1ubuntu1~16.04.1
0.47.0-1~exp1ubuntu1~16.04.1+esm1

Ecosystem specific

{
    "ubuntu_priority": "medium"
}

Ubuntu:Pro:18.04:LTS / cargo

Package

Name
cargo
Purl
pkg:deb/ubuntu/cargo@0.66.0+ds0ubuntu0.libgit2-0ubuntu0.18.04.1~esm1?arch=source&distro=esm-apps/bionic

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected

Affected versions

0.*

0.19.0-0ubuntu1
0.22.0-0ubuntu1
0.22.0-0ubuntu2
0.23.0-0ubuntu1
0.24.0-1ubuntu1
0.25.0-1ubuntu1
0.26.0-0ubuntu1
0.26.0-0ubuntu2
0.29.0-1ubuntu1~18.04.1
0.31.0-3ubuntu1~18.04.4
0.32.0-1~exp1ubuntu1~18.04.1
0.33.0-1ubuntu1~18.04.1
0.35.0-0ubuntu1~18.04.1
0.36.0-0ubuntu1~18.04.1
0.37.0-3ubuntu1~18.04.1
0.38.0-0ubuntu1~18.04.1
0.40.0-3ubuntu1~18.04.1
0.42.0-0ubuntu1~18.04.1
0.44.1-0ubuntu1~18.04.1
0.47.0-1~exp1ubuntu1~18.04.1
0.52.0-0ubuntu1~18.04.1
0.54.0-0ubuntu1~18.04.1
0.58.0-0ubuntu1~18.04.1
0.60.0ubuntu1-0ubuntu1~18.04.1
0.62.0ubuntu0libgit2-0ubuntu0.18.04.1
0.66.0+ds0ubuntu0.libgit2-0ubuntu0.18.04
0.66.0+ds0ubuntu0.libgit2-0ubuntu0.18.04.1~esm1

Ecosystem specific

{
    "ubuntu_priority": "medium"
}

Ubuntu:20.04:LTS / cargo

Package

Name
cargo
Purl
pkg:deb/ubuntu/cargo@0.67.1+ds0ubuntu0.libgit2-0ubuntu0.20.04.2?arch=source&distro=focal

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected

Affected versions

0.*

0.37.0-3ubuntu2
0.38.0-0ubuntu1
0.39.0-0ubuntu1
0.39.0+really0.38.0-0ubuntu1
0.39.0+really0.39.0-0ubuntu1
0.40.0-3ubuntu1
0.40.0-3ubuntu2
0.41.0-0ubuntu1
0.42.0-0ubuntu1
0.44.1-0ubuntu1~20.04.1
0.47.0-1~exp1ubuntu1~20.04.1
0.52.0-0ubuntu1~20.04.1
0.54.0-0ubuntu1~20.04.1
0.58.0-0ubuntu1~20.04.1
0.60.0ubuntu1-0ubuntu1~20.04.1
0.62.0ubuntu0libgit2-0ubuntu0.20.04.1
0.66.0+ds0ubuntu0.libgit2-0ubuntu0.20.04
0.67.1+ds0ubuntu0.libgit2-0ubuntu0.20.04.2

Ecosystem specific

{
    "ubuntu_priority": "medium"
}

Ubuntu:22.04:LTS / cargo

Package

Name
cargo
Purl
pkg:deb/ubuntu/cargo@0.67.1+ds0ubuntu0.libgit2-0ubuntu0.22.04.2?arch=source&distro=jammy

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected

Affected versions

0.*

0.52.0-0ubuntu1
0.53.0-0ubuntu2
0.54.0-0ubuntu1
0.54.0-0ubuntu2
0.57.0+ubuntu-0ubuntu1
0.58.0-0ubuntu1
0.60.0ubuntu1-0ubuntu1~22.04.1
0.62.0ubuntu0libgit2-0ubuntu0.22.04.1
0.66.0+ds0ubuntu0.libgit2-0ubuntu0.22.04
0.67.1+ds0ubuntu0.libgit2-0ubuntu0.22.04.2

Ecosystem specific

{
    "ubuntu_priority": "medium"
}

Ubuntu:24.04:LTS / rustc

Package

Name
rustc
Purl
pkg:deb/ubuntu/rustc@1.73.0+dfsg0ubuntu1-0ubuntu1?arch=source&distro=noble

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
1.73.0+dfsg0ubuntu1-0ubuntu1

Affected versions

1.*

1.71.1+dfsg0ubuntu2-0ubuntu1

Ecosystem specific

{
    "availability": "No subscription required",
    "ubuntu_priority": "medium",
    "binaries": [
        {
            "binary_version": "1.73.0+dfsg0ubuntu1-0ubuntu1",
            "binary_name": "cargo"
        },
        {
            "binary_version": "1.73.0+dfsg0ubuntu1-0ubuntu1",
            "binary_name": "cargo-dbgsym"
        },
        {
            "binary_version": "1.73.0+dfsg0ubuntu1-0ubuntu1",
            "binary_name": "cargo-doc"
        },
        {
            "binary_version": "1.73.0+dfsg0ubuntu1-0ubuntu1",
            "binary_name": "libstd-rust-1.73"
        },
        {
            "binary_version": "1.73.0+dfsg0ubuntu1-0ubuntu1",
            "binary_name": "libstd-rust-1.73-dbgsym"
        },
        {
            "binary_version": "1.73.0+dfsg0ubuntu1-0ubuntu1",
            "binary_name": "libstd-rust-dev"
        },
        {
            "binary_version": "1.73.0+dfsg0ubuntu1-0ubuntu1",
            "binary_name": "rust-all"
        },
        {
            "binary_version": "1.73.0+dfsg0ubuntu1-0ubuntu1",
            "binary_name": "rust-clippy"
        },
        {
            "binary_version": "1.73.0+dfsg0ubuntu1-0ubuntu1",
            "binary_name": "rust-clippy-dbgsym"
        },
        {
            "binary_version": "1.73.0+dfsg0ubuntu1-0ubuntu1",
            "binary_name": "rust-doc"
        },
        {
            "binary_version": "1.73.0+dfsg0ubuntu1-0ubuntu1",
            "binary_name": "rust-gdb"
        },
        {
            "binary_version": "1.73.0+dfsg0ubuntu1-0ubuntu1",
            "binary_name": "rust-lldb"
        },
        {
            "binary_version": "1.73.0+dfsg0ubuntu1-0ubuntu1",
            "binary_name": "rust-src"
        },
        {
            "binary_version": "1.73.0+dfsg0ubuntu1-0ubuntu1",
            "binary_name": "rustc"
        },
        {
            "binary_version": "1.73.0+dfsg0ubuntu1-0ubuntu1",
            "binary_name": "rustc-dbgsym"
        },
        {
            "binary_version": "1.73.0+dfsg0ubuntu1-0ubuntu1",
            "binary_name": "rustfmt"
        },
        {
            "binary_version": "1.73.0+dfsg0ubuntu1-0ubuntu1",
            "binary_name": "rustfmt-dbgsym"
        }
    ]
}