http4s-scala-xml provides EntityDecoder[F, scala.xml.Elem] instances that parse XML message bodies. These decoders used a javax.xml.parsers.SAXParserFactory obtained from SAXParserFactory.newInstance without any security configuration. With the JDK's default settings, the parser resolves DOCTYPE declarations, external general and parameter entities, and external DTDs.
An application that uses these decoders to parse untrusted XML is vulnerable to XML External Entity (XXE) attacks. An attacker can craft a request that:
Any service that derives an XML EntityDecoder from this library and parses attacker-controlled input is affected.
The default SAXParserFactory is now hardened:
DOCTYPE declarations are disallowedThese defaults match scala.xml.XMLLoader's defaults since 2.0.0.
Before upgrading, override ElemInstances#saxFactory with a hardened factory.
val secured = new ElemInstances {
override protected val saxFactory = {
val f = javax.xml.parsers.SAXParserFactory.newInstance
f.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true)
// etc.
f
}
}
import secured._
{
"cwe_ids": [
"CWE-611"
],
"github_reviewed": true,
"github_reviewed_at": "2026-09-24T19:35:16Z",
"nvd_published_at": "2026-09-24T18:17:16Z",
"severity": "CRITICAL"
}