{"answers":{"affected":"7 open source packages ship an affected version, including libz-rs-sys, libz-rs-sys-cdylib and zlib-rs.","exploited":"There is no known exploitation of GHSA-j3px-q95c-9683 in the wild and no public exploit code.","fix":"Upgrade libz-rs-sys to 0.4.0 or later.","what":"GHSA-j3px-q95c-9683 is a denial of service vulnerability in libz-rs-sys, published on 14 Nov 2024. An attacker can exploit it over the internet without logging in, with no action from the victim."},"fix_prompt":"Check this codebase for GHSA-j3px-q95c-9683 and fix it if it is affected.\n\nWhat it is: GHSA-j3px-q95c-9683 is a denial of service vulnerability in libz-rs-sys, published on 14 Nov 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.\nExploitation: There is no known exploitation of GHSA-j3px-q95c-9683 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- libz-rs-sys (crates.io): affected all versions; fixed in 0.4.0\n- libz-rs-sys (crates.io): affected all versions; fixed in 0.4.0\n- libz-rs-sys-cdylib (crates.io): affected all versions; fixed in 0.4.0\n- libz-rs-sys-cdylib (crates.io): affected all versions; fixed in 0.4.0\n- zlib-rs (crates.io): affected all versions; fixed in 0.4.0\n- zlib-rs (crates.io): affected all versions; fixed in 0.4.0\n- zlib-rs (crates.io): affected from 0.0.0-0; fixed in 0.4.0\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/GHSA-j3px-q95c-9683/ (Markdown: https://insights.sbomify.com/GHSA-j3px-q95c-9683/index.md)","id":"GHSA-j3px-q95c-9683","markdown":"https://insights.sbomify.com/GHSA-j3px-q95c-9683/index.md","name":"GHSA-j3px-q95c-9683","record":{"aliases":["RUSTSEC-2024-0401"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["denial_of_service"],"network_reachable":"yes","non_default_config":false,"product_category":"Rust compression library","requires_auth":"none","summary":"A maliciously crafted input can cause a stack overflow in zlib-rs, crashing the application and resulting in a denial of service.","user_interaction":"not_required","vuln_class":"denial_of_service"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"A denial of service vulnerability was found in zlib-rs, triggered by specially constructed input. This input causes a stack overflow, resulting in the process using zlib-rs to crash.\n\n### Impact\n\nDue to the way LLVM handles the zlib-rs codebase, tail calls were not guaranteed. This caused certain input patterns to result in a large number of stack frames being required, quickly resulting in a stack overflow. These are unlikely to occur in practice, but a dedicated attacker can construct malicious input files.\n\nAfter stack overflows were found by [@inahga](https://github.com/inahga) with a fuzzer, we dove into the assembly, and found some cases where the stack grew\n\n```asm\n.LBB109_326:\n    mov rdi, rbx\n    call zlib_rs::inflate::State::type_do\n    jmp .LBB109_311\n\n.LBB109_311:\n    lea rsp, [rbp - 40]\n    pop rbx\n    pop r12\n    pop r13\n    pop r14\n    pop r15\n    pop rbp\n    .cfi_def_cfa rsp, 8\n    ret\n```\n\nLLVM wants to centralize the cleanup before the return (many other blocks jump to `LBB109_311`), thereby invalidating a tail call to `type_do`. We were not able to get rid of this call without introducing one elsewhere: we just don't currently have the power to tell LLVM what we want it to do.\n\nSo, we switch back to loop+match waiting for changes to rust to make a more efficient implementation possible. Performance-wise, the damage is relatively minimal: we're just slower in cases where we already were slower than C. We are faster in cases where the relevant code is barely touched (in these cases the logic quickly moves into a hot inner loop and just spends most of its time there).\n\n### Patches\nVersion 0.4.0 patches the problem and is no longer vulnerable.\n\n### Workarounds\nUsers of zlib-rs should upgrade to the latest version. Users could alternatively run zlib-rs in a separate process to prevent a stack overflow crashing the entire program. In some situations a signal handler can be used to catch a stack overflow happening.","ecosystems":["crates.io"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"Denial of service because of stack overflow with malicious decompression input","id":"GHSA-j3px-q95c-9683","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"crates.io","product":null,"products":[],"type":"denial_of_service","year":"2024"},"n_packages":7,"n_references":null,"packages":[{"ecosystem":"crates.io","fixed":["0.4.0"],"introduced":["0"],"last_affected":[],"package":"libz-rs-sys","purl":null,"source":"GHSA-j3px-q95c-9683"},{"ecosystem":"crates.io","fixed":["0.4.0"],"introduced":["0"],"last_affected":[],"package":"libz-rs-sys","purl":"pkg:cargo/libz-rs-sys","source":"GHSA-j3px-q95c-9683"},{"ecosystem":"crates.io","fixed":["0.4.0"],"introduced":["0"],"last_affected":[],"package":"libz-rs-sys-cdylib","purl":null,"source":"GHSA-j3px-q95c-9683"},{"ecosystem":"crates.io","fixed":["0.4.0"],"introduced":["0"],"last_affected":[],"package":"libz-rs-sys-cdylib","purl":"pkg:cargo/libz-rs-sys-cdylib","source":"GHSA-j3px-q95c-9683"},{"ecosystem":"crates.io","fixed":["0.4.0"],"introduced":["0"],"last_affected":[],"package":"zlib-rs","purl":null,"source":"GHSA-j3px-q95c-9683"},{"ecosystem":"crates.io","fixed":["0.4.0"],"introduced":["0"],"last_affected":[],"package":"zlib-rs","purl":"pkg:cargo/zlib-rs","source":"GHSA-j3px-q95c-9683"},{"ecosystem":"crates.io","fixed":["0.4.0"],"introduced":["0.0.0-0"],"last_affected":[],"package":"zlib-rs","purl":"pkg:cargo/zlib-rs","source":"RUSTSEC-2024-0401"}],"products":null,"published":"2024-11-14","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"open","licence":"CC0 1.0","name":"RustSec","prefix":"RUSTSEC"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"A maliciously crafted input can cause a stack overflow in zlib-rs, crashing the application and resulting in a denial of service.","url":"https://insights.sbomify.com/GHSA-j3px-q95c-9683/"}