Sep 25, 2026·6 min read·19 visits
An unauthenticated remote code-execution and disclosure vulnerability (XXE) exists in http4s-scala-xml due to an unhardened SAXParserFactory. Attackers can exploit this to read local host files, target internal networks via SSRF, or trigger denial of service via CPU/memory exhaustion.
CVE-2026-61741 is a critical XML External Entity (XXE) injection vulnerability in the http4s-scala-xml library. The vulnerability allows remote, unauthenticated attackers to perform arbitrary local file disclosure, execute server-side request forgery (SSRF) attacks, or cause denial of service via recursive entity expansion. The vulnerability stems from the use of an unconfigured SAXParserFactory, which enables external entity resolution by default.
The library http4s-scala-xml is an integration component in the http4s ecosystem. It is designed to facilitate the parsing and serialization of XML payloads in Scala-based HTTP services. To achieve this, it provides an implicit EntityDecoder that parses incoming request bytes directly into Scala scala.xml.Elem objects. By default, applications exposing endpoints that accept XML payloads depend on this decoder to process user input without additional validation.
Historically, the library relied on the default configuration of the Java Runtime Environment's XML processing utilities. Specifically, it initialized javax.xml.parsers.SAXParserFactory using default parameters, which do not restrict external entity resolution. This creates an attack surface where any unauthenticated client capable of sending HTTP requests to an XML endpoint can control the input parsed by the underlying JVM parser.
The vulnerability is classified under CWE-611 (Improper Restriction of XML External Entity Reference). The impact of this security gap includes arbitrary local file read access, resource starvation via nested entity loops, or outbound network pivoting via server-side request forgery. Because the parser boundaries cross the application context to local OS resources and network endpoints, the vulnerability has been assigned a CVSS v3.1 base score of 9.3.
The root cause of this vulnerability lies in the default configuration behavior of the Java Virtual Machine's built-in SAX parser factory. When an application instantiates a parser factory using SAXParserFactory.newInstance, the underlying JVM relies on the platform's default provider, which is typically Apache Xerces. By default, Xerces is configured to process DOCTYPE declarations, resolve external parameter and general entities, and load external Document Type Definitions (DTDs).
In the vulnerable codebase, the scalaxml package object defined its factory as override val saxFactory = SAXParserFactory.newInstance. This global parser factory instance was then shared across all parsing operations triggered by the implicit XML entity decoder. Since no security features were explicitly enabled on this factory, the standard security controls mandated for handling untrusted input were entirely absent.
When the parser processes a document containing an inline DOCTYPE definition with a SYSTEM identifier, it attempts to fetch the target resource. If the identifier points to a local file path, the parser reads the file from the local file system using the privileges of the active JVM process. If the identifier points to a remote URL, the parser initiates an outbound HTTP request, making the system highly vulnerable to unauthorized internal network discovery.
A detailed inspection of the vulnerability patch in commit 326f965a2c45fc2ddbc22545dcf551b0f719f4c8 reveals the vulnerable pattern and the corresponding remediation. The vulnerable implementation in scala-xml/src/main/scala/org/http4s/scalaxml/package.scala was defined as follows:
package object scalaxml extends ElemInstances {
override val saxFactory = SAXParserFactory.newInstance
}The patch replaces this line with an explicitly hardened initializer block that disables multiple insecure XML capabilities. Below is the patched code showing how features are disabled to enforce secure processing:
package object scalaxml extends ElemInstances {
override val saxFactory = {
val parserFactory = SAXParserFactory.newInstance
// Enable Secure Processing to limit entity expansion limits
parserFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true)
// Disable external DTD loading
parserFactory.setFeature(
"http://apache.org/xml/features/nonvalidating/load-external-dtd",
false,
)
// Reject DOCTYPE declarations completely
parserFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true)
// Stop resolution of external general entities
parserFactory.setFeature("http://xml.org/sax/features/external-general-entities", false)
// Stop resolution of external parameter entities
parserFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false)
// Disable DTD URI resolution
parserFactory.setFeature("http://xml.org/sax/features/resolve-dtd-uris", false)
// Disable XML Inclusion mechanisms
parserFactory.setXIncludeAware(false)
parserFactory.setNamespaceAware(false)
parserFactory
}
}The most important security control introduced here is the disallow-doctype-decl feature set to true. This instructs the parser to immediately halt processing and throw a parsing exception if the XML input contains a <!DOCTYPE structure. Disabling parameter and general entities serves as a secondary layer of defense in depth, ensuring protection even if some child classes bypass the DOCTYPE restriction.
Exploitation of this vulnerability requires network access to any HTTP route configured to consume XML bodies. The target route must use the implicit xmlDecoder to parse the request payload. No authentication is required to interact with the XML parser if the route itself is publicly accessible.
An attacker seeking to read arbitrary files from the server hosts a request containing a customized DTD. The payload specifies the target local file using a SYSTEM URI, then references the defined entity in the main body. If the application processes the XML and includes the parsed elements inside its HTTP response or an application log, the content of the file is rendered back to the attacker.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<root>
<data>&xxe;</data>
</root>If the application does not reflect the input (blind XXE), the attacker can execute Server-Side Request Forgery. By supplying an internal network URL in the SYSTEM entity definition, the attacker forces the JVM parser to perform GET requests against internal assets, potentially exposing cloud service provider metadata endpoints. Furthermore, recursive entity expansion, or the Billion Laughs attack, can be sent to cause the server's heap to exhaust, inducing a denial of service.
The impact of successful exploitation is severe and varies depending on the local file permissions and the internal network architecture. An attacker can access configuration files, database credentials, server certificates, and private key files stored on the host filesystem. This is limited only by the operating system user permissions under which the JVM process runs.
In containerized or cloud-hosted environments, SSRF vectors pose a significant escalation path. An attacker can query metadata service endpoints such as http://169.254.169.254/latest/meta-data/ to retrieve temporary IAM credentials. These credentials can then be used to compromise the wider cloud infrastructure hosting the vulnerable container.
Finally, the threat of denial of service via XML entity expansion remains high for unpatched systems. A single small request can expand into gigabytes of data in memory. This resource consumption triggers intensive garbage collection pauses and eventually leads to an OutOfMemoryError, crashing the server process and causing downtime.
The vulnerability is remediated by upgrading the http4s-scala-xml dependency to version 0.24.1 for the 0.24.x series, or version 1.0.0-M39 for the 1.x.x milestone series. These releases hard-code secure settings directly on the shared SAXParserFactory instance, removing the insecure defaults.
If upgrading is not an immediate option, developers can mitigate the risk by manually declaring a secured SAXParserFactory inside their project scope. This custom factory must explicitly define features disabling DTDs, parameter entities, and external general entities. This secure factory can then be wrapped into a custom implicit EntityDecoder to override the vulnerable default decoder.
The fix applied in commit 326f965a2c45fc2ddbc22545dcf551b0f719f4c8 is complete. It blocks XML External Entities, parameter entities, and disables XML Inclusion (XInclude) and XML namespaces. Because disallow-doctype-decl is set to true, all adjacent exploitation techniques utilizing DTD-based validation or external schemas are neutralized.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:L| Product | Affected Versions | Fixed Version |
|---|---|---|
http4s-scala-xml http4s | < 0.24.1 | 0.24.1 |
http4s-scala-xml http4s | >= 1.0.0-M1, < 1.0.0-M39 | 1.0.0-M39 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-611 |
| Attack Vector | Network |
| CVSS v3.1 Score | 9.3 |
| Impact | Confidentiality: High, Availability: Low, Integrity: None |
| Exploit Status | poc |
| KEV Status | Not Listed |
The software associates an XML document with an external entity reference but does not restrict or securely configure the parser, allowing it to retrieve external resources.
An uncontrolled memory allocation vulnerability exists in ag-psd versions prior to 31.0.0. When parsing Adobe Photoshop Document (PSD) files, the readPsd() function reads image dimensions and color depth directly from the file header and allocates off-heap typed arrays without validating whether the requested memory size is proportional to the input stream or bounded by operational thresholds. An unauthenticated attacker can supply a crafted 52-byte PSD payload that triggers an immediate 3.35 GB memory allocation, resulting in process termination via the operating system Out-Of-Memory (OOM) killer.
CVE-2026-126297 (GHSA-v8f3-6phw-6mh9) is an uncontrolled resource consumption and algorithmic complexity vulnerability in the Natural Language Toolkit (NLTK) prior to version 3.10.4. Located in the Semantic Role Labeling (SRL) parser within `nltk/corpus/reader/conll.py`, the flaw allows an attacker to trigger quadratic O(N^2) CPU processing overhead by providing crafted CoNLL-formatted corpus inputs containing decoy span columns or nested full-width verb spans. Applications parsing untrusted linguistic corpora can experience prolonged CPU exhaustion and application-level Denial of Service (DoS).
CVE-2026-126298 (also tracked as GHSA-r53h-rw34-8h97) is an algorithmic complexity Denial of Service (DoS) vulnerability in the Natural Language Toolkit (NLTK) Python library affecting all versions prior to 3.10.4. The vulnerability resides in the nltk.tree.transforms.chomsky_normal_form function and its corresponding public method Tree.chomsky_normal_form(). When transforming a parse tree into Chomsky Normal Form using the default right-factoring strategy, the function repeatedly invokes list.pop(0) inside a loop iterating over all children of a node. In CPython, removing the initial element of a standard list requires an O(N) memory shift operation, causing the overall binarization algorithm to degrade to O(N^2) quadratic time complexity relative to the width of a node. Furthermore, converting horizontal node width into vertical tree depth bypasses initial parsing depth bounds, triggering subsequent stack exhaustion (RecursionError) when recursive methods traverse the mutated structure. Unauthenticated remote attackers who can submit bracketed tree strings to applications invoking this transformation can exhaust single-threaded CPU resources or induce unhandled application exceptions.
An algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) before version 3.10.4 allows remote unauthenticated attackers to cause a denial of service via crafted Combinatory Categorial Grammar (CCG) lexicon strings. The parser in nltk.ccg.lexicon.fromstring performs repeated immutable string slicing, concatenation, and regex tail capturing, resulting in O(n^2) CPU consumption when processing wide, flat category definitions.
CVE-2026-126295 (also tracked as GHSA-fg9w-wfp5-j933) is a path confinement bypass vulnerability in the Natural Language Toolkit (NLTK) affecting versions 3.10.0 prior to 3.10.4. The flaw resides in nltk/parse/bllip.py within the BllipParser class and its factory method BllipParser.from_unified_model_dir(). Unlike sibling tool wrappers in NLTK that enforce data-root confinement via the nltk.pathsec module, BllipParser passes caller-supplied filesystem paths directly into the third-party bllipparser native C extension without validation. When an application passes untrusted input as model paths or directories to BllipParser, an attacker can force the native extension to open arbitrary files on the local filesystem. This leads to information disclosure through parser diagnostic oracles, local model tampering via shared directories, and denial of service by hanging worker threads on blocking special files (such as FIFOs or device nodes) or exhausting memory via oversized files.
CVE-2026-126300 (GHSA-ffr9-mgrr-wcvr) is an inefficient algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) Python library affecting versions 3.2.5 prior to 3.10.4. The flaw resides in the quote-restoration routine of TreebankWordTokenizer.span_tokenize and NLTKWordTokenizer.span_tokenize, where repeated calls to list.pop(0) over matched quote tokens introduce quadratic O(n^2) time complexity. An unauthenticated remote attacker who supplies input containing long sequences of double-quote characters can exhaust CPU resources and degrade service availability.