GitHub Advisoryadvisory · Packagist
GHSA-72xp-p242-47p9 Symfony has a UrlGenerator Route-Requirement Bypass via Unanchored Regex Alternation → Off-Site //host URL Injection
MEDIUM
Official page ↗
- Aliases
- CVE-2026-45065
- Ecosystem
- Packagist
- Packages
- symfony/routing, symfony/symfony
- Severity
- Moderate
- Weaknesses
- CWE-185, CWE-601
- Reviewed
- 2026-05-27
Affected packages
• Packagist symfony/routing: < 5.4.52 → fixed in 5.4.52
• Packagist symfony/routing: >= 6.0.0, < 6.4.40 → fixed in 6.4.40
• Packagist symfony/routing: >= 7.0.0, < 7.4.12 → fixed in 7.4.12
• Packagist symfony/routing: >= 8.0.0, < 8.0.12 → fixed in 8.0.12
• Packagist symfony/symfony: < 5.4.52 → fixed in 5.4.52
• Packagist symfony/symfony: >= 6.0.0, < 6.4.40 → fixed in 6.4.40
• Packagist symfony/symfony: >= 7.0.0, < 7.4.12 → fixed in 7.4.12
• Packagist symfony/symfony: >= 8.0.0, < 8.0.12 → fixed in 8.0.12
Description
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|...|zh_CN'` (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.
Related
Alias · CVE (1)
- CVE-2026-45065 Symfony is a PHP framework for web and console applications and a set of reusable PHP components. vulnerability
References
- https://github.com/symfony/symfony/security/advisories/GHSA-72xp-p242-47p9 web
- https://github.com/symfony/symfony/commit/bcf487c22f3240ba994124e0e0fe8616f3cfc47a web
- https://github.com/FriendsOfPHP/security-advisories/blob/master/symfony/routing/CVE-2026-45065.yaml web
- https://github.com/FriendsOfPHP/security-advisories/blob/master/symfony/symfony/CVE-2026-45065.yaml web
- https://github.com/symfony/symfony package
- https://symfony.com/cve-2026-45065 web