Improper Input Validation Affecting github.com/open-policy-agent/opa/ast package, versions >=0.40.0 <0.43.1


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.34% (72nd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Improper Input Validation vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-GOLANG-GITHUBCOMOPENPOLICYAGENTOPAAST-3018920
  • published8 Sept 2022
  • disclosed8 Sept 2022
  • creditanderseknert

Introduced: 8 Sep 2022

CVE-2022-36085  (opens in a new tab)
CWE-20  (opens in a new tab)

How to fix?

Upgrade github.com/open-policy-agent/opa/ast to version 0.43.1 or higher.

Overview

github.com/open-policy-agent/opa/ast is a declares Rego syntax tree types and also includes a parser and compiler for preparing policies for execution in the policy engine.

Affected versions of this package are vulnerable to Improper Input Validation via the function WithUnsafeBuiltins within the Rego compiler, when using with keyword to mock a build-in function.

Note:

All of these conditions have to be met to create an adverse effect:

  • Use the Go API for policy evaluation (not the OPA server, or the Go SDK)
  • Make use of the WithUnsafeBuiltins method in order to deny certain built-in functions, like e.g. http.send, from being used in policy evaluation.
  • Allow policy evaluation of policies provided by untrusted parties.
  • The policies evaluated include the with keyword to rewrite/mock a built-in, or custom, function to that of another built-in function, such as http.send.

CVSS Scores

version 3.1