GHSA-2226-4v3c-cff8: Rustc serialize Stack Overflow Vulnerability
MODERATEGHSA-2226-4v3c-cff8 is a MODERATE stack overflow vulnerability (General Security Weakness) affecting Rustc serialize libraries in the crates.io ecosystem. The issue involves stack overflow in rustc_serialize when parsing deeply nested json. Remediation is available in the latest vendor maintenance releases.
GHSA-2226-4v3c-cff8 at a Glance
How to Fix GHSA-2226-4v3c-cff8
To remediate this vulnerability, upgrade all affected Rustc serialize dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade rustc-serialize to Latest secure release
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for rustc-serialize
How to Check if You Are Affected
To determine whether your application is affected by GHSA-2226-4v3c-cff8, inspect your project dependencies for Rustc serialize:
inspect dependencies for rustc-serialize
Analyze the terminal output to locate any version of Rustc serialize in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under General Security Weakness. In Rustc serialize, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-2226-4v3c-cff8 Affected Rustc serialize Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
rustc-serialize
|
crates.io |
≤ 0.3.24
|
|
References
Frequently Asked Questions
What is GHSA-2226-4v3c-cff8?
Which Rustc serialize versions are affected?
What version fixes GHSA-2226-4v3c-cff8?
Is rustc-serialize affected?
What CWE is associated with GHSA-2226-4v3c-cff8?
How can I check crates.io dependencies for GHSA-2226-4v3c-cff8?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-2226-4v3c-cff8",
"modified" : "2022-06-17T00:18:24Z",
"published" : "2022-06-17T00:18:24Z",
"aliases" : [ ],
"summary" : "Stack overflow in rustc_serialize when parsing deeply nested JSON",
"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.\n\nExample code that triggers the vulnerability is\n\n```rust\nfn main() {\n let _ = rustc_serialize::json::Json::from_str(&\"[0,[\".repeat(10000));\n}\n```\n\n[serde](https://crates.io/crates/serde) is recommended as a replacement to rustc_serialize.\n",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "rustc-serialize"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"last_affected" : "0.3.24"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/rust-lang-deprecated/rustc-serialize"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/rust-lang/rustc-serialize"
}, {
"type" : "WEB",
"url" : "https://rustsec.org/advisories/RUSTSEC-2022-0004.html"
} ],
"database_specific" : {
"cwe_ids" : [ ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2022-06-17T00:18:24Z",
"nvd_published_at" : null
}
}