GitHub Advisoryadvisory · Maven
GHSA-7mj5-hjjj-8rgw http4k has a potential XXE (XML External Entity Injection) vulnerability
CRITICAL
Official page ↗
- Aliases
- CVE-2024-55875
- Ecosystem
- Maven
- Packages
- org.http4k:http4k-format-xml
- Severity
- Critical
- CVSS vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- Weaknesses
- CWE-200, CWE-611, CWE-918
- Reviewed
- 2024-12-12
Affected packages
• Maven org.http4k:http4k-format-xml: < 6.50.0.0 → fixed in 6.50.0.0
Description
Summary
_Short summary of the problem. Make the impact and severity as clear as possible. For example: An unsafe deserialization vulnerability allows any unauthenticated user to execute arbitrary code on the server._
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.
Details
_Give all details on the vulnerability. Pointing to the incriminated source code is very helpful for the maintainer._
https://github.com/http4k/http4k/blob/25696dff2d90206cc1da42f42a1a8dbcdbcdf18c/core/format/xml/src/main/kotlin/org/http4k/format/Xml.kt#L42-L46
XML contents is parsed with DocumentBuilder without security settings on or external entity enabled
PoC
_Complete instructions, including specific configuration details, to reproduce the vulnerability._
Example Vulnerable server code:
```
import org.http4k.core.*
import org.http4k.format.Xml.xml
import org.http4k.server.Netty
import org.http4k.server.asServer
import org.w3c.dom.Document
fun main() {
val xmlLens = Body.xml().toLens()
// Create an HTTP handler
val app: HttpHandler = { request ->
try {
// Parse the incoming XML payload to a Document object
val xmlDocument: Document = xmlLens(request)
// Extract root element name or other details from the XML
val rootElementName = xmlDocument.documentElement.nodeName
// Create a response XML based on the extracted information
val responseXml = """
Root element is: $rootElementName
""".trimIndent()
// Respond with XML
Response(Status.OK).body(responseXml).header("Content-Type", "application/xml")
} catch (e: Exception) {
// Handle invalid XML or other errors
Response(Status.BAD_REQUEST).body("Invalid XML: ${e.message}")
}
}
// Start the server
val server = app.asServer(Netty(9000)).start()
println("Server started on http://localhost:9000")
}
```
Maven dependency:
```
org.jetbrains.kotlin
kotlin-test-junit5
1.9.0
test
org.junit.jupiter
junit-jupiter-engine
5.10.0
test
org.jetbrains.kotlin
kotlin-stdlib
1.9.0
org.http4k
http4k-core
5.40.0.0
org.http4k
http4k-format-xml
5.40.0.0
org.http4k
http4k-server-netty
5.40.0.0
```
Exploit payload example to trigger SSRF
`curl -X POST http://localhost:9000 -H "Content-Type: application/xml" -d "]>&xxe;"`
Impact
_What kind of vulnerability is it? Who is impacted?_
The servers that employ this XML parsing feature of http4k are vulnerable to this XXE vulnerability
Follow-up patch — v6.50.0.0 (May 2026)
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 `` 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 `` is now rejected at parse time.
Follow-up affected & fixed versions
| Version | Fixed Version |
|---------|---------------|
| `>= 5.41.0.0, ` rejection and billion-laughs payload rejection |
| 31/05/2026 18:06 | http4k v6.50.0.0 released to Maven Central |
Related
Alias · CVE (1)
- CVE-2024-55875 http4k is a functional toolkit for Kotlin HTTP applications. vulnerability
References
- https://github.com/http4k/http4k/security/advisories/GHSA-7mj5-hjjj-8rgw web
- https://nvd.nist.gov/vuln/detail/CVE-2024-55875 advisory
- https://github.com/http4k/http4k/commit/35297adc6d6aca4951d50d8cdf17ff87a8b19fbc web
- https://github.com/http4k/http4k package
- https://github.com/http4k/http4k/blob/25696dff2d90206cc1da42f42a1a8dbcdbcdf18c/core/format/xml/src/main/kotlin/org/http4k/format/Xml.kt#L42-L46 web