Array literal misordering in github.com/open-policy-agent/opa
Key facts
- Attack vector
- Network
- Privileges required
- Low
- User interaction
- None
- Attack complexity
- Low
- Impact type
- —
- Confidentiality · integrity · availability
- Low · Low · Low
- Fix status
- Fixed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA and GitHub.
Summary
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.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- Poc
- Automatable
- No
- Technical impact
- Partial
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| open-policy-agent | opa | 0.33.1 to before 0.37.0 | 0.37.0 | Patch available | CNA |
| — | github.com/open-policy-agent/opa (Go) | 0.33.1 to before 0.37.2 | 0.37.2 | Patch available | GHSA-hcw3-j74m-qc58 |
- opa Vendoropen-policy-agent Affected 0.33.1 to before 0.37.0 Fixed in 0.37.0 Patch available CNA
- github.com/open-policy-agent/opa (Go) Vendor— Affected 0.33.1 to before 0.37.2 Fixed in 0.37.2 Patch available GHSA-hcw3-j74m-qc58
CPE configurations NVD · 1
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:openpolicyagent:open_policy_agent:*:*:*:*:*:*:*:* | 0.33.1 to before 0.37.0 | Vulnerable | open-policy-agent |
- cpe:2.3:a:openpolicyagent:open_policy_agent:*:*:*:*:*:*:*:* Versions 0.33.1 to before 0.37.0 Vulnerable ·open-policy-agent
Remediation
- Fix · CNA opa (open-policy-agent) Fixed in 0.37.0
- Fix · GHSA-hcw3-j74m-qc58 github.com/open-policy-agent/opa (Go) Fixed in 0.37.2 Advisory →
Timeline
- 2026-10-02 Threatist record created from CVE-2022-23628
- 2026-10-03 Alias added: GHSA-hcw3-j74m-qc58
References
Patch 3
More open-policy-agent Open Policy Agent vulnerabilities
- TI-2022-16508 OPA Compiler: Bypass of WithUnsafeBuiltins using `with` keyword to mock functions CVSS 3.1CRITICAL 9.8
- TI-2022-14552 An issue in the AST parser (ast/compile.go) of Open Policy Agent v0.10.2 allows attackers… CVSS 3.1HIGH 7.5
- TI-2022-11544 An issue in the component ast/parser.go of Open Policy Agent v0.39.0 causes the… CVSS 3.1HIGH 7.5
- TI-2024-07657 OPA SMB Force-Authentication CVSS 3.1HIGH 7.3
Sources
- CVE-2022-23628 · CVE Program
- CVE-2022-23628 · NVD
- FIRST EPSS
- GHSA-hcw3-j74m-qc58 · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences