CVE-2022-23628
CVE-2022-23628 is a medium-severity vulnerability in Openpolicyagent Open Policy Agent with a CVSS 3.x base score of 6.3. It is not currently listed as actively exploited by CISA, and its EPSS exploit-prediction score is low. The underlying weakness is classified as CWE-682.
Key facts
- Severity: Medium (CVSS 3.x base score 6.3)
- CVSS v2: 4.3
- EPSS exploit prediction: 1% (60th percentile)
- Actively exploited: Not listed in CISA KEV
- Weakness: CWE-682
- Affected product: Openpolicyagent Open Policy Agent
- Published:
- Last 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.
Frequently asked questions
- What is CVE-2022-23628?
- 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.
- How severe is CVE-2022-23628?
- CVE-2022-23628 has a CVSS 3.x base score of 6.3, rated medium severity. It is exploitable over network with low attack complexity, requires low privileges and no user interaction. Impact on confidentiality is low, integrity low, and availability low.
- Is CVE-2022-23628 being actively exploited?
- It is not currently listed in CISA's KEV catalog. Its EPSS exploit-prediction score is 1% (60th percentile), an estimate of the probability of exploitation in the next 30 days.
- What products are affected by CVE-2022-23628?
- CVE-2022-23628 affects Openpolicyagent Open Policy Agent. See the affected-products list for the exact vulnerable versions.
- How do I fix CVE-2022-23628?
- Review the linked vendor and NVD advisories for patched versions and mitigations, then upgrade or apply the recommended workaround.
- When was CVE-2022-23628 published?
- CVE-2022-23628 was published on 2022-02-09 and last updated on 2026-06-17.
References
- 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/pull/3851
- https://github.com/open-policy-agent/opa/security/advisories/GHSA-hcw3-j74m-qc58
Affected products (1)
- cpe:2.3:a:openpolicyagent:open_policy_agent:*:*:*:*:*:*:*:*
More vulnerabilities in Openpolicyagent Open Policy Agent
- CVE-2022-33082 — High (CVSS 7.5): An issue in the AST parser (ast/compile.go) of Open Policy Agent v0.10.2 allows attackers to cause a Denial of Service…
- CVE-2022-28946 — High (CVSS 7.5): An issue in the component ast/parser.go of Open Policy Agent v0.39.0 causes the application to incorrectly interpret…
- CVE-2022-36085 — High (CVSS 7.4): Open Policy Agent (OPA) is an open source, general-purpose policy engine. The Rego compiler provides a (deprecated)…
- CVE-2024-8260 — Medium (CVSS 6.1): A SMB force-authentication vulnerability exists in all versions of OPA for Windows prior to v0.68.0. The vulnerability…
All CVEs affecting Openpolicyagent Open Policy Agent →
Other CWE-682 vulnerabilities
- CVE-2023-2163 — Critical (CVSS 10.0): Incorrect verifier pruning in BPF in Linux Kernel >=5.4 leads to unsafe code paths being incorrectly marked as safe,…
- CVE-2026-1229 — Critical (CVSS 9.8): The CombinedMult function in the CIRCL ecc/p384 package (secp384r1 curve) produces an incorrect value for specific…
- CVE-2024-36736 — Critical (CVSS 9.8): An issue in the oneflow.permute component of OneFlow-Inc. Oneflow v0.9.1 causes an incorrect calculation when the same…
- CVE-2022-30600 — Critical (CVSS 9.8): A flaw was found in moodle where logic used to count failed login attempts could result in the account lockout…
- CVE-2021-44847 — Critical (CVSS 9.8): A stack-based buffer overflow in handle_request function in DHT.c in toxcore 0.1.9 through 0.1.11 and 0.2.0 through…
- CVE-2020-0221 — Critical (CVSS 9.8): Airbrush FW's scratch memory allocator is susceptible to numeric overflow. When the overflow occurs, the next…