CVE-2022-36085
vulnerability analysis and mitigation

Overview

CVE-2022-36085 is a security vulnerability discovered in Open Policy Agent (OPA) affecting versions >= v0.40.0 and < v0.44.0. The vulnerability allows bypassing the WithUnsafeBuiltins protection mechanism using the 'with' keyword to mock built-in functions. This feature was introduced in OPA v0.40.0 and could potentially allow untrusted policies to execute unsafe built-in functions that were intended to be blocked (OPA Advisory).

Technical details

The vulnerability exists in the Rego compiler's WithUnsafeBuiltins function, which is meant to allow users to specify built-in functions that should be rejected during policy compilation. The bypass occurs when using the 'with' keyword to mock built-in functions, as this operation isn't properly checked against the unsafe builtins list. For example, a policy could bypass restrictions on http.send by mocking another function to call it: 'foo := isobject({"method": "get", "url": "https://example.com"}) allow := r { r := foo with isobject as http.send }' (OPA Advisory).

Impact

The vulnerability can lead to execution of unsafe built-in functions that were intended to be blocked, potentially exposing sensitive information through functions like opa.runtime or allowing unauthorized network requests through http.send. This is particularly concerning in environments where policy evaluation of untrusted policies is allowed (OPA Advisory).

Mitigation and workarounds

The vulnerability has been patched in versions v0.43.1 and v0.44.0. For users unable to upgrade, the recommended workaround is to use the capabilities feature instead of the deprecated WithUnsafeBuiltins function. This involves modifying the code to use ast.CapabilitiesForThisVersion() and properly configuring the capabilities to exclude unsafe built-ins (OPA Advisory).

Additional resources


SourceThis report was generated using AI

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management