CVE-2022-36085: Protection bypass in github.com/open-policy-agent/opa

Summary

13/09/2022
Yes i
High
7.4

CVE-2022-36085: Protection bypass in github.com/open-policy-agent/opa. Affects github.com/open-policy-agent/opa versions >= 0.40.0, < 0.44.0. Fixed in 0.44.0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Open Policy Agent (OPA) is an open source, general-purpose policy engine. It provides a Rego compiler that allows users to define policies and compile them into executable code. The WithUnsafeBuiltins function is a deprecated feature in OPA that allows users to specify a set of built-in functions that should be considered unsafe and rejected by the compiler during policy compilation. This vulnerability bypasses the protection provided by WithUnsafeBuiltins when using the with keyword to mock a built-in function that is not accounted for by WithUnsafeBuiltins.

Vulnerability Detail

The vulnerability in OPA allows an attacker to bypass the protection provided by WithUnsafeBuiltins by using the with keyword to mock a built-in function that is not considered unsafe by WithUnsafeBuiltins. This can lead to the execution of potentially malicious code during policy compilation, compromising the integrity and security of the policy engine. The impact of this vulnerability depends on the policies being compiled and the actions allowed by the policy engine.

How To Fix

Latest published version: v1.21.3 as of 23 Oct 2026

go get github.com/open-policy-agent/opa@v1.21.3

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

0.44.0

This is the first release that contains the fix.

go get github.com/open-policy-agent/opa@v0.44.0

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There is no known workaround for this vulnerability. It is recommended to upgrade to the latest version of OPA to fix the issue.

Conclusion

In conclusion, the vulnerability in OPA allows for the bypass of the protection provided by WithUnsafeBuiltins, potentially leading to the execution of malicious code during policy compilation. Users are advised to upgrade to the latest version of OPA to mitigate this vulnerability. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for github.com/open-policy-agent/opa →

Share this vulnerability

FAQ

Open Policy Agent (OPA) is an open source, general-purpose policy engine that allows users to define and enforce policies across their applications and infrastructure.

WithUnsafeBuiltins is a deprecated function in OPA that allows users to specify a set of built-in functions that should be considered unsafe and rejected by the compiler during policy compilation.

The vulnerability allows an attacker to use the with keyword to mock a built-in function that is not considered unsafe by WithUnsafeBuiltins, thereby bypassing the protection.

The impact of this vulnerability depends on the policies being compiled and the actions allowed by the policy engine. It can potentially lead to the execution of malicious code during policy compilation.

To fix this vulnerability, it is recommended to upgrade to OPA version 0.44.0 or later.

Related vulnerabilities

Recent vulnerabilities recorded for github.com/open-policy-agent/opa.

How To Fix

Latest published version: v1.21.3 as of 23 Oct 2026

go get github.com/open-policy-agent/opa@v1.21.3

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

0.44.0

This is the first release that contains the fix.

go get github.com/open-policy-agent/opa@v0.44.0

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback