{"schemaVersion":3,"id":"CVE-2022-36085","aliases":["GHSA-f524-rf33-2jjr","GO-2022-0978"],"status":"published","duplicateOf":null,"title":null,"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.","dates":{"published":"2022-09-08T13:30:16.000Z","modified":"2025-04-22T17:23:14.762Z","reserved":null,"kevAdded":[],"kevDue":[]},"cvss":{"headline":{"score":9.8,"severity":"critical","version":"3.1","versionLabel":"v3.1","source":"NVD","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","computed":false,"selection":"backend-summary"},"metrics":[{"version":"3.1","versionLabel":"v3.1","source":"CVE.org","score":7.4,"severity":"high","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N","exploitability":null,"impact":null,"computed":false},{"version":"3.1","versionLabel":"v3.1","source":"OSV · Go","score":7.4,"severity":"high","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N","exploitability":5.6,"impact":8.7,"computed":true},{"version":"3.1","versionLabel":"v3.1","source":"NVD","score":9.8,"severity":"critical","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","exploitability":null,"impact":null,"computed":false}]},"epss":{"probability":0.01593,"percentile":0.75358,"severity":"low","asOf":"2026-10-20T00:00:00.000Z","change":{"pp":0.037000000000000054,"baselineDate":"2026-09-20T00:00:00.000Z","baselineScore":0.01556},"history":[{"date":"2026-09-14T00:00:00.000Z","score":0.01556,"percentile":null},{"date":"2026-09-15T00:00:00.000Z","score":0.01556,"percentile":null},{"date":"2026-09-16T00:00:00.000Z","score":0.01556,"percentile":null},{"date":"2026-09-17T00:00:00.000Z","score":0.01556,"percentile":null},{"date":"2026-09-18T00:00:00.000Z","score":0.01556,"percentile":null},{"date":"2026-09-19T00:00:00.000Z","score":0.01556,"percentile":null},{"date":"2026-09-20T00:00:00.000Z","score":0.01556,"percentile":null},{"date":"2026-09-21T00:00:00.000Z","score":0.01556,"percentile":null},{"date":"2026-09-22T00:00:00.000Z","score":0.01556,"percentile":null},{"date":"2026-09-23T00:00:00.000Z","score":0.01556,"percentile":null},{"date":"2026-09-24T00:00:00.000Z","score":0.01556,"percentile":null},{"date":"2026-09-25T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-09-26T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-09-27T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-09-28T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-09-29T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-09-30T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-01T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-02T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-03T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-04T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-05T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-06T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-07T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-08T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-09T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-10T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-11T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-12T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-13T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-14T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-15T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-16T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-17T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-18T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-19T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-20T00:00:00.000Z","score":0.01593,"percentile":0.75358}],"last30":[{"date":"2026-09-20T00:00:00.000Z","score":0.01556,"percentile":null},{"date":"2026-09-21T00:00:00.000Z","score":0.01556,"percentile":null},{"date":"2026-09-22T00:00:00.000Z","score":0.01556,"percentile":null},{"date":"2026-09-23T00:00:00.000Z","score":0.01556,"percentile":null},{"date":"2026-09-24T00:00:00.000Z","score":0.01556,"percentile":null},{"date":"2026-09-25T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-09-26T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-09-27T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-09-28T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-09-29T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-09-30T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-01T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-02T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-03T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-04T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-05T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-06T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-07T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-08T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-09T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-10T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-11T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-12T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-13T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-14T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-15T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-16T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-17T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-18T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-19T00:00:00.000Z","score":0.01593,"percentile":null},{"date":"2026-10-20T00:00:00.000Z","score":0.01593,"percentile":0.75358}]},"kev":{"state":"not-listed","entries":[],"listedCount":0,"totalCatalogs":3,"catalogs":[{"source":"cisa","label":"CISA","listed":false,"entry":null},{"source":"enisa","label":"ENISA","listed":false,"entry":null},{"source":"circl","label":"CIRCL","listed":false,"entry":null}]},"ransomware":{"state":"none-recorded","sources":[]},"exploits":[{"id":"GITHUB_OPEN-POLICY-AGENT_OPA","name":"Opa","source":"github","url":"https://github.com/open-policy-agent/opa/security/advisories/GHSA-hcw3-j74m-qc58","maturity":"poc","reliabilityScore":0.3,"verified":false,"type":null,"platforms":[],"requiresAuth":null,"exploitdb":null,"metasploit":null}],"exploitCount":1,"weaknesses":[{"id":"CWE-20","name":"Improper Input Validation","description":"The product receives input or data, but it does\n        not validate or incorrectly validates that the input has the\n        properties that are required to process the data safely and\n        correctly.","type":"weakness","status":"Stable","abstraction":"Class","likelihoodOfExploit":"High","url":"https://cwe.mitre.org/data/definitions/20.html"},{"id":"CWE-693","name":"Protection Mechanism Failure","description":"The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.","type":"weakness","status":"Draft","abstraction":"Pillar","likelihoodOfExploit":null,"url":"https://cwe.mitre.org/data/definitions/693.html"}],"affected":[{"vendor":"github.com/open-policy-agent","product":"opa","name":"github.com/open-policy-agent/opa","label":"opa","ecosystem":"Go","cpePart":null,"purl":"pkg:golang/github.com/open-policy-agent/opa","purlType":"golang","versions":[{"text":"≥ 0.40.0, < 0.43.1","noFixRecorded":false,"fixedIn":null},{"text":"≥ 0.40.0, < 0.44.0","noFixRecorded":false,"fixedIn":null}],"versionsText":"≥ 0.40.0, < 0.43.1 | ≥ 0.40.0, < 0.44.0","eol":null,"hubHref":null},{"vendor":"open-policy-agent","product":"opa","name":"opa","label":"opa","ecosystem":null,"cpePart":"a","purl":null,"purlType":null,"versions":[{"text":"≥ 0.40.0, < 0.43.1","noFixRecorded":false,"fixedIn":null}],"versionsText":"≥ 0.40.0, < 0.43.1","eol":null,"hubHref":"/vendor/open-policy-agent/opa"},{"vendor":"openpolicyagent","product":"open_policy_agent","name":"open policy agent","label":"open_policy_agent","ecosystem":null,"cpePart":"a","purl":null,"purlType":null,"versions":[{"text":"≥ 0.40.0, < 0.43.1","noFixRecorded":false,"fixedIn":null}],"versionsText":"≥ 0.40.0, < 0.43.1","eol":null,"hubHref":"/vendor/openpolicyagent/open_policy_agent"}],"affectedCount":3,"eol":{"hasEol":false,"count":0},"references":[{"url":"https://github.com/open-policy-agent/opa/security/advisories/GHSA-f524-rf33-2jjr","label":"github.com/open-policy-agent/opa/security/advisories/GHSA-f524-rf33-2jjr","hostname":"github.com","tags":["X Refsource CONFIRM","WEB","Advisory","Exploit","Patch","Third Party Advisory"]},{"url":"https://github.com/open-policy-agent/opa/pull/4540","label":"github.com/open-policy-agent/opa/pull/4540","hostname":"github.com","tags":["X Refsource MISC","WEB","FIX","Exploit","Patch","Third Party Advisory"]},{"url":"https://github.com/open-policy-agent/opa/pull/4616","label":"github.com/open-policy-agent/opa/pull/4616","hostname":"github.com","tags":["X Refsource MISC","WEB","FIX","Exploit","Patch","Third Party Advisory"]},{"url":"https://github.com/open-policy-agent/opa/commit/25a597bc3f4985162e7f65f9c36599f4f8f55823","label":"github.com/open-policy-agent/opa/commit/25a597bc3f4985162e7f65f9c36599f4f8f55823","hostname":"github.com","tags":["X Refsource MISC","WEB","FIX","Patch","Third Party Advisory"]},{"url":"https://github.com/open-policy-agent/opa/commit/3e8c754ed007b22393cf65e48751ad9f6457fee8","label":"github.com/open-policy-agent/opa/commit/3e8c754ed007b22393cf65e48751ad9f6457fee8","hostname":"github.com","tags":["X Refsource MISC","WEB","FIX","Patch","Third Party Advisory"]},{"url":"https://github.com/open-policy-agent/opa/releases/tag/v0.43.1","label":"github.com/open-policy-agent/opa/releases/tag/v0.43.1","hostname":"github.com","tags":["X Refsource MISC","WEB","Third Party Advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-36085","label":"nvd.nist.gov/vuln/detail/CVE-2022-36085","hostname":"nvd.nist.gov","tags":["Advisory"]},{"url":"https://github.com/open-policy-agent/opa","label":"github.com/open-policy-agent/opa","hostname":"github.com","tags":["PACKAGE"]},{"url":"https://pkg.go.dev/vuln/GO-2022-0978","label":"pkg.go.dev/vuln/GO-2022-0978","hostname":"pkg.go.dev","tags":["WEB"]}],"lineage":{"upstream":[],"downstream":[],"duplicates":[],"related":[]},"timeline":[{"kind":"published","date":"2022-09-08T13:30:16.000Z","label":"Published","detail":"Vulnerability first disclosed.","source":null},{"kind":"modified","date":"2025-04-22T17:23:14.762Z","label":"Last modified","detail":"Vulnerability information updated.","source":null}],"risk":{"score":70,"level":"high","profile":"Default","thresholds":{"critical":75,"high":50,"medium":25,"low":10}},"meta":{"dataAsOf":"2026-10-20T22:01:51.616Z","stale":false,"partial":false}}