Home img Billion Laugh Attack

img Billion Laugh Attack


100 Day's Of Cybersecurity - Day 12

The Billion Laughs Attack: A Threat to XML Parsing


XML parsing vulnerabilities continue to be a focal point for security researchers, and one particularly menacing exploit is the Billion Laughs Attack. This attack leverages XML entities to recursively resolve themselves, leading to a spike in CPU usage and potentially causing a denial-of-service (DoS) scenario. In this comprehensive guide, we’ll delve into the intricacies of the Billion Laughs Attack, providing insights, examples, and mitigation strategies.

Understanding the Billion Laughs Attack

What is the Billion Laughs Attack?

The Billion Laughs Attack is a form of XML External Entity (XXE) attack that capitalizes on the recursive expansion of entities. By crafting a malicious XML payload with nested entities, an attacker can force XML parsers to repeatedly resolve the entities, consuming excessive CPU resources and leading to a DoS condition.

Example Payload

Consider the following XML payload, designed to execute the Billion Laughs Attack:

<?xml version="1.0"?>
<!DOCTYPE lolz [
 <!ENTITY lol "lol">
 <!ELEMENT lolz (#PCDATA)>
 <!ENTITY lol1 "&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;">
 <!-- Repeat the pattern up to lol9 based on the desired DoS variation -->

In this payload, the lol entity is recursively expanded, creating a cascade effect that multiplies exponentially. Adjusting the repetition from lol1 to lol9 allows for fine-tuning the impact of the attack.

Executing the Billion Laughs Attack

Step-by-Step Execution

  1. Capture the Request in Burp Suite:
    • Use Burp Suite to intercept and capture the target XML request.
  2. Repeater Tab and XML Conversion:
    • Send the captured request to the repeater tab.
    • Convert the body into XML to ensure the system accepts it.
  3. Header Manipulation:
    • Check the Accept header and change it to Application/json to confirm the system’s behavior.
  4. JSON to XML Conversion:
    • If necessary, convert JSON to XML to proceed.
  5. Inserting the Payload:
    • Insert the Billion Laughs payload between the <lolz> tags.
    • Adjust the repetition from lol1 to lol9 based on the desired impact.


The Billion Laughs Attack serves as a reminder of the ongoing challenges in securing XML parsing. Security researchers and developers must remain vigilant, understanding the nuances of such attacks and implementing robust mitigation measures to fortify systems against potential exploitation.

This post is licensed under CC BY 4.0 by the author.

imgBroken Link Hijacking

img S3 Bucket Misconfiguration!