# GHSA-9vx8-f5c4-862x: XML External Entity (XXE) vulnerability in apoc.import.graphml

> An XXE vulnerability in the Neo4j APOC plugin allows attackers to read local files and cause denial of service via crafted XML input.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 24 Feb 2023

## What is GHSA-9vx8-f5c4-862x?

GHSA-9vx8-f5c4-862x is a vulnerability in org.neo4j.procedure:apoc, published on 24 Feb 2023. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

### Impact
A XML External Entity (XXE) vulnerability found in the apoc.import.graphml procedure of APOC core plugin in Neo4j graph database. XML External Entity (XXE) injection occurs when the XML parser allows external entities to be resolved. The XML parser used by the apoc.import.graphml procedure was not configured in a secure way and therefore allowed this.

External entities can be used to read local files, send HTTP requests, and perform denial-of-service attacks on the application.

Abusing the XXE vulnerability enabled assessors to read local files remotely. Although with the level of privileges assessors had this was limited to one-line files. With the ability to write to the database, any file could have been read. Additionally, assessors noted, with local testing, the server could be crashed by passing in improperly formatted XML. 

### Patches
The users should aim to use the latest released version compatible with their Neo4j version. The minimum versions containing patch for this vulnerability is 4.4.0.14. 

### Workarounds
If you cannot upgrade the library, you can control the [allowlist](https://neo4j.com/docs/operations-manual/current/reference/configuration-settings/#config_dbms.security.procedures.allowlist)  of the  procedures that can be used in your system.

### For more information
If you have any questions or comments about this advisory:
* Open an issue in [neo4j-apoc-procedures](https://github.com/neo4j-contrib/neo4j-apoc-procedures)
* Email us at [security@neo4j.com](mailto:security@neo4j.com)

### Credits
We want to publicly recognise the contribution of Christopher Schneider – State Farm.

## Which versions are affected by GHSA-9vx8-f5c4-862x?

4 open source packages ship an affected version, including org.neo4j.procedure:apoc.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.neo4j.procedure:apoc` | Maven | All versions | 4.4.0.14 |
| `org.neo4j.procedure:apoc` | Maven | All versions | 4.4.0.14 |
| `org.neo4j.procedure:apoc` | Maven | From 5.0.0 | 5.5.0 |
| `org.neo4j.procedure:apoc` | Maven | From 5.0.0 | 5.5.0 |

## How do I fix GHSA-9vx8-f5c4-862x?

Upgrade org.neo4j.procedure:apoc to a fixed version for your release line: 4.4.0.14 or 5.5.0.

## Is GHSA-9vx8-f5c4-862x being exploited?

There is no known exploitation of GHSA-9vx8-f5c4-862x in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-9vx8-f5c4-862x and fix it if it is affected.

What it is: GHSA-9vx8-f5c4-862x is a vulnerability in org.neo4j.procedure:apoc, published on 24 Feb 2023. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-9vx8-f5c4-862x in the wild and no public exploit code.

Affected packages and fixed versions:
- org.neo4j.procedure:apoc (Maven): affected all versions; fixed in 4.4.0.14
- org.neo4j.procedure:apoc (Maven): affected all versions; fixed in 4.4.0.14
- org.neo4j.procedure:apoc (Maven): affected from 5.0.0; fixed in 5.5.0
- org.neo4j.procedure:apoc (Maven): affected from 5.0.0; fixed in 5.5.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/GHSA-9vx8-f5c4-862x/ (Markdown: https://insights.sbomify.com/GHSA-9vx8-f5c4-862x/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-9vx8-f5c4-862x

---
From sbomify Insights: https://insights.sbomify.com/GHSA-9vx8-f5c4-862x/
Summaries are generated and may contain mistakes; the official description above is the record.
