RUSTSEC-2022-0004

Source
https://rustsec.org/advisories/RUSTSEC-2022-0004
Import Source
https://github.com/rustsec/advisory-db/blob/osv/crates/RUSTSEC-2022-0004.json
Aliases
Published
2022-01-01T12:00:00Z
Modified
2023-11-08T04:13:48.926151Z
Details

When parsing JSON using json::Json::from_str, there is no limit to the depth of the stack, therefore deeply nested objects can cause a stack overflow, which aborts the process.

Example code that triggers the vulnerability is

fn main() {
    let _ = rustc_serialize::json::Json::from_str(&"[0,[".repeat(10000));
}

serde is recommended as a replacement to rustc_serialize.

References

Affected packages

crates.io / rustc-serialize

Package

Affected ranges

Type
SEMVER
Events
Introduced
0.0.0-0

Ecosystem specific

{
    "affects": {
        "os": [],
        "functions": [
            "rustc_serialize::json::Json::from_str"
        ],
        "arch": []
    }
}

Database specific

{
    "cvss": null,
    "informational": null,
    "categories": [
        "denial-of-service"
    ]
}