{
  "id": "billion-laughs-attack-412040-5d7ea86ef9409a80",
  "slug": "billion-laughs-attack",
  "title": "billion laughs attack",
  "qid": "Q3570419",
  "lead": "In computer security, a billion laughs attack is a type of denial-of-service attack (DoS attack) which is aimed at parsers of XML documents. It is also referred to as an XML bomb or as an exponential entity expansion attack.",
  "body": "In computer security, a billion laughs attack is a type of denial-of-service attack (DoS attack) which is aimed at parsers of XML documents. It is also referred to as an XML bomb or as an exponential entity expansion attack. ]> &lol9; When an XML parser loads this document, it sees that it includes one root element, \"lolz\", that contains the text \"&amp;lol9;\". However, \"&amp;lol9;\" is a defined entity that expands to a string containing ten \"&amp;lol8;\" strings. Each \"&amp;lol8;\" string is a defined entity that expands to ten \"&amp;lol7;\" strings, and so on. After all the entity expansions have been processed, this small ( 9 = a billion \"lol\"s, taking up almost 3 gigabytes of memory. ==Variations== The billion laughs attack described above can take an exponential amount of space or time. The quadratic blowup variation causes quadratic growth in resource requirements by simply repeating a large entity over and over again, to avoid countermeasures that detect heavily nested entities. (See computational complexity theory for comparisons of different growth classes.) A \"billion laughs\" attack could exist for any file format that can contain macro expansions, for example this YAML bomb: a: &a [\"lol\",\"lol\",\"lol\",\"lol\",\"lol\",\"lol\",\"lol\",\"lol\",\"lol\"] b: &b [*a,*a,*a,*a,*a,*a,*a,*a,*a] c: &c [*b,*b,*b,*b,*b,*b,*b,*b,*b] d: &d [*c,*c,*c,*c,*c,*c,*c,*c,*c] e: &e [*d,*d,*d,*d,*d,*d,*d,*d,*d] f: &f [*e,*e,*e,*e,*e,*e,*e,*e,*e] g: &g [*f,*f,*f,*f,*f,*f,*f,*f,*f] h: &h [*g,*g,*g,*g,*g,*g,*g,*g,*g] i: &i [*h,*h,*h,*h,*h,*h,*h,*h,*h] This crashed earlier versions of Go because the Go YAML processor (contrary to the YAML spec) expands references as if they were macros. The Go YAML processor was modified to fail parsing if the result object becomes too large. Enterprise software like Kubernetes has been affected by this attack through its YAML parser. For this reason, either a parser with intentionally limited capabilities is preferred (like StrictYAML) or file formats that do not allow references are often preferred for data arriving from untrusted sources.",
  "categories": [
    "20189021",
    "23158856",
    "23603337",
    "26220375",
    "26863021",
    "28537667",
    "73242861"
  ],
  "license": "CC BY-SA 4.0",
  "source_uri": "https://en.wikipedia.org/w/index.php?oldid=1373508825",
  "content_hash": "5d7ea86ef9409a80238ff202c8fd0a3e777bb40197fb268efc74ded6820a160a",
  "created_at": 1792310355.3951445,
  "updated_at": 1788684425.0,
  "claims": [],
  "contradictions": [],
  "confidence": 0.6,
  "csl": {
    "id": "billion-laughs-attack-412040-5d7ea86ef9409a80",
    "type": "webpage",
    "title": "billion laughs attack",
    "author": [
      {
        "family": "Anticloud FZ LLE",
        "literal": "Anticloud FZ LLE"
      }
    ],
    "container-title": "encyclopegia.org",
    "publisher": "Anticloud FZ LLE",
    "publisher-place": "Dubai, United Arab Emirates",
    "URL": "https://encyclopegia.org/a/billion-laughs-attack",
    "issued": {
      "date-parts": [
        [
          2026,
          10,
          18
        ]
      ]
    },
    "accessed": {
      "date-parts": [
        [
          2026,
          11,
          21
        ]
      ]
    },
    "license": "CC BY-SA 4.0",
    "DOI": "eo1:billion-laughs-attack-412040-5d7ea86ef9409a80",
    "isBasedOn": "https://en.wikipedia.org/w/index.php?oldid=1373508825",
    "note": "Immutable snapshot billion-laughs-attack-412040-5d7ea86ef9409a80, content root 5d7ea86ef9409a80…"
  }
}