VDB
EN
MEDIUM

GHSA-72xp-p242-47p9

Symfony has a 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|...|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](https://github.com/symfony/symfony/commit/bcf487c22f3240ba994124e0e0fe8616f3cfc47a) for branch 5.4.

### Credits

Symfony would like to thank Claude Mythos Preview (via Project Glasswing) for reporting the issue and providing the fix.

이 버전이 영향받나요?

사용 중인 패키지 버전을 입력하면 즉시 평가합니다.

영향 패키지

Packagist / symfony/routing
최초 영향 버전: 0 수정 버전: 5.4.52
수정 composer require symfony/routing:^5.4.52
Packagist / symfony/routing
최초 영향 버전: 6.0.0 수정 버전: 6.4.40
수정 composer require symfony/routing:^6.4.40
Packagist / symfony/routing
최초 영향 버전: 7.0.0 수정 버전: 7.4.12
수정 composer require symfony/routing:^7.4.12
Packagist / symfony/routing
최초 영향 버전: 8.0.0 수정 버전: 8.0.12
수정 composer require symfony/routing:^8.0.12
Packagist / symfony/symfony
최초 영향 버전: 0 수정 버전: 5.4.52
수정 composer require symfony/symfony:^5.4.52
Packagist / symfony/symfony
최초 영향 버전: 6.0.0 수정 버전: 6.4.40
수정 composer require symfony/symfony:^6.4.40
Packagist / symfony/symfony
최초 영향 버전: 7.0.0 수정 버전: 7.4.12
수정 composer require symfony/symfony:^7.4.12
Packagist / symfony/symfony
최초 영향 버전: 8.0.0 수정 버전: 8.0.12
수정 composer require symfony/symfony:^8.0.12

참고