Skip to content
DoS Write-up Intermediate

Billion Laugh Attack in https://sites.google.com

The Classic Sites gadget import feature used Apache Shindig, which parsed XML without limiting entity expansion, allowing a Billion Laughs attack. An attacker could crash the containerised environment with a single crafted XML import.

Antonio Sanso Follow

Published on blog.intothesymmetry.com

Bounty$500 View original

The original lives on blog.intothesymmetry.com

We do not hold its text, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the public text of the report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

The target here is https://sites.google.com, the classic Google Sites product. In the bottom left corner of the page there is a link to "Classic Sites", and that older interface exposes a gadget feature that can import an XML-based gadget and display it on the site. For anyone with a security background, an XML import is an immediate prompt to think about XXE, so that is where the investigation started.

The researcher, Antonio Sanso, describes the work as an example of his own rule #3 for bug hunters: do look at the old stuff. The "Classic Sites" label was the trigger that led him to examine the legacy functionality rather than the current one.

Setup

There is no account setup, tooling list or version information in the report. What matters is the precondition: the gadget import feature on Classic Sites accepts an XML document supplied by the user and processes it server-side. The researcher also notes that Google Sites implements this functionality using Apache Shindig, an old Apache project that now sits in the attic. Because Shindig is open source, he could inspect its source code directly.

Before reporting, he ran a Twitter poll asking what he should do with a working billion laughs attack on a large website, then contacted Google to ask permission to test the site for the vulnerability. Google granted permission, and the testing was carried out against a containerised environment.

Finding it

Inspecting the Shindig source showed that the code was safe against SSRF and exfiltration: the XML import could not be abused to fetch remote resources or leak data out. The parsing itself, however, looked vulnerable to a Billion Laughs attack, the classic XML entity expansion denial of service.

That distinction is the core of the finding. The dangerous parts of XML processing that people usually look for, external entity resolution and outbound fetches, had been handled. The resource exhaustion caused by internal entity expansion had not.

Exploitation

Step 1: import a billion laughs payload

With Google's permission, the researcher imported an XML document containing the most classic Billion Laughs payload through the gadget import. The report does not reproduce the payload itself, only describes it as the classic form: a set of nested entity definitions where each level references the previous one multiple times, so that expansion multiplies until the parser runs out of resources.

The import did not bring the service down in any meaningful way, because the target was a containerised environment, but it did trigger the parser's limit. The error returned was:

Text
org.apache.shindig.common.xml.XmlException: JAXP00010001: The parser has encountered more than "64000" entity expansions in this document; this is the limit imposed by the JDK.
At: (1,1)

This confirms that the document reached the JDK's XML parser and that entity expansion was attempted until the built-in cap of 64000 expansions was hit. The exception is thrown by Shindig's own XML handling class, org.apache.shindig.common.xml.XmlException, wrapping the JDK parser error.

Step 2: interpret the limit

The researcher was surprised by the number in the error. In Java, the default value of entityExpansionLimit was already 64000 in JRE 1.7_45. Seeing exactly that limit in the message raised a question he could not answer: was Google running a really old version of Java, or was the limit simply left at a different default? The report leaves this open.

Root cause

The XML parser used by Shindig for the gadget import expanded internal entities without a stricter application-level cap, so a small document with nested entity definitions could force a large amount of expansion work. The JDK's own entityExpansionLimit of 64000 stopped the expansion, which is why the result was an exception rather than an outage.

The existing defences covered SSRF and exfiltration, meaning external entity resolution and outbound fetches were not possible. They did not address entity expansion as a resource exhaustion vector, which is why the attack reached the parser at all. The report does not describe any further code-level detail beyond this.

Impact

The practical impact was limited. The target ran in a containerised, virtualised environment, so crashing the container was, in the researcher's words, not a big deal on Google's side. The attack required the ability to submit an XML gadget for import, and the outcome observed was a parser exception once the 64000 expansion limit was reached. The report does not claim any effect beyond resource exhaustion of the parsing container.

Google normally does not pay bounties for denial of service vulnerabilities, but made a small exception here and paid a 500 USD bounty.

Fix

The issue was fixed quickly. The report says the issue was quickly fixed and shows the JDK limit exception, but does not describe the specific code change made by Google or by the Shindig project. The report does not describe the specific code change made by Google or by the Shindig project.

Variants to test

  1. Look for legacy or "classic" versions of a product that are still reachable from the current interface. A positive result is an older endpoint or feature that accepts user-supplied XML, such as a gadget, feed or configuration import.
  2. Identify the XML parser and library behind any import feature, and check whether it is an old open source project whose source you can read. A positive result is source code that resolves entities but has no application-level expansion cap.
  3. Submit a nested entity document and watch for parser errors that name an expansion limit. A positive result is an exception such as the JDK JAXP00010001 message, which shows the document reached the parser and expansion was attempted.
  4. Check whether external entities are blocked while internal expansion is not. A positive result is a target that rejects SSRF-style external entity payloads but still processes internal entity definitions.
  5. Note the runtime version implied by any limit in the error message. A positive result is a limit value that suggests an old or non-default Java configuration, which is worth mentioning in the report even if you cannot confirm the cause.

Written with AI from the public text of the report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 14 min read.

What happened, in plain words

Google Sites is a service that lets anyone build a simple website without writing code. It has an older interface called "Classic Sites", and that older interface has a feature that lets you import a small piece of content described in a file format called XML. The researcher, Antonio Sanso, noticed a link to "Classic Sites" in the bottom left corner of https://sites.google.com and decided to look at the old functionality rather than the new one.

When a website accepts an XML file from a user and processes it on its own servers, a security person immediately thinks of a family of attacks. One of them is called a Billion Laughs attack. It does not steal data or break passwords. It is a way of writing a very short XML file that, when the server reads it, makes the server do an enormous amount of work, like a recipe that tells you to make two copies of a cake, then two copies of each of those, and so on until the kitchen is full. The goal is to exhaust the server's memory or processing power.

The researcher found that Google Sites used an old open source library called Apache Shindig to handle this import. He read its source code, saw that some protections were in place but that the Billion Laughs protection was missing, asked Google for permission to test, and imported a classic Billion Laughs file. The server's XML parser stopped the expansion at a built-in limit of 64000 and returned an error. Google fixed it quickly and paid a 500 USD bounty, which is unusual because Google normally does not pay for denial of service issues.

Background: what all these words mean

Before walking through the steps, here are the ideas you need. Each one is explained from zero.

  • A website and its server. When you open a page in your browser, your browser asks a computer somewhere else, called a server, for the page. The server does the real work: it stores data, runs programs and sends back the result. Anything you type into a form is sent to that server and processed there, not on your own machine.
  • XML. XML is a text format for describing structured data. It uses tags in angle brackets, like <name>value</name>, and you can define your own tags. It is a bit like a very strict shopping list where every item has a label and a value. Many older systems use XML to exchange data or configuration.
  • An entity in XML. XML lets you define a shortcut, called an entity, that stands for a piece of text. You declare it once and then refer to it by name elsewhere. Think of it as a find-and-replace rule: you write &name; and the parser replaces it with whatever text you defined. Entities can refer to other entities, which is where the trouble starts.
  • A parser. A parser is the program that reads a file and turns its text into something the application can use. When you import an XML file, a parser on the server reads it. If the parser is careless, a cleverly written file can make it do far more work than the file's size suggests.
  • XXE (XML External Entity). This is a classic XML attack. XML allows an entity to point at an external resource, such as a file on the server or a URL on the internet. If the parser follows that pointer, an attacker can read local files or make the server fetch things on their behalf. Security people see "XML import" and immediately ask: does this thing follow external entities?
  • SSRF (Server-Side Request Forgery). This is when an attacker makes the server send a request to a destination of the attacker's choosing, for example an internal service that is not reachable from the internet. It is closely related to XXE: both involve making the server fetch something.
  • Exfiltration. Getting data out of a system. In the XXE context, it means tricking the server into sending sensitive data to a place the attacker can read.
  • Denial of service (DoS). An attack whose goal is to make a service unavailable or to exhaust its resources, rather than to steal information. A Billion Laughs attack is a DoS attack.
  • Billion Laughs attack. Also called an XML entity expansion attack. You define a small entity, then an entity that refers to the first one many times, then another that refers to that one many times, and so on. Each level multiplies the size. A file of a few hundred bytes can expand into gigabytes of text in memory. The name comes from a classic example that produces the word "lol" billions of times.
  • Apache Shindig. An open source project from the Apache Software Foundation that implements gadget support. A gadget is a small embeddable piece of web content. Shindig is now retired (Apache calls retired projects "in the attic"), but its source code is still public, which means anyone can read it.
  • Open source. Software whose source code is published, so anyone can read how it works. This matters here because the researcher could read Shindig's code and reason about its behaviour before testing.
  • Java and the JDK. Java is a programming language and runtime. The JDK (Java Development Kit) includes the standard XML parser. That parser has a built-in safety limit called entityExpansionLimit, which caps how many times entities may be expanded in one document. The default value is 64000.
  • Container. A container is a lightweight, isolated environment in which an application runs. If the application inside crashes, the container can be restarted and the rest of the system is largely unaffected. This is why crashing it was, in the researcher's words, not a big deal for Google.
  • Bug bounty. A programme where a company pays researchers for reporting security problems responsibly, instead of suing them or ignoring them.

The researcher's own rules

The report opens with a bit of personal context. The researcher had submitted a talk to a security conference titled "So you wanna be a Bug Bounty Hunter" and it was rejected. He had been doing bug bounty work on and off for years, and he wanted to share lessons that were not only technical. He lists a few of his rules:

  1. Rule #1: have a good RSS feed list. RSS is a way of subscribing to updates from websites, so you get new posts delivered to you instead of checking each site by hand. A good feed list keeps you informed about what is changing.
  2. Rule #2: do not be too fussy about food, specifically about "left over". This is a joke about being willing to work with what is available.
  3. Rule #3: do look at the old stuff. This is the rule that matters for the rest of the story.

He also shares a photo of an old bug bounty item he found in a forgotten drawer, from the time he was a bug hunter. The point of the anecdote is that old things, whether cheques or features, are worth a second look.

Looking at Google Sites

The researcher cannot remember exactly why he was looking at https://sites.google.com, but something in the bottom left corner of the page caught his attention: a link to "Classic Sites". For a bug hunter, the word "classic" is a trigger. It suggests an older version of the product that is still reachable, and older versions are often less carefully maintained than the current one. This is rule #3 in action.

So he followed the link and looked at what Classic Sites offered. He found a gadget feature: a way to import an XML-based gadget and have it displayed on the website. In other words, the site accepts an XML document from the user and processes it on the server.

Why XML import is interesting

When a security person sees "import XML", the first thought is XXE. The question is whether the parser will follow external entities, that is, whether a crafted XML file can make the server read a local file or fetch a URL. If it can, that is a serious vulnerability, because it can lead to reading sensitive files or reaching internal services.

So the researcher started investigating from that angle. He quickly discovered that Google Sites implements the gadget import using Apache Shindig. Because Shindig is open source, he could read its source code directly, without guessing.

Reading the code showed that it was safe against SSRF and exfiltration. In plain terms: the import could not be abused to fetch remote resources or to leak data out. That part was handled.

But the same reading showed something else: the code looked vulnerable to a Billion Laughs attack. The dangerous parts of XML processing that people usually look for, external entity resolution and outbound fetches, had been dealt with. The resource exhaustion caused by internal entity expansion had not.

That distinction is the heart of the finding. Protecting against one class of XML attack does not automatically protect against another.

Asking before testing

Before reporting anything, the researcher ran a Twitter poll asking what he should do with a working Billion Laughs attack on a large website. He then contacted Google, explained the situation, and asked for permission to test the site for the vulnerability. Google's security team granted permission. They were, in his words, a bit sceptical that it would actually work, but they allowed the test.

This is worth pausing on. Testing a live service without permission is not acceptable, even when you believe the impact is small. Asking first is what turns a test into responsible research.

Step 1: import a Billion Laughs payload

With permission in hand, the researcher imported an XML document containing the most classic Billion Laughs payload through the gadget import. The report does not reproduce the payload itself. It only describes it as the classic form: a set of nested entity definitions where each level references the previous one multiple times, so that expansion multiplies until the parser runs out of resources.

To make that concrete without inventing a payload: imagine an entity a that contains a short word. Then an entity b that contains a ten times. Then an entity c that contains b ten times. Each level multiplies the amount of text by ten. A handful of levels turns a tiny file into an enormous amount of text that the parser must build in memory. That is the shape of the attack.

The import did not bring the service down in any meaningful way, because the target was a containerised environment. But it did trigger the parser's limit. The error returned was:

Text
org.apache.shindig.common.xml.XmlException: JAXP00010001: The parser has encountered more than "64000" entity expansions in this document; this is the limit imposed by the JDK.
At: (1,1)

Line by line, in plain words:

  • org.apache.shindig.common.xml.XmlException is the name of the exception class thrown by Shindig's own XML handling code. The dotted name is just how Java names things: the project, the package, the sub-package, and finally the class. Seeing it tells you the error came from Shindig's wrapper around the parser, not from somewhere unrelated.
  • JAXP00010001 is an error code from the JDK's XML parser. JAXP is the name of the standard Java API for XML processing. The code is a fixed identifier for this particular kind of failure.
  • The parser has encountered more than "64000" entity expansions in this document says exactly what happened: the parser counted entity expansions and stopped once the count passed 64000. An entity expansion is one substitution of an entity reference with its text. The number 64000 is the cap.
  • this is the limit imposed by the JDK tells you where the cap comes from: the Java runtime itself, not from Shindig's own code.
  • At: (1,1) gives the position in the document, line 1, column 1, where the parser gave up.

What this error proves is important. It confirms that the document reached the JDK's XML parser and that entity expansion was attempted until the built-in cap of 64000 expansions was hit. The exception is thrown by Shindig's own XML handling class, wrapping the JDK parser error. In other words, the attack worked as far as the parser, and the parser's own safety net caught it.

Step 2: interpret the limit

The researcher was surprised by the number in the error. In Java, the default value of entityExpansionLimit was already 64000 in JRE 1.7_45. JRE stands for Java Runtime Environment, the software that runs Java programs. Version 1.7_45 is a specific release of it.

Seeing exactly that limit in the message raised a question he could not answer: was Google running a really old version of Java, or was the limit simply left at a different default? The report leaves this open. It is a good example of how an error message can tell you something about the system behind it, even when it does not settle the question.

Root cause

The XML parser used by Shindig for the gadget import expanded internal entities without a stricter application-level cap. That means the application itself did not add its own limit on top of whatever the parser provided. A small document with nested entity definitions could therefore force a large amount of expansion work.

The JDK's own entityExpansionLimit of 64000 stopped the expansion. That is why the result was an exception rather than an outage: the safety net held.

The existing defences covered SSRF and exfiltration, meaning external entity resolution and outbound fetches were not possible. They did not address entity expansion as a resource exhaustion vector. That is why the attack reached the parser at all. The report does not describe any further code-level detail beyond this.

Impact

The practical impact was limited. The target ran in a containerised, virtualised environment, so crashing the container was, in the researcher's words, not a big deal on Google's side. The attack required the ability to submit an XML gadget for import, and the outcome observed was a parser exception once the 64000 expansion limit was reached. The report does not claim any effect beyond resource exhaustion of the parsing container.

Google normally does not pay bounties for denial of service vulnerabilities, but made a small exception here and paid a 500 USD bounty.

Fix

The issue was fixed quickly. The report says the issue was fixed quickly, but does not describe the specific code change made by Google or by the Shindig project. The report does not describe the specific code change made by Google or by the Shindig project.

Variants to test

If you want to look for something similar yourself, here is the approach in steps. Each step says what to look for and what a positive result looks like.

  1. Look for legacy or "classic" versions of a product that are still reachable from the current interface. A positive result is an older endpoint or feature that accepts user-supplied XML, such as a gadget, feed or configuration import.
  2. Identify the XML parser and library behind any import feature, and check whether it is an old open source project whose source you can read. A positive result is source code that resolves entities but has no application-level expansion cap.
  3. Submit a nested entity document and watch for parser errors that name an expansion limit. A positive result is an exception such as the JDK JAXP00010001 message, which shows the document reached the parser and expansion was attempted.
  4. Check whether external entities are blocked while internal expansion is not. A positive result is a target that rejects SSRF-style external entity payloads but still processes internal entity definitions.
  5. Note the runtime version implied by any limit in the error message. A positive result is a limit value that suggests an old or non-default Java configuration, which is worth mentioning in the report even if you cannot confirm the cause.

Glossary

  • Apache Shindig: an open source Apache project that implements gadget support; now retired (in the attic), but its source code is public.
  • Bug bounty: a programme where a company pays researchers for reporting security problems responsibly.
  • Classic Sites: the older interface of Google Sites, reachable from a link in the bottom left corner of https://sites.google.com.
  • Container: a lightweight, isolated environment in which an application runs, so a crash inside it is contained.
  • Denial of service (DoS): an attack that aims to exhaust a service's resources or make it unavailable, rather than to steal data.
  • Entity (XML): a named shortcut in an XML document that the parser replaces with a piece of text; entities can refer to other entities.
  • Entity expansion: one substitution of an entity reference with its text; repeated expansion is what makes a Billion Laughs attack work.
  • entityExpansionLimit: a JDK setting that caps how many entity expansions a document may trigger; the default is 64000.
  • Exfiltration: getting data out of a system, for example by tricking a server into sending it somewhere the attacker can read.
  • Gadget: a small embeddable piece of web content; Classic Sites can import an XML-based gadget.
  • Java / JDK / JRE: a programming language and its runtime; the JDK includes the standard XML parser, and the JRE is the software that runs Java programs.
  • JAXP: the standard Java API for XML processing; JAXP00010001 is one of its error codes.
  • Parser: the program that reads a file and turns its text into something the application can use.
  • RSS: a way of subscribing to updates from websites so new posts are delivered to you.
  • SSRF (Server-Side Request Forgery): making a server send a request to a destination of the attacker's choosing.
  • XML: a text format for structured data using tags in angle brackets, often used for configuration and data exchange.
  • XXE (XML External Entity): an XML attack where an entity points at an external resource, such as a local file or a URL, and the parser follows it.
  • Billion Laughs attack: an XML entity expansion attack where nested entity definitions multiply until the parser runs out of resources.

More by Antonio Sanso

View all

2 more disclosed reports, best first.

More from Google

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.