# CVE-2022-39135: Apache Calcite: potential XEE attacks

> Attackers can exploit XML External Entity vulnerabilities in Apache Calcite SQL operators to read sensitive data or cause denial of service.

- **Severity:** Critical 9.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 11 Sep 2022
- **Updated:** 3 Aug 2024
- **Also known as:** GHSA-fj2m-w3wv-x9pr

## What is CVE-2022-39135?

CVE-2022-39135 is a critical vulnerability in Apache Calcite, published on 11 Sep 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Apache Calcite 1.22.0 introduced the SQL operators EXISTS_NODE, EXTRACT_XML, XML_TRANSFORM and EXTRACT_VALUE do not restrict XML External Entity references in their configuration, making them vulnerable to a potential XML External Entity (XXE) attack. Therefore any client exposing these operators, typically by using Oracle dialect (the first three) or MySQL dialect (the last one), is affected by this vulnerability (the extent of it will depend on the user under which the application is running). From Apache Calcite 1.32.0 onwards, Document Type Declarations and XML External Entity resolution are disabled on the impacted operators.

Weakness: CWE-611 (Improper Restriction of XML External Entity Reference)

## Which versions are affected by CVE-2022-39135?

2 open source packages ship an affected version, including org.apache.calcite:calcite-core. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.apache.calcite:calcite-core` | Maven | From 1.22.0 | 1.32.0 |
| `org.apache.calcite:calcite-core` | Maven | From 1.22.0 | 1.32.0 |

Products: Apache Calcite.

## How do I fix CVE-2022-39135?

Upgrade org.apache.calcite:calcite-core to 1.32.0 or later.

## Is CVE-2022-39135 being exploited?

There is no known exploitation of CVE-2022-39135 in the wild and no public exploit code.

## Other vulnerabilities in Apache Calcite

- [CVE-2026-46718](https://insights.sbomify.com/CVE-2026-46718/): Apache Calcite: A user-controled model can load arbitrary classes, leading to code execution (medium 6.5)
- [CVE-2020-13955](https://insights.sbomify.com/CVE-2020-13955/): Missing Authentication for Critical Function in Apache Calcite (medium 5.9)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-39135 and fix it if it is affected.

What it is: CVE-2022-39135 is a critical vulnerability in Apache Calcite, published on 11 Sep 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2022-39135 in the wild and no public exploit code.

Affected packages and fixed versions:
- org.apache.calcite:calcite-core (Maven): affected from 1.22.0; fixed in 1.32.0
- org.apache.calcite:calcite-core (Maven): affected from 1.22.0; fixed in 1.32.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2022-39135/ (Markdown: https://insights.sbomify.com/CVE-2022-39135/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2022-39135
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2022-39135
- OSV: https://osv.dev/vulnerability/CVE-2022-39135

---
From sbomify Insights: https://insights.sbomify.com/CVE-2022-39135/
Summaries are generated and may contain mistakes; the official description above is the record.
