DEV Community

SorrelThorncroft
SorrelThorncroft

Posted on

libexpat Crashes When a CDATA Handler Suspends Mid-Entity

libexpat Crashes When a CDATA Handler Suspends Mid-Entity

libexpat through 2.11.0 contains a NULL pointer dereference in doContent() when a parser handler suspends during a CDATA section inside an internal general entity. The issue is CVE-2026-141596 and carries a CVSS 4.0 score of 8.2. It is a denial-of-service flaw, not a memory-disclosure or code-execution claim.

The condition is narrower than sending any malformed XML. It requires an application whose handler suspends the parser at that point. A crafted document can then corrupt parser state and cause a crash.

Suspension changes the parser state

Many XML integrations parse a document in one call. Streaming parsers can pause and resume when a handler needs more data, performs an application callback or applies backpressure. The vulnerable state machine does not preserve the CDATA context correctly across that suspension.

The patch reference points to a specific region of xmlparse.c. Defenders should map the library into applications, language runtimes and appliances rather than looking for an expat web page. libexpat is often embedded inside another product.

Patch status

The CVE record states that versions through 2.11.0 are affected and does not name a released fixed version. The linked pull request provides the patch, but operators should verify the release notes or distribution backport for the package they actually run.

Use dependency inventories, package managers, SBOMs and container scans to find libexpat versions. A distribution may backport the fix while keeping an older visible version, so confirm the vendor's security tracker.

Test the actual handler

Create a parsing test that suspends from a CDATA handler inside an internal general entity and resumes the parser. Run it in an isolated process with a timeout. The fixed build should preserve state and return a controlled parse result instead of crashing.

Review application restarts and crash dumps for XML-processing services that accepted untrusted input. Preserve the input document only when policy permits. A parser crash without the document and stack trace does not establish this CVE.

References

Top comments (0)