{"answers":{"affected":"3 open source packages ship an affected version, including github.com/open-policy-agent/opa. It affects 1 product.","exploited":"It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-36085 exists.","fix":"Upgrade github.com/open-policy-agent/opa to a fixed version for your release line: 0.43.1 or 0.44.0.","what":"CVE-2022-36085 is a high-severity vulnerability in open-policy-agent opa, published on 8 Sep 2022. An attacker can exploit it over the internet without logging in, with no action from the victim."},"fix_prompt":"Check this codebase for CVE-2022-36085 and fix it if it is affected.\n\nWhat it is: CVE-2022-36085 is a high-severity vulnerability in open-policy-agent opa, published on 8 Sep 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.\nExploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-36085 exists.\n\nAffected packages and fixed versions:\n- github.com/open-policy-agent/opa (Go): affected from 0.40.0; fixed in 0.43.1\n- github.com/open-policy-agent/opa (Go): affected from 0.40.0; fixed in 0.43.1\n- github.com/open-policy-agent/opa (Go): affected from 0.40.0; fixed in 0.44.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/CVE-2022-36085/ (Markdown: https://insights.sbomify.com/CVE-2022-36085/index.md)","id":"CVE-2022-36085","markdown":"https://insights.sbomify.com/CVE-2022-36085/index.md","name":"CVE-2022-36085","record":{"aliases":["GHSA-f524-rf33-2jjr","GO-2022-0978"],"analysis":{"component_type":"library","fix_type":"patch","impacts":["security_bypass"],"network_reachable":"yes","non_default_config":true,"product_category":"Open Policy Agent","requires_auth":"none","summary":"Attackers can bypass unsafe builtin restrictions in OPA by mocking functions, requiring non-default configuration to exploit.","user_interaction":"not_required","vuln_class":"security_feature_bypass"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[{"product":"open_policy_agent","vendor":"openpolicyagent"}],"cvss":{"score":7.4,"severity":"high","source":"cna","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N","version":"3.1"},"cwes":[{"id":"CWE-693","name":"Protection Mechanism Failure"},{"id":"CWE-20","name":"Improper Input Validation"}],"description":"Open Policy Agent (OPA) is an open source, general-purpose policy engine. The Rego compiler provides a (deprecated) `WithUnsafeBuiltins` function, which allows users to provide a set of built-in functions that should be deemed unsafe — and as such rejected — by the compiler if encountered in the policy compilation stage. A bypass of this protection has been found, where the use of the `with` keyword to mock such a built-in function (a feature introduced in OPA v0.40.0), isn’t taken into account by `WithUnsafeBuiltins`. Multiple conditions need to be met in order to create an adverse effect. Version 0.43.1 contains a patch for this issue. As a workaround, avoid using the `WithUnsafeBuiltins` function and use the `capabilities` feature instead.","ecosystems":["Go"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"weaponised"},"has_fix":true,"headline":"OPA Compiler: Bypass of WithUnsafeBuiltins using `with` keyword to mock functions","id":"CVE-2022-36085","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"Go","product":null,"products":[],"type":"security_feature_bypass","year":"2022"},"n_packages":3,"n_references":6,"next":{"headline":"linked_list_allocator vulnerable to out-of-bound writes on `Heap` initialization and `Heap::extend`","id":"CVE-2022-36086"},"packages":[{"ecosystem":"Go","fixed":["0.43.1"],"introduced":["0.40.0"],"last_affected":[],"package":"github.com/open-policy-agent/opa","purl":null,"source":"GHSA-f524-rf33-2jjr"},{"ecosystem":"Go","fixed":["0.43.1"],"introduced":["0.40.0"],"last_affected":[],"package":"github.com/open-policy-agent/opa","purl":"pkg:golang/github.com/open-policy-agent/opa","source":"GHSA-f524-rf33-2jjr"},{"ecosystem":"Go","fixed":["0.44.0"],"introduced":["0.40.0"],"last_affected":[],"package":"github.com/open-policy-agent/opa","purl":"pkg:golang/github.com/open-policy-agent/opa","source":"GO-2022-0978"}],"prev":{"headline":"cruddl vulnerable to AQL injection through flexSearch","id":"CVE-2022-36084"},"products":["opa"],"published":"2022-09-08","related":[{"cvss_score":7.5,"headline":"Denial of service in Open Policy Agent","id":"CVE-2022-33082","kev_date_added":null,"published":"2022-06-30"},{"cvss_score":7.5,"headline":"Out of bounds memory access in github.com/open-policy-agent/opa","id":"CVE-2022-28946","kev_date_added":null,"published":"2022-05-19"},{"cvss_score":6.3,"headline":"Array literal misordering in github.com/open-policy-agent/opa","id":"CVE-2022-23628","kev_date_added":null,"published":"2022-02-09"},{"cvss_score":6.1,"headline":"OPA SMB Force-Authentication","id":"CVE-2024-8260","kev_date_added":null,"published":"2024-08-30"}],"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":"CC BY 4.0","name":"Go Vulnerability Database","prefix":"GO"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":"no","exploitation":"poc","technical_impact":"total"},"state":"PUBLISHED","updated":"2025-04-22","vendors":["open-policy-agent"]},"summary":"Attackers can bypass unsafe builtin restrictions in OPA by mocking functions, requiring non-default configuration to exploit.","url":"https://insights.sbomify.com/CVE-2022-36085/"}