CVE-2022-23628
Array literal misordering in github.com/open-policy-agent/opa
Check your servers for CVE-2022-23628
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2022-23628 affects opa, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
Description
OPA is an open source, general-purpose policy engine. Under certain conditions, pretty-printing an abstract syntax tree (AST) that contains synthetic nodes could change the logic of some statements by reordering array literals. Example of policies impacted are those that parse and compare web paths. **All of these** three conditions have to be met to create an adverse effect: 1. An AST of Rego had to be **created programmatically** such that it ends up containing terms without a location (such as wildcard variables). 2. The AST had to be **pretty-printed** using the `github.com/open-policy-agent/opa/format` package. 3. The result of the pretty-printing had to be **parsed and evaluated again** via an OPA instance using the bundles, or the Golang packages. If any of these three conditions are not met, you are not affected. Notably, all three would be true if using **optimized bundles**, i.e. bundles created with `opa build -O=1` or higher. In that case, the optimizer would fulfil condition (1.), the result of that would be pretty-printed when writing the bundle to disk, fulfilling (2.). When the bundle was then used, we'd satisfy (3.). As a workaround users may disable optimization when creating bundles.
Severity (CVSS)
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L
- Attack vector
- network: an attacker can reach the vulnerable part over the network, often from the internet
- Attack complexity
- low: an attack works without special conditions
- Privileges required
- low: the attacker needs an ordinary user account
- User interaction
- none: nobody has to click or open anything
- Scope
- unchanged: the damage stays inside the vulnerable component
- Impact
- confidentiality low, integrity low, availability low: what an attacker can read (confidentiality), change (integrity) or stop (availability)
Exploitation
EPSS 0.99%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 61.4% of all scored CVEs. Scores of 29 Nov 2026.
The assessment of CISA (SSVC, 22 Apr 2025):
- Exploitation
- poc: a proof of concept is public
- Automatable
- no: each attack takes manual steps
- Technical impact
- partial: limited control or limited data
Weakness
- CWE-682 Incorrect Calculation
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| opa |
affected >= 0.33.1, < 0.37.0
|
Is my server affected?
Find the installed version of opa and compare it with the fixed version of your distribution. Distributions often fix a CVE in a package version of their own, so the version number of the upstream project can mislead.
Debian, Ubuntu
dpkg -l | grep -i opa
# packages whose changelog names the CVE (fixed in the installed version)
zgrep -l CVE-2022-23628 /usr/share/doc/*/changelog.Debian.gz
# Ubuntu
pro fix CVE-2022-23628RHEL, Rocky, Alma, Fedora
rpm -q opa
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2022-23628Alpine
apk list --installed | grep -i opaWith Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2022-23628
trivy image --scanners vuln IMAGE | grep CVE-2022-23628
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Advisories
Other references
- https://github.com/open-policy-agent/opa/pull/3851 github.com
- https://github.com/open-policy-agent/opa/commit/932e4ffc37a590ace79e9b75ca4340288c220239 github.com
- https://github.com/open-policy-agent/opa/commit/bfd984ddf93ef2c4963a08d4fdadae0bcf1a3717 github.com
Source: the record CVE-2022-23628 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse