billion laughs attack
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.[src] It is also referred to as an XML bomb or as an exponential entity expansion attack.[src]
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.[src] It is also referred to as an XML bomb or as an exponential entity expansion attack.[src] ]> &lol9; When an XML parser loads this document, it sees that it includes one root element, "lolz", that contains the text "&lol9;".[src] However, "&lol9;" is a defined entity that expands to a string containing ten "&lol8;" strings.[src] Each "&lol8;" string is a defined entity that expands to ten "&lol7;" strings, and so on.[src] After all the entity expansions have been processed, this small ( 9 = a billion "lol"s, taking up almost 3 gigabytes of memory.[src] ==Variations== The billion laughs attack described above can take an exponential amount of space or time.[src] 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.[src] (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.[src] The Go YAML processor was modified to fail parsing if the result object becomes too large.[src] Enterprise software like Kubernetes has been affected by this attack through its YAML parser.[src] 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.[src]
14 sentences · 14 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"billion laughs attack." encyclopegia.org, 2026, https://encyclopegia.org/wiki/billion-laughs-attack. Accessed 26 November 2026.
Chicago
"billion laughs attack." encyclopegia.org. Accessed November 26, 2026. https://encyclopegia.org/wiki/billion-laughs-attack.
APA
encyclopegia.org. (2026). billion laughs attack. Retrieved November 26, 2026, from https://encyclopegia.org/wiki/billion-laughs-attack
Accessed November 26, 2026 · CC BY-SA 4.0 · citation page · JSON