CVE-2022-36085 json
OPA Compiler: Bypass of WithUnsafeBuiltins using `with` keyword to mock functions
published 4y ago modified 4mo ago also GHSA-f524-rf33-2jjr , GO-2022-0978 , EUVD-2022-6789
- cvss
- 7.4
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 1.6%
- EPSS 1.6% chance of exploitation in 30 days, percentile 76%
- public exploits
- 0
- none known
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.
Patch / fix
- go github.com/open-policy-agent/opa 0.43.1, 0.44.0
- openpolicyagent open_policy_agent 0.43.1
- github.com/open-policy-agent/opa@25a597b commit
- github.com/open-policy-agent/opa@3e8c754 commit
- github.com/open-policy-agent/opa#4540 pull request
- github.com/open-policy-agent/opa#4616 pull request
- github.com/open-policy-agent/opa/releases/tag/v0.43.1 release
- github.com/open-policy-agent/opa/security/advisories/GHSA-f524-rf33-2… advisory
Is CVE-2022-36085 in your dependencies? Fencer shows which of your repositories are affected as soon as an advisory lands, and opens the fix as a pull request.
Check with FencerVendor advisories
What the vendors themselves say about their products: affected, fixed or not affected, and what to do.
red hat product security vex CVE-2022-36085 updated cvss 9.8
open-policy-agent: Compiler Bypass of WithUnsafeBuiltins using "with" keyword to mock functions
-
Red Hat Logging Subsystem for Red Hat OpenShift openshift-logging/opa-openshift-rhel8, openshift-logging/lokistack-gateway-rhel8 Red Hat OpenShift Serverless openshift-serverless-1/client-kn-rhel8 Red Hat OpenShift Service Mesh 2.0 servicemesh, servicemesh-mixc, servicemesh-mixs, servicemesh-istioctl, servicemesh-pilot-agent, servicemesh-pilot-discovery Red Hat Advanced Cluster Management for Kubernetes 2 rhacm2/gatekeeper-rhel8 Red Hat Advanced Cluster Security 3 advanced-cluster-security/rhacs-main-rhel8, advanced-cluster-security/rhacs-scanner-rhel8, advanced-cluster-security/rhacs-scanner-db-rhel8, advanced-cluster-security/rhacs-scanner-slim-rhel8, advanced-cluster-security/rhacs-scanner-db-slim-rhel8 Red Hat OpenShift Container Platform 4 openshift4/cnf-tests-rhel8, openshift4/ztp-site-generate-rhel8not affected: vulnerable code not present
Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf
CISA SSVC
- Exploitation
- Proof of concept is public
- Automatable
- no
- Technical impact
- total
- Assessed
- last yr.
Exploit prediction
1.63% chance of exploitation in the next 30 days, higher than 76% of all scored CVEs (FIRST EPSS, 2026-11-09).
Exploits and checks
- github.com https://github.com/open-policy-agent/opa/pull/4540 referenced PoC, tagged "exploit" by a source, unverified
- github.com https://github.com/open-policy-agent/opa/pull/4616 referenced PoC, tagged "exploit" by a source, unverified
- github.com https://github.com/open-policy-agent/opa/security/advisories/GHSA-f524-rf33-2jjr referenced PoC, tagged "exploit" by a source, unverified
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.1 | 7.4 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N |
| NVD | 3.1 | 9.8 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| GitHub | 3.1 | 7.4 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| go | github.com/open-policy-agent/opa | >=0.40.0, <0.43.1 >=0.40.0, <0.44.0 |
0.43.1 0.44.0 |
Affected products
- open-policy-agent opa
Classification
References
-
github.com
/open-policy-agent/opa/pull/4540
web, exploit, patch, third-party-advisory
-
github.com
/open-policy-agent/opa/pull/4616
web, exploit, patch, third-party-advisory
-
github.com
/open-policy-agent/opa/commit/25a597bc3f4985162e7f65f9c36599f4f8f55823
web, patch, third-party-advisory
-
github.com
/open-policy-agent/opa/commit/3e8c754ed007b22393cf65e48751ad9f6457fee8
web, patch, third-party-advisory
-
github.com
/open-policy-agent/opa/security/advisories/GHSA-f524-rf33-2jjr
web, exploit, patch, third-party-advisory, advisory
-
github.com
/open-policy-agent/opa/releases/tag/v0.43.1
web, third-party-advisory
-
nvd.nist.gov
/vuln/detail/CVE-2022-36085
advisory
-
github.com
/open-policy-agent/opa
package
-
pkg.go.dev
/vuln/GO-2022-0978
web
Sources
- CVE List CVE-2022-36085
- GitHub Advisory GHSA-f524-rf33-2jjr
- NVD CVE-2022-36085
- OSV GO-2022-0978
Fencer Intel keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.