Symfony's YAML Parser has a ReDoS via Catastrophic Backtracking in Parser::cleanup() Regex
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::cleanup() strips the optional %YAML directive header, leading comments, and document start/end markers before parsing. The original regexes contained overlapping quantifiers, most notably '#^%YAML[: ][\d.]+.*\n#u', whose [\d.]+ and .* overlap on the dot, that exhibit catastrophic backtracking on crafted input. A single oversized %YAML directive header (or comment / document-marker line) makes the parser hang for an arbitrarily long time, denying service.
Resolution
The four regexes in Parser::cleanup() (YAML directive header, leading comments, document-start marker, document-end marker) have been rewritten with possessive quantifiers and unambiguous character classes so backtracking cannot occur.
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-9frc-8383-795m 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-45304Symfony's YAML Parser Vulnerable to Exponential Memory Allocation via Recursive Collection-Alias Expansion ("Billion Laughs") · 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-9frc-8383-795m
- Linkgithub.com/symfony/symfony/commit/9749cd43c5e09b3735093623670b21b9d8a056cb
- Linkgithub.com/FriendsOfPHP/security-advisories/blob/master/symfony/symfony/CVE-2026-45305.yaml
- Linkgithub.com/FriendsOfPHP/security-advisories/blob/master/symfony/yaml/CVE-2026-45305.yaml
- Packagegithub.com/symfony/symfony
- Linksymfony.com/cve-2026-45305
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.