CVE-2022-23628
Array literal misordering in github.com/open-policy-agent/opa
Also known as GHSA-hcw3-j74m-qc58, GO-2022-0316
Mitigation
- Upgrade github.com/open-policy-agent/opa to 0.37.2 or later.
Who should check
- Projects that depend on Go package github.com/open-policy-agent/opa (>= 0.33.1, < 0.37.2)
- Anyone running open-policy-agent opa >= 0.33.1, < 0.37.0
Vulnerability facts
- Affected
- github.com/open-policy-agent/opa >= 0.33.1, < 0.37.2
- Fixed in
- 0.37.2
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Remote, login needed
- CVSS
- 6.3 (v3.1, CNA)CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:LOpen in CVSS calculator
Show all 8 CVSS metrics
- Attack vector: Network
- Attack complexity: Low
- Privileges required: Low
- User interaction: None
- Scope: Unchanged
- Confidentiality impact: Low
- Integrity impact: Low
- Availability impact: Low
- EPSS
- 0.99% chance of exploitation in 30 days (percentile 61, 2026-11-26)
- CWE
- CWE-682
- Modified
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.
Affected and fixed versions
| Package / product | Affected | Fixed | Source |
|---|---|---|---|
| Go github.com/open-policy-agent/opa | >= 0.33.1, < 0.37.2 | 0.37.2 | osv |
| open-policy-agent opa | >= 0.33.1, < 0.37.0 | — | cvelist |
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2022-23628. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2022-23628.md Affected: github.com/open-policy-agent/opa >= 0.33.1, < 0.37.2 Fixed in: 0.37.2 Steps: 1. Search this machine and project for github.com/open-policy-agent/opa (Go), open-policy-agent opa: dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
References
Vendor advisories
Patches
- https://github.com/open-policy-agent/opa/pull/3851
- https://github.com/open-policy-agent/opa/commit/932e4ffc37a590ace79e9b75ca4340288c220239
- https://github.com/open-policy-agent/opa/commit/bfd984ddf93ef2c4963a08d4fdadae0bcf1a3717
- https://github.com/open-policy-agent/opa/commit/2bd8edab9e10e2dc9cf76ae8335ced0c224f3055
FAQ
Is CVE-2022-23628 being exploited?
There is no confirmed exploitation: CVE-2022-23628 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.99% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2022-23628?
Medium: CVSS 6.3 (v3.1, scored by CNA). Remote, login needed.
Which versions are affected by CVE-2022-23628?
github.com/open-policy-agent/opa >= 0.33.1, < 0.37.2.
Is there a fix for CVE-2022-23628?
Yes. Fixed in 0.37.2. Upgrade github.com/open-policy-agent/opa to 0.37.2 or later.
How do I check if I'm affected by CVE-2022-23628?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.