# CVE-2022-23628: Array literal misordering in github.com/open-policy-agent/opa

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 6.3
- **CVSS:** 6.3 (v3.1, CNA) `CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L`
- **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
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, login needed
- **EPSS:** 0.99% (percentile 61, 2026-11-26)
- **CWE:** CWE-682
- **Aliases:** GHSA-hcw3-j74m-qc58, GO-2022-0316
- **Published:** 2022-02-09T21:50:11.000Z
- **Modified:** 2026-06-17T04:30:31.040Z

## 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

## 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

- Go `github.com/open-policy-agent/opa`: affected \>= 0.33.1, \< 0.37.2; fixed 0.37.2 (osv)
- open-policy-agent opa: \>= 0.33.1, \< 0.37.0 (cvelist)

## Mitigation

- Upgrade github.com/open-policy-agent/opa to 0.37.2 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
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.
```

## 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.

## References

- vendor: <https://github.com/open-policy-agent/opa/security/advisories/GHSA-hcw3-j74m-qc58>
- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2022-23628>
- patch: <https://github.com/open-policy-agent/opa/pull/3851>
- patch: <https://github.com/open-policy-agent/opa/commit/932e4ffc37a590ace79e9b75ca4340288c220239>
- patch: <https://github.com/open-policy-agent/opa/commit/bfd984ddf93ef2c4963a08d4fdadae0bcf1a3717>
- patch: <https://github.com/open-policy-agent/opa/commit/2bd8edab9e10e2dc9cf76ae8335ced0c224f3055>
- other: <https://github.com/open-policy-agent/opa>
- other: <https://pkg.go.dev/vuln/GO-2022-0316>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2022-23628>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-hcw3-j74m-qc58> (license: <https://creativecommons.org/licenses/by/4.0/>)
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GO-2022-0316> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2022-23628> · JSON: <https://flawdb.com/api/v1/entries/CVE-2022-23628>
