{"answers":{"affected":"7 open source packages ship an affected version, including secp256k1.","exploited":"There is no known exploitation of GHSA-969w-q74q-9j8v in the wild and no public exploit code.","fix":"Upgrade secp256k1 to a fixed version for your release line: 0.22.2, 0.23.5 or 0.24.2.","what":"GHSA-969w-q74q-9j8v is an use after free vulnerability in secp256k1, published on 30 Nov 2022."},"fix_prompt":"Check this codebase for GHSA-969w-q74q-9j8v and fix it if it is affected.\n\nWhat it is: GHSA-969w-q74q-9j8v is an use after free vulnerability in secp256k1, published on 30 Nov 2022. \nExploitation: There is no known exploitation of GHSA-969w-q74q-9j8v in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- secp256k1 (crates.io): affected from 0.14.0; fixed in 0.22.2, 0.23.5, 0.24.2\n- secp256k1 (crates.io): affected from 0.14.0; fixed in 0.22.2\n- secp256k1 (crates.io): affected from 0.14.0; fixed in 0.22.2\n- secp256k1 (crates.io): affected from 0.23.0; fixed in 0.23.5\n- secp256k1 (crates.io): affected from 0.23.0; fixed in 0.23.5\n- secp256k1 (crates.io): affected from 0.24.0; fixed in 0.24.2\n- secp256k1 (crates.io): affected from 0.24.0; fixed in 0.24.2\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-969w-q74q-9j8v/ (Markdown: https://insights.sbomify.com/GHSA-969w-q74q-9j8v/index.md)","id":"GHSA-969w-q74q-9j8v","markdown":"https://insights.sbomify.com/GHSA-969w-q74q-9j8v/index.md","name":"GHSA-969w-q74q-9j8v","record":{"aliases":["RUSTSEC-2022-0070"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["code_execution","denial_of_service"],"network_reachable":"unknown","non_default_config":false,"product_category":"Rust secp256k1 library","requires_auth":"none","summary":"An unsound API in the secp256k1 Rust library allows safe code to trigger use-after-free and invalid deallocation, potentially leading to crashes or code execution.","user_interaction":"not_required","vuln_class":"use_after_free"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"Because of incorrect bounds on method `Secp256k1::preallocated_gen_new` it was possible to cause use-after-free from safe consumer code. It was also possible to \"free\" memory not allocated by the appropriate allocator.\n\nThe method takes a place for storing the context as a mutable reference and returns context containing that reference. Because the code internally uses `unsafe` and the bounds were incorrect it was possible to create a context that outlived the passed reference (e.g. `'static`). Because the context can alternatively carry heap-allocated pointer freed on drop it was possible to \"deallocate\" a pointer that wasn't returned from appropriate allocator. The code decides whether to free the memory based on type parameter but because of missing bound it was possible to construct the context with invalid parameter.\n\nYou are unaffected if you either\n\n* don't call `Secp256k1::preallocated_gen_new`\n* manually checked that your usage of the method is sound\n* upgraded to the patched version of `secp256k1` (recommended)\n\nThe patched version uses correct bounds which means it is API-breaking. This effectively means adopting the policy of Rust lang itself allowing API-breaking changes to fix soundness bugs. Note however that valid straigthforward usage of the code will continue to compile. Only unsound code or code that propagates the bound in custom generics will fail to compile. If the code is sound fixing the bounds should be sufficient to make the code compile.\n\nSee the [GitHub issue](https://github.com/rust-bitcoin/rust-secp256k1/issues/543) for example \"exploit\" code and further discussion.","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":"Unsound API in `secp256k1` allows use-after-free and invalid deallocation from safe code","id":"GHSA-969w-q74q-9j8v","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"crates.io","product":null,"products":[],"type":"use_after_free","year":"2022"},"n_packages":7,"n_references":null,"packages":[{"ecosystem":"crates.io","fixed":["0.22.2","0.23.5","0.24.2"],"introduced":["0.14.0","0.23.0","0.24.0"],"last_affected":[],"package":"secp256k1","purl":"pkg:cargo/secp256k1","source":"RUSTSEC-2022-0070"},{"ecosystem":"crates.io","fixed":["0.22.2"],"introduced":["0.14.0"],"last_affected":[],"package":"secp256k1","purl":null,"source":"GHSA-969w-q74q-9j8v"},{"ecosystem":"crates.io","fixed":["0.22.2"],"introduced":["0.14.0"],"last_affected":[],"package":"secp256k1","purl":"pkg:cargo/secp256k1","source":"GHSA-969w-q74q-9j8v"},{"ecosystem":"crates.io","fixed":["0.23.5"],"introduced":["0.23.0"],"last_affected":[],"package":"secp256k1","purl":null,"source":"GHSA-969w-q74q-9j8v"},{"ecosystem":"crates.io","fixed":["0.23.5"],"introduced":["0.23.0"],"last_affected":[],"package":"secp256k1","purl":"pkg:cargo/secp256k1","source":"GHSA-969w-q74q-9j8v"},{"ecosystem":"crates.io","fixed":["0.24.2"],"introduced":["0.24.0"],"last_affected":[],"package":"secp256k1","purl":null,"source":"GHSA-969w-q74q-9j8v"},{"ecosystem":"crates.io","fixed":["0.24.2"],"introduced":["0.24.0"],"last_affected":[],"package":"secp256k1","purl":"pkg:cargo/secp256k1","source":"GHSA-969w-q74q-9j8v"}],"products":null,"published":"2022-11-30","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":"An unsound API in the secp256k1 Rust library allows safe code to trigger use-after-free and invalid deallocation, potentially leading to crashes or code execution.","url":"https://insights.sbomify.com/GHSA-969w-q74q-9j8v/"}