# CVE-2017-12620: Improper Restriction of XML External Entity Reference in Apache OpenNLP

> Attackers can perform XML External Entity attacks by loading malicious models or dictionaries, potentially reading sensitive data or causing denial of service.

- **Severity:** Critical 9.8 (`CVSS:3.0/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:** 2 Oct 2017
- **Updated:** 16 Sep 2024
- **Also known as:** GHSA-h22x-hm8g-rxpg

## What is CVE-2017-12620?

CVE-2017-12620 is a critical vulnerability in Apache OpenNLP, published on 2 Oct 2017. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

When loading models or dictionaries that contain XML it is possible to perform an XXE attack, since Apache OpenNLP is a library, this only affects applications that load models or dictionaries from untrusted sources. The versions 1.5.0 to 1.5.3, 1.6.0, 1.7.0 to 1.7.2, 1.8.0 to 1.8.1 of Apache OpenNLP are affected.

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

## Which versions are affected by CVE-2017-12620?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.apache.opennlp:opennlp-tools` | Maven | From 1.5.0 | 1.8.2 |
| `org.apache.opennlp:opennlp-tools` | Maven | From 1.5.0 | 1.8.2 |

Products: Apache Opennlp.

## How do I fix CVE-2017-12620?

Upgrade org.apache.opennlp:opennlp-tools to 1.8.2 or later.

## Is CVE-2017-12620 being exploited?

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

## Other vulnerabilities in Apache OpenNLP

- [CVE-2026-82617](https://insights.sbomify.com/CVE-2026-82617/): Apache OpenNLP, Apache OpenNLP: ReDoS / stack exhaustion in RegexNameFinderFactory built-in EMAIL and URL patterns (critical 10.0)
- [CVE-2026-42027](https://insights.sbomify.com/CVE-2026-42027/): Apache OpenNLP: Arbitrary Class Instantiation via Model Manifest in ExtensionLoader (critical 9.8)
- [CVE-2026-40682](https://insights.sbomify.com/CVE-2026-40682/): Apache OpenNLP: XXE via Dictionary Parsing in DictionaryEntryPersistor (critical 9.1)
- [CVE-2026-67211](https://insights.sbomify.com/CVE-2026-67211/): Apache OpenNLP: OOM DoS via Unbounded Array Allocation in SymSpellModelSerializer (high 7.5)
- [CVE-2026-42440](https://insights.sbomify.com/CVE-2026-42440/): Apache OpenNLP: OOM DoS via Unbounded Array Allocation in AbstractModelReader (high 7.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2017-12620 and fix it if it is affected.

What it is: CVE-2017-12620 is a critical vulnerability in Apache OpenNLP, published on 2 Oct 2017. 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-2017-12620 in the wild and no public exploit code.

Affected packages and fixed versions:
- org.apache.opennlp:opennlp-tools (Maven): affected from 1.5.0; fixed in 1.8.2
- org.apache.opennlp:opennlp-tools (Maven): affected from 1.5.0; fixed in 1.8.2

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-2017-12620/ (Markdown: https://insights.sbomify.com/CVE-2017-12620/index.md)
```

## Sources

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

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