CVE-2026-45065: 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
CVE-2026-45065: UrlGenerator Route-Requirement Bypass via Unanchored Regex Alternation → Off-Site //host URL Injection
— 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, 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.
— NVD
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
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
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.