CVE-2026-45304: Symfony: YAML Parser Exponential Memory Allocation via Recursive Collection-Alias Expansion ("Billion Laughs")
Description
Symfony\Component\Yaml\Parser resolves YAML aliases (anchor) during parsing. Aliases that reference collections (arrays, stdClass, TaggedValue-wrapped collections) can themselves point to other collections containing aliases, creating exponential expansion at resolution time. A small input can blow up into a multi-gigabyte structure and exhaust memory: the classic "Billion Laughs" denial-of-service against any parser exposed to untrusted YAML.
Resolution
The Parser now counts collection alias resolutions in a shared ParserState object, with a default limit of 128, following the SnakeYAML model. Scalar aliases remain unrestricted since they cannot drive exponential growth. The limit is configurable via a new $maxAliasesForCollections argument on Parser::construct(), Yaml::parse() and Yaml::parseFile(). A new Yaml::PARSEEXCEPTIONONALIAS flag also rejects all aliases outright when parsing fully untrusted input.
The patch for this issue is available here for branch 5.4.
Credits
Symfony would like to thank Pietro Tirenna (Shielder) for reporting the issue and Nicolas Grekas for fixing it.
Other sources
Symfony is a PHP framework for web and console applications and a set of reusable PHP components. Prior to 5.4.52, 6.4.40, 7.4.12, and 8.0.12, Symfony\Component\Yaml\Parser resolved YAML collection aliases recursively, allowing a small untrusted YAML input to expand into a multi-gigabyte structure and exhaust memory. This issue is fixed in versions 5.4.52, 6.4.40, 7.4.12, and 8.0.12.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
composer/symfony/yamlto a version that resolves this vulnerability.Fixed in 8.0.12 - Upgrade
Upgrade
composer/symfony/yamlto a version that resolves this vulnerability.Fixed in 7.4.12 - Upgrade
Upgrade
composer/symfony/yamlto a version that resolves this vulnerability.Fixed in 6.4.40 - Upgrade
Upgrade
composer/symfony/symfonyto a version that resolves this vulnerability.Fixed in 8.0.12 - Upgrade
Upgrade
composer/symfony/symfonyto a version that resolves this vulnerability.Fixed in 7.4.12 - Upgrade
Upgrade
composer/symfony/symfonyto a version that resolves this vulnerability.Fixed in 6.4.40 - Upgrade
Upgrade
composer/symfony/symfonyto a version that resolves this vulnerability.Fixed in 5.4.52 - Upgrade
Upgrade
composer/symfony/yamlto a version that resolves this vulnerability.Fixed in 5.4.52 - Upgrade
Upgrade
Symfony\Component\Yamlto a version that resolves this vulnerability.Fixed in 5.4.52 - Upgrade
Upgrade
Symfony\Component\Yamlto a version that resolves this vulnerability.Fixed in 6.4.40 - Upgrade
Upgrade
Symfony\Component\Yamlto a version that resolves this vulnerability.Fixed in 7.4.12 - Upgrade
Upgrade
Symfony\Component\Yamlto a version that resolves this vulnerability.Fixed in 8.0.12 - Configuration
If you cannot immediately upgrade, set the $maxAliasesForCollections argument to a safe limit (default limit is 128) when constructing Parser or calling Yaml::parse() / Yaml::parseFile() to cap recursive collection-alias expansion.
Symfony\Component\Yaml\Parser $maxAliasesForCollections = 128 (default) / configure via Parser::__construct(), Yaml::parse(), Yaml::parseFile() - Configuration
For fully untrusted YAML input, enable Yaml::PARSE_EXCEPTION_ON_ALIAS so the parser rejects all aliases outright.
Symfony\Component\Yaml\Yaml Yaml::PARSE_EXCEPTION_ON_ALIAS = reject all aliases outright when parsing fully untrusted input
Event History
Frequently Asked Questions
What is the severity of CVE-2026-45304?
CVE-2026-45304 has a risk level of 40.
What are the affected software components for CVE-2026-45304?
The affected software components include composer/symfony/yaml and composer/symfony/symfony.
How do I resolve the vulnerability CVE-2026-45304?
To resolve CVE-2026-45304, update the affected Symfony components to the latest secure versions.
What are the potential risks associated with CVE-2026-45304?
CVE-2026-45304 can lead to exponential expansion during YAML parsing, potentially causing denial of service.
When was CVE-2026-45304 published?
CVE-2026-45304 was published on May 27, 2026.