# CVE-2024-55875: http4k has a potential XXE (XML External Entity Injection) vulnerability

> Attackers can exploit XML parsing flaws in http4k to read local files, trigger SSRF, or cause denial of service via entity expansion.

- **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:** 12 Dec 2024
- **Updated:** 9 Jun 2026
- **Also known as:** GHSA-7mj5-hjjj-8rgw

## What is CVE-2024-55875?

CVE-2024-55875 is a critical vulnerability in http4k, published on 12 Dec 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

http4k is a functional toolkit for Kotlin HTTP applications. Prior to version 6.50.0.0, there is a potential XXE (XML External Entity Injection) vulnerability when http4k handling malicious XML contents within requests, which might allow attackers to read local sensitive information on server, trigger Server-side Request Forgery and even execute code under some circumstances. The original fix shipped in v5.41.0.0 / v4.50.0.0 closed the documented external-entity attack class (SSRF, local-file disclosure, code execution) by setting `ACCESS_EXTERNAL_DTD=""`, `ACCESS_EXTERNAL_SCHEMA=""`, and `isExpandEntityReferences=false` on the default `DocumentBuilderFactory`. A residual gap remained: the parser still accepted documents containing `<!DOCTYPE>` declarations even though external entity resolution was blocked. This left open billion-laughs-style internal entity expansion DoS attacks against any application using `Body.xml()` or `Document.asXmlDocument()` on untrusted XML. v6.50.0.0 closes this residual by adding `disallow-doctype-decl=true` and `FEATURE_SECURE_PROCESSING=true` to `defaultXmlParsingConfig`. Any document containing a `<!DOCTYPE>` is now rejected at parse time.

Weakness: CWE-918 (Server-Side Request Forgery), CWE-611 (Improper Restriction of XML External Entity Reference), CWE-200 (Exposure of Sensitive Information to an Unauthorized Actor)

## Which versions are affected by CVE-2024-55875?

2 open source packages ship an affected version, including org.http4k:http4k-format-xml.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.http4k:http4k-format-xml` | Maven | All versions | 6.50.0.0 |
| `org.http4k:http4k-format-xml` | Maven | All versions | 6.50.0.0 |

## How do I fix CVE-2024-55875?

Upgrade org.http4k:http4k-format-xml to 6.50.0.0 or later.

## Is CVE-2024-55875 being exploited?

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

Public exploit code:

- CVE-2024-55875 | GHSA-7mj5-hjjj-8rgw | http4k first CVE (github_poc): https://github.com/JAckLosingHeart/CVE-2024-55875

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-55875 and fix it if it is affected.

What it is: CVE-2024-55875 is a critical vulnerability in http4k, published on 12 Dec 2024. 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-2024-55875 exists.

Affected packages and fixed versions:
- org.http4k:http4k-format-xml (Maven): affected all versions; fixed in 6.50.0.0
- org.http4k:http4k-format-xml (Maven): affected all versions; fixed in 6.50.0.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-2024-55875/ (Markdown: https://insights.sbomify.com/CVE-2024-55875/index.md)
```

## Sources

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

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