CVE-2026-45065: Symfony: UrlGenerator Route-Requirement Bypass via Unanchored Regex Alternation → Off-Site //host URL Injection
Description
Symfony routes can declare a requirements regex per path parameter, e.g. a route /{locale}/blog with requirements: { locale: 'en|fr|de' }. The Twig path() / url() helpers (backed by UrlGenerator) validate supplied parameter values against that regex before building the URL.
UrlGenerator constructs the validation pattern as '#^'.$req.'$#', where $req is the raw requirement string. For a requirement expressed as an alternation, e.g. locale: 'ar|bg|...|vi|...|zhCN' (very common), ^ and $ anchor only the first and last alternatives, so any middle alternative matches as an unanchored substring. A value like /evil.com satisfies the requirement (because it contains vi), and the generated path becomes //evil.com/...: a protocol-relative URL the browser navigates off-site.
Resolution
The UrlGenerator class now wraps the requirement in a non-capturing group so the ^ and $ anchors apply to the whole alternation.
The patch for this issue is available here for branch 5.4.
Credits
Symfony would like to thank Claude Mythos Preview (via Project Glasswing) for reporting the issue and providing the fix.
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, UrlGenerator validates route parameters against a pattern built as ^ plus the raw requirement plus $; with ungrouped alternations, middle alternatives match as unanchored substrings, allowing a value such as //evil.com to satisfy a common locale requirement and generate a protocol-relative off-site URL. 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/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/routingto a version that resolves this vulnerability.Fixed in 8.0.12 - Upgrade
Upgrade
composer/symfony/routingto a version that resolves this vulnerability.Fixed in 7.4.12 - Upgrade
Upgrade
composer/symfony/routingto a version that resolves this vulnerability.Fixed in 6.4.40 - Upgrade
Upgrade
composer/symfony/routingto a version that resolves this vulnerability.Fixed in 5.4.52 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 5.4.52Patch bcf487c22f3240ba994124e0e0fe8616f3cfc47a - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 6.4.40 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 7.4.12 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 8.0.12 - Compensating control
Review any Symfony route parameters that use a regex requirement with ungrouped alternation (e.g., a very common _locale pattern like 'ar|bg|...|vi|...|zh_CN') and ensure the requirement is structured so anchors apply to the whole alternation.
Event History
Frequently Asked Questions
What is the severity of CVE-2026-45065?
The severity level of CVE-2026-45065 is rated at 35.
How do I fix CVE-2026-45065?
To fix CVE-2026-45065, ensure your Symfony installation is updated to the latest version that addresses this vulnerability.
What impact does CVE-2026-45065 have on Symfony applications?
CVE-2026-45065 can allow attackers to bypass route parameter validation, potentially leading to unauthorized access or exposure of sensitive information.
In which Symfony components is CVE-2026-45065 present?
CVE-2026-45065 affects the Symfony routing component, particularly the path parameter validation through the Twig path() and url() helpers.
When was CVE-2026-45065 published?
CVE-2026-45065 was published on May 27, 2026.