Symfony's YAML Parser Vulnerable to Exponential Memory Allocation via Recursive Collection-Alias Expansion ("Billion Laughs")
Published 27 May 2026 · Updated 10 Sept 2026
Is your project on an affected symfony/yaml?
Look after several Laravel or PHP apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Affected packages
- Affected
- <5.4.52
- Fixed in
- 5.4.52
composer require symfony/yaml:^5.4.52- Affected
- <5.4.52
- Fixed in
- 5.4.52
composer require symfony/symfony:^5.4.52- Affected
- >=6.0.0 <6.4.40
- Fixed in
- 6.4.40
composer require symfony/symfony:^6.4.40- Affected
- >=7.0.0 <7.4.12
- Fixed in
- 7.4.12
composer require symfony/symfony:^7.4.12- Affected
- >=8.0.0 <8.0.12
- Fixed in
- 8.0.12
composer require symfony/symfony:^8.0.12- Affected
- >=6.0.0 <6.4.40
- Fixed in
- 6.4.40
composer require symfony/yaml:^6.4.40- Affected
- >=7.0.0 <7.4.12
- Fixed in
- 7.4.12
composer require symfony/yaml:^7.4.12- Affected
- >=8.0.0 <8.0.12
- Fixed in
- 8.0.12
composer require symfony/yaml:^8.0.12Details
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::PARSE_EXCEPTION_ON_ALIAS 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.
Is GHSA-4qpc-3hr4-r2p4 in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected symfony/yaml, and gives you the command that fixes it.
More advisories for symfony/yaml
- HighCVE-2026-109413Symfony: Unbounded Recursion in the YAML Inline Lexer Lets a Single Document Crash the Process · 27 Oct 2026
- LowCVE-2026-45305Symfony's YAML Parser has a ReDoS via Catastrophic Backtracking in Parser::cleanup() Regex · 27 May 2026
- LowCVE-2026-45133Symfony hardened the parser when handling untrusted input · 27 May 2026
- HighCVE-2013-1348Symphony Vulnerable to PHP Code Injection via YAML Parsing · 17 May 2022
- HighCVE-2013-1397Symfony Arbitrary PHP code Execution · 17 May 2022
References
- Linkgithub.com/symfony/symfony/security/advisories/GHSA-4qpc-3hr4-r2p4
- Linkgithub.com/symfony/symfony/commit/e77391b2e4f18821198f010d573674c8ed4a970a
- Linkgithub.com/FriendsOfPHP/security-advisories/blob/master/symfony/symfony/CVE-2026-45304.yaml
- Linkgithub.com/FriendsOfPHP/security-advisories/blob/master/symfony/yaml/CVE-2026-45304.yaml
- Packagegithub.com/symfony/symfony
- Linksymfony.com/cve-2026-45304
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.