# CVE-2017-12629: Remote code execution occurs in Apache Solr

> Attackers can achieve remote code execution and read arbitrary files via XXE in the XML Query Parser and Config API listener.

- **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:** 14 Oct 2017
- **Updated:** 5 Aug 2024
- **Also known as:** DEBIAN-CVE-2017-12629, DLA-1254-1, GHSA-mh7g-99w9-xpjm, MGASA-2017-0403, RHSA-2017:3123, RHSA-2017:3451, RHSA-2017:3452, UBUNTU-CVE-2017-12629, USN-4259-1

## What is CVE-2017-12629?

CVE-2017-12629 is a critical vulnerability in Canonical Ubuntu Linux, published on 14 Oct 2017. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Remote code execution occurs in Apache Solr before 7.1 with Apache Lucene before 7.1 by exploiting XXE in conjunction with use of a Config API add-listener command to reach the RunExecutableListener class. Elasticsearch, although it uses Lucene, is NOT vulnerable to this. Note that the XML external entity expansion vulnerability occurs in the XML Query Parser which is available, by default, for any query request with parameters deftype=xmlparser and can be exploited to upload malicious data to the /upload request handler or as Blind XXE using ftp wrapper in order to read arbitrary local files from the Solr server. Note also that the second vulnerability relates to remote code execution using the RunExecutableListener available on all affected versions of Solr.

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

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

6 open source packages ship an affected version, including org.apache.solr:solr-core. It affects 4 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.apache.solr:solr-core` | Maven | From 5.5.0 | 5.5.5 |
| `org.apache.solr:solr-core` | Maven | From 5.5.0 | 5.5.5 |
| `org.apache.solr:solr-core` | Maven | From 6.0.0 | 6.6.2 |
| `org.apache.solr:solr-core` | Maven | From 6.0.0 | 6.6.2 |
| `org.apache.solr:solr-core` | Maven | From 7.0.0 | 7.1.0 |
| `org.apache.solr:solr-core` | Maven | From 7.0.0 | 7.1.0 |
| `eap7-lucene-analyzers-common` | Red Hat:jboss_enterprise_application_platform:7::el6 | All versions | 0:5.3.1-4.redhat_2.1.ep7.el6 |
| `eap7-lucene-backward-codecs` | Red Hat:jboss_enterprise_application_platform:7::el6 | All versions | 0:5.3.1-4.redhat_2.1.ep7.el6 |
| `eap7-lucene-core` | Red Hat:jboss_enterprise_application_platform:7::el6 | All versions | 0:5.3.1-4.redhat_2.1.ep7.el6 |
| `eap7-lucene-facet` | Red Hat:jboss_enterprise_application_platform:7::el6 | All versions | 0:5.3.1-4.redhat_2.1.ep7.el6 |
| `eap7-lucene-misc` | Red Hat:jboss_enterprise_application_platform:7::el6 | All versions | 0:5.3.1-4.redhat_2.1.ep7.el6 |
| `eap7-lucene-queries` | Red Hat:jboss_enterprise_application_platform:7::el6 | All versions | 0:5.3.1-4.redhat_2.1.ep7.el6 |
| `eap7-lucene-queryparser` | Red Hat:jboss_enterprise_application_platform:7::el6 | All versions | 0:5.3.1-4.redhat_2.1.ep7.el6 |
| `eap7-lucene-solr` | Red Hat:jboss_enterprise_application_platform:7::el6 | All versions | 0:5.3.1-4.redhat_2.1.ep7.el6 |
| `eap7-lucene-analyzers-common` | Red Hat:jboss_enterprise_application_platform:7::el7 | All versions | 0:5.3.1-4.redhat_2.1.ep7.el7 |
| `eap7-lucene-backward-codecs` | Red Hat:jboss_enterprise_application_platform:7::el7 | All versions | 0:5.3.1-4.redhat_2.1.ep7.el7 |
| `eap7-lucene-core` | Red Hat:jboss_enterprise_application_platform:7::el7 | All versions | 0:5.3.1-4.redhat_2.1.ep7.el7 |
| `eap7-lucene-facet` | Red Hat:jboss_enterprise_application_platform:7::el7 | All versions | 0:5.3.1-4.redhat_2.1.ep7.el7 |
| `eap7-lucene-misc` | Red Hat:jboss_enterprise_application_platform:7::el7 | All versions | 0:5.3.1-4.redhat_2.1.ep7.el7 |
| `eap7-lucene-queries` | Red Hat:jboss_enterprise_application_platform:7::el7 | All versions | 0:5.3.1-4.redhat_2.1.ep7.el7 |
| `eap7-lucene-queryparser` | Red Hat:jboss_enterprise_application_platform:7::el7 | All versions | 0:5.3.1-4.redhat_2.1.ep7.el7 |
| `eap7-lucene-solr` | Red Hat:jboss_enterprise_application_platform:7::el7 | All versions | 0:5.3.1-4.redhat_2.1.ep7.el7 |
| `rh-java-common-lucene` | Red Hat:rhel_software_collections:3::el6 | All versions | 0:4.8.0-6.9.el6 |
| `rh-java-common-lucene-analysis` | Red Hat:rhel_software_collections:3::el6 | All versions | 0:4.8.0-6.9.el6 |
| `rh-java-common-lucene-analyzers-phonetic` | Red Hat:rhel_software_collections:3::el6 | All versions | 0:4.8.0-6.9.el6 |
| `rh-java-common-lucene-analyzers-smartcn` | Red Hat:rhel_software_collections:3::el6 | All versions | 0:4.8.0-6.9.el6 |
| `rh-java-common-lucene-analyzers-stempel` | Red Hat:rhel_software_collections:3::el6 | All versions | 0:4.8.0-6.9.el6 |
| `rh-java-common-lucene-classification` | Red Hat:rhel_software_collections:3::el6 | All versions | 0:4.8.0-6.9.el6 |
| `rh-java-common-lucene-codecs` | Red Hat:rhel_software_collections:3::el6 | All versions | 0:4.8.0-6.9.el6 |
| `rh-java-common-lucene-facet` | Red Hat:rhel_software_collections:3::el6 | All versions | 0:4.8.0-6.9.el6 |
| `rh-java-common-lucene-grouping` | Red Hat:rhel_software_collections:3::el6 | All versions | 0:4.8.0-6.9.el6 |
| `rh-java-common-lucene-highlighter` | Red Hat:rhel_software_collections:3::el6 | All versions | 0:4.8.0-6.9.el6 |
| `rh-java-common-lucene-javadoc` | Red Hat:rhel_software_collections:3::el6 | All versions | 0:4.8.0-6.9.el6 |
| `rh-java-common-lucene-join` | Red Hat:rhel_software_collections:3::el6 | All versions | 0:4.8.0-6.9.el6 |
| `rh-java-common-lucene-memory` | Red Hat:rhel_software_collections:3::el6 | All versions | 0:4.8.0-6.9.el6 |
| `rh-java-common-lucene-misc` | Red Hat:rhel_software_collections:3::el6 | All versions | 0:4.8.0-6.9.el6 |
| `rh-java-common-lucene-parent` | Red Hat:rhel_software_collections:3::el6 | All versions | 0:4.8.0-6.9.el6 |
| `rh-java-common-lucene-queries` | Red Hat:rhel_software_collections:3::el6 | All versions | 0:4.8.0-6.9.el6 |
| `rh-java-common-lucene-queryparser` | Red Hat:rhel_software_collections:3::el6 | All versions | 0:4.8.0-6.9.el6 |
| `rh-java-common-lucene-replicator` | Red Hat:rhel_software_collections:3::el6 | All versions | 0:4.8.0-6.9.el6 |

Products: Apache Solr, Canonical Ubuntu Linux, Debian Debian Linux, Redhat Jboss Enterprise Application Platform.

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

Upgrade org.apache.solr:solr-core to a fixed version for your release line: 5.5.5, 6.6.2 or 7.1.0.

## Is CVE-2017-12629 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2017-12629 exists.

Public exploit code:

- Apache Solr 7.0.1 - XML External Entity Expansion / Remote Code Execution (exploitdb)
- Remote code execution occurs in Apache Solr before 7.1 with Apache Lucene before 7.1 by exploiting XXE in conjunction with use of a Config API add-listener command to reach the RunExecutableListener class. (github_poc): https://github.com/captain-woof/cve-2017-12629
- Vulhub solr/CVE-2017-12629-RCE: Apache Solr RunExecutableListener RCE (CVE-2017-12629), run with Isoloom (github_poc): https://github.com/CyberCTF/vulhub-solr-cve-2017-12629-rce
- Apache Solr <= 7.1 - XML Entity Injection (nuclei): http/cves/2017/CVE-2017-12629.yaml

## Other vulnerabilities in Canonical Ubuntu Linux

- [CVE-2019-17558](https://insights.sbomify.com/CVE-2019-17558/): Apache Solr VelocityResponseWriter Plug-In Remote Code Execution (high 7.5, exploited in the wild)
- [CVE-2019-0193](https://insights.sbomify.com/CVE-2019-0193/): Apache Solr DataImportHandler Code Injection (high 7.2, exploited in the wild)
- [CVE-2024-45216](https://insights.sbomify.com/CVE-2024-45216/): Apache Solr: Authentication bypass possible using a fake URL Path ending (critical 9.8)
- [CVE-2021-44548](https://insights.sbomify.com/CVE-2021-44548/): Apache Solr information disclosure vulnerability through DataImportHandler (critical 9.8)
- [CVE-2021-27905](https://insights.sbomify.com/CVE-2021-27905/): SSRF vulnerability with the Replication handler (critical 9.8)

## Fix prompt for AI coding agents

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

What it is: CVE-2017-12629 is a critical vulnerability in Canonical Ubuntu Linux, published on 14 Oct 2017. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2017-12629 exists.

Affected packages and fixed versions:
- org.apache.solr:solr-core (Maven): affected from 5.5.0; fixed in 5.5.5
- org.apache.solr:solr-core (Maven): affected from 5.5.0; fixed in 5.5.5
- org.apache.solr:solr-core (Maven): affected from 6.0.0; fixed in 6.6.2
- org.apache.solr:solr-core (Maven): affected from 6.0.0; fixed in 6.6.2
- org.apache.solr:solr-core (Maven): affected from 7.0.0; fixed in 7.1.0
- org.apache.solr:solr-core (Maven): affected from 7.0.0; fixed in 7.1.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-2017-12629/ (Markdown: https://insights.sbomify.com/CVE-2017-12629/index.md)
```

## Sources

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

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