CVE-2026-45304: 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
CVE-2026-45304: YAML Parser Exponential Memory Allocation via Recursive Collection-Alias Expansion ("Billion Laughs")
— Packagist
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.
— NVD
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
debian/symfonyto a version that resolves this vulnerability.Fixed in 5.4.53+dfsg-0+deb12u1Fixed in 6.4.41+dfsg-0+deb13u1Fixed in 6.4.49+dfsg-0+deb13u1Fixed in 7.4.22+dfsg-1Fixed in 7.4.23+dfsg-1 - Upgrade
Upgrade
Symfonyto a version that resolves this vulnerability.Fixed in 5.4.52 - Upgrade
Upgrade
Symfonyto a version that resolves this vulnerability.Fixed in 6.4.40 - Upgrade
Upgrade
Symfonyto a version that resolves this vulnerability.Fixed in 7.4.12 - Upgrade
Upgrade
Symfonyto a version that resolves this vulnerability.Fixed in 8.0.12 - Configuration
Enable Yaml::PARSE_EXCEPTION_ON_ALIAS when parsing fully untrusted YAML input to reject all aliases.
Symfony YAML parser Yaml::PARSE_EXCEPTION_ON_ALIAS = enabled - Configuration
Configure the maximum number of collection-alias resolutions to 128 via Parser::__construct(), Yaml::parse(), or Yaml::parseFile().
Symfony YAML parser maxAliasesForCollections = 128
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.