{"answers":{"affected":"2 open source packages ship an affected version, including brillig.","exploited":"There is no known exploitation of CVE-2026-41197 in the wild and no public exploit code.","fix":"Upgrade brillig to 1.0.0-beta.19 or later.","what":"CVE-2026-41197 is a critical memory corruption vulnerability in noir-lang noir, published on 23 Apr 2026. An attacker can exploit it over the internet without logging in, with no action from the victim."},"fix_prompt":"Check this codebase for CVE-2026-41197 and fix it if it is affected.\n\nWhat it is: CVE-2026-41197 is a critical memory corruption vulnerability in noir-lang noir, published on 23 Apr 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.\nExploitation: There is no known exploitation of CVE-2026-41197 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- brillig (crates.io): affected all versions; fixed in 1.0.0-beta.19\n- brillig (crates.io): affected all versions; fixed in 1.0.0-beta.19\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/CVE-2026-41197/ (Markdown: https://insights.sbomify.com/CVE-2026-41197/index.md)","id":"CVE-2026-41197","markdown":"https://insights.sbomify.com/CVE-2026-41197/index.md","name":"CVE-2026-41197","record":{"aliases":["GHSA-jj7c-x25r-r8r3"],"analysis":{"component_type":"developer_tool","fix_type":"patch","impacts":["code_execution","denial_of_service"],"network_reachable":"yes","non_default_config":false,"product_category":"Noir compiler","requires_auth":"none","summary":"Heap corruption in Noir compiler allows attackers to execute arbitrary code or cause denial of service via crafted foreign calls with nested tuple arrays.","user_interaction":"not_required","vuln_class":"memory_corruption"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[],"cvss":{"score":9.3,"severity":"critical","source":"cna","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","version":"4.0"},"cwes":[{"id":"CWE-131","name":"Incorrect Calculation of Buffer Size"}],"description":"Noir is a Domain Specific Language for SNARK proving systems that is designed to use any ACIR compatible proving system, and Brillig is the bytecode ACIR uses for non-determinism. Noir programs can invoke external functions through foreign calls. When compiling to Brillig bytecode, the SSA instructions are processed block-by-block in `BrilligBlock::compile_block()`. When the compiler encounters an `Instruction::Call` with a `Value::ForeignFunction` target, it invokes `codegen_call()` in `brillig_call/code_gen_call.rs`, which dispatches to `convert_ssa_foreign_call()`. Before emitting the foreign call opcode, the compiler must pre-allocate memory for any array results the call will return. This happens through `allocate_external_call_results()`, which iterates over the result types. For `Type::Array` results, it delegates to `allocate_foreign_call_result_array()` to recursively allocate memory on the heap for nested arrays. The `BrilligArray` struct is the internal representation of a Noir array in Brillig IR. Its `size` field represents the semi-flattened size, the total number of memory slots the array occupies, accounting for the fact that composite types like tuples consume multiple slots per element. This size is computed by `compute_array_length()` in `brillig_block_variables.rs`. For the outer array, `allocate_external_call_results()` correctly uses `define_variable()`, which internally calls `allocate_value_with_type()`. This function applies the formula above, producing the correct semi-flattened size. However, for nested arrays, `allocate_foreign_call_result_array()` contains a bug. The pattern `Type::Array(_, nested_size)` discards the inner types with `_` and uses only `nested_size`, the semantic length of the nested array (the number of logical elements), not the semi-flattened size. For simple element types this works correctly, but for composite element types it under-allocates. Foreign calls returning nested arrays of tuples or other composite types corrupt the Brillig VM heap. Version 1.0.0-beta.19 fixes this issue.","ecosystems":["crates.io"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"none_known"},"has_fix":true,"headline":"Brillig: Heap corruption in foreign call results with nested tuple arrays","id":"CVE-2026-41197","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"crates.io","product":null,"products":[],"type":"memory_corruption","year":"2026"},"n_packages":2,"n_references":2,"next":{"headline":"STIG Manager has reflected XSS vulnerability in the Web App","id":"CVE-2026-41200"},"packages":[{"ecosystem":"crates.io","fixed":["1.0.0-beta.19"],"introduced":["0"],"last_affected":[],"package":"brillig","purl":null,"source":"GHSA-jj7c-x25r-r8r3"},{"ecosystem":"crates.io","fixed":["1.0.0-beta.19"],"introduced":["0"],"last_affected":[],"package":"brillig","purl":"pkg:cargo/brillig","source":"GHSA-jj7c-x25r-r8r3"}],"prev":{"headline":"Luanti has a mod security sandbox escape","id":"CVE-2026-41196"},"products":["noir"],"published":"2026-04-23","related":[],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":"yes","exploitation":"none","technical_impact":"total"},"state":"PUBLISHED","updated":"2026-04-25","vendors":["noir-lang"]},"summary":"Heap corruption in Noir compiler allows attackers to execute arbitrary code or cause denial of service via crafted foreign calls with nested tuple arrays.","url":"https://insights.sbomify.com/CVE-2026-41197/"}