CVE-2026-134791: Unclosed Comments Make the Lexer of ExpressionLanguage Quadratic, Letting Untrusted Expressions Hold a Process
Since Symfony 7.2, expressions can contain comments. The lexer used a regular expression to find the end of a comment. When a / was never closed, this regular expression scanned the rest of the expression, and the lexer then went on with the next character. So each / scanned the rest of the expression again. Linting 192 KB of / took 9 to 11 seconds, and 96 KB took 34 seconds without PCRE JIT.
The lexer runs before the parser and its nesting limit. Any code that lints or parses untrusted expressions is affected, including the ExpressionSyntax validation constraint. A Length constraint on the same value doesn't help, since the validator runs both constraints.
The lexer now uses strpos() to find the end of a comment, and a comment that is never closed throws a SyntaxError. Such expressions were already invalid. Lexing takes linear time again.
Affected Software
Event History
Frequently Asked Questions
Which applications are exposed to this issue?
Applications are affected if they lint or parse expressions supplied by untrusted users. This includes use of the ExpressionSyntax validation constraint on untrusted input.
What input is needed to trigger excessive processing?
An attacker needs to provide an expression containing repeated unclosed /* comment openers. Each opener causes the lexer to scan the remaining expression again, resulting in quadratic processing time.
Does limiting the input with a Length validation constraint mitigate the issue?
No. A Length constraint on the same value does not prevent the problem because the validator evaluates both constraints, allowing ExpressionSyntax to lex the input.
What behavior changes after the fix?
The lexer uses strpos() to locate comment endings, restoring linear-time lexing. Expressions with an unclosed comment now raise a SyntaxError; these expressions were already invalid.