OPA Compiler: Bypass of WithUnsafeBuiltins using `with` keyword to mock functions
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Impact type
- Security bypass
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Fixed
Attack profile from CVSS 3.1 · NVD. Fix status from CNA and GitHub. Impact type from CWE-693.
Summary
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.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- Poc
- Automatable
- No
- Technical impact
- Total
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| open-policy-agent | opa | 0.40.0 to before 0.43.1 | 0.43.1 | Patch available | CNA |
| — | github.com/open-policy-agent/opa (Go) | 0.40.0 to before 0.43.1 | 0.43.1 | Patch available | GHSA-f524-rf33-2jjr |
- opa Vendoropen-policy-agent Affected 0.40.0 to before 0.43.1 Fixed in 0.43.1 Patch available CNA
- github.com/open-policy-agent/opa (Go) Vendor— Affected 0.40.0 to before 0.43.1 Fixed in 0.43.1 Patch available GHSA-f524-rf33-2jjr
CPE configurations NVD · 1
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:openpolicyagent:open_policy_agent:*:*:*:*:*:*:*:* | 0.40.0 to before 0.43.1 | Vulnerable | open-policy-agent |
- cpe:2.3:a:openpolicyagent:open_policy_agent:*:*:*:*:*:*:*:* Versions 0.40.0 to before 0.43.1 Vulnerable ·open-policy-agent
Remediation
- Fix · CNA opa (open-policy-agent) Fixed in 0.43.1
- Fix · GHSA-f524-rf33-2jjr github.com/open-policy-agent/opa (Go) Fixed in 0.43.1 Advisory →
Vendor assessments
Red Hat
Red Hat rating: Important. Red Hat's page for this CVE →
Not affected: 6 products
- Logging Subsystem for Red Hat OpenShift
- OpenShift Serverless
- OpenShift Service Mesh 2.0
- Red Hat Advanced Cluster Management for Kubernetes 2
- Red Hat Advanced Cluster Security 3
- Red Hat OpenShift Container Platform 4
Timeline
- 2026-10-02 Threatist record created from CVE-2022-36085
- 2026-10-03 Alias added: GHSA-f524-rf33-2jjr
References
Exploit 3
Patch 2
Advisory 2
More open-policy-agent Open Policy Agent vulnerabilities
- TI-2022-07681 Array literal misordering in github.com/open-policy-agent/opa CVSS 3.1MEDIUM 6.3
- TI-2022-14552 An issue in the AST parser (ast/compile.go) of Open Policy Agent v0.10.2 allows attackers… CVSS 3.1HIGH 7.5
- TI-2022-11544 An issue in the component ast/parser.go of Open Policy Agent v0.39.0 causes the… CVSS 3.1HIGH 7.5
- TI-2024-07657 OPA SMB Force-Authentication CVSS 3.1HIGH 7.3
Sources
- CVE-2022-36085 · CVE Program
- CVE-2022-36085 · NVD
- FIRST EPSS
- GHSA-f524-rf33-2jjr · GitHub Advisory Database · CC BY 4.0
- CVE-2022-36085 · Red Hat security data · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences