Skip to Content.
Sympa Menu

xom-interest - [[XOM-interest] ] New billion laughs protection in 1.5.0

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Rusty Harold <elharo AT ibiblio.org>
  • To: XOM interest <xom-interest AT lists.ibiblio.org>
  • Subject: [[XOM-interest] ] New billion laughs protection in 1.5.0
  • Date: Tue, 30 Jun 2026 11:32:37 +0000

Interested parties might want to take a look at

https://github.com/elharo/xom/pull/551

Code reviews are welcome.

This PR introduces a new approach to protecting against billion laughs
attacks in XOM. Instead of banning legal XML constructs like internal
DTD subsets or limiting how they can be used, it monitors the actual
memory usage during parsing. If the heap fills up, it aborts parsing
and throws a checked ParsingException before an OutOfMemoryError can
bring down the VM.

It's actually agnostic about the cause of the memory exhaustion. It
could be a billion laughs attack. It could be a bug in the JDK or the
underlying parser. It could be an as yet undiscovered zero-day DoS
attack. Regardless, XOM will recover from this.

Excessive CPU use is still an issue. It can take a minute or two of
wall clock time to fill the heap by parsing a large XML document so
hammering a service with multiple malicious documents would be a
problem. Existing mitigations at the parser level like
XMLConstants.FEATURE_SECURE_PROCESSING still work and can be turned on
in the usual way. I'm considering whether it's also feasible to
measure CPU usage during parsing and set limits there too.
Conceptually this is trickier because there is a finite limit to how
much memory XOM can use, but there is no fundamental limit to CPU
usage. There are legitimate cases where someone might want to parse a
document even if parsing takes minutes or hours to complete.

--
Elliotte Rusty Harold
elharo AT ibiblio.org


  • [[XOM-interest] ] New billion laughs protection in 1.5.0, Elliotte Rusty Harold, 06/30/2026

Archive powered by MHonArc 2.6.24.

Top of Page