4.1. Threat Model
YAML parsers face several categories of attack:
-
Billion-laugh attacks — deeply nested aliases that expand exponentially, exhausting memory
-
Denial of service — extremely long strings, deeply nested structures, or very large collections that consume excessive resources
-
Arbitrary code execution — YAML tags that trigger object deserialization in languages with unsafe constructors (e.g., Python's
!!python/object) -
Duplicate key confusion — multiple identical keys in a mapping, where different consumers may pick different values
L4YAML mitigates all of these through its ParserLimits configuration.