Компоненты Symfony Routing CompiledUrlMatcher и UrlMatcher по-разному интерпретируют информацию о хосте и пути, позволяя обойти правила авторизации на основе пути в версиях Symfony до 5.4.56, 6.x до 6.4.50, 7.x до 7.4.23 и 8.x до 8.1.11. Для маршрутов, которые определяют хост, CompiledUrlMatcher сопоставляет строку $host.'.$pathinfo с регулярным выражением хоста, за которым следует регулярное выражение пути, в то время как UrlMatcher сопоставляет хост и путь отдельно. Таким образом, хост-заполнитель может соответствовать / и потреблять начало пути, поэтому запрос направляется контроллеру, в то время как UrlMatcher не найдет маршрут.
Правила, которые смотрят на путь, такие как записи access_control и шаблоны брандмауэра, оцениваются по фактическому пути запроса, поэтому они не применяются во время работы контроллера маршрута, что потенциально позволяет неаутентифицированному запросу достичь защищенного контроллера. Например, с маршрутом /admin/report/{id, хост-приложением.domain и правилом access_control: [ путь: /админ, роли: ROLE_ADMIN ], на страницу входа отправляется анонимный запрос для /admin/report/1. Запрос с приложением заголовка Host и путем /x./admin/report/1 вместо этого достигает контроллера с доменом "/ x".
С требуемым доменом: .+, настоящее имя хоста работает: app.example.com и /x./admin/report/1 совпадают с domain"example.com./x". Приложения затрагиваются, если у них есть маршруты с хост-заполнителями, защищенными правилами, основанными на пути. По умолчанию заголовок Host должен быть хостом маршрута без последних меток, таких как приложение: framework.trusted_hosts блокирует, что, в то время как веб-сервер, который обслуживает только известные имена, не может, например, Nginx передает необработанный заголовок Host в FastCGI для строки запроса, которая несет абсолютный URI.
Если требование принимает /, например .+, то реальное имя хоста работает, а trusted_hosts не помогает.
Показать оригинальное описание (EN)
The Symfony Routing components CompiledUrlMatcher and UrlMatcher interpret the host and path information differently, allowing path-based authorization rules to be bypassed in Symfony versions prior to 5.4.56, 6.x prior to 6.4.50, 7.x prior to 7.4.23, and 8.x prior to 8.1.11. For routes that define a host, CompiledUrlMatcher matches the string $host.'.'.$pathinfo against the host regular expression followed by the path regular expression, while UrlMatcher matches the host and the path separately. A host placeholder can therefore match /, and consume the beginning of the path, so the request is routed to a controller, while UrlMatcher would find no route. Rules that look at the path, such as access_control entries and firewall patterns, are evaluated against the actual request path, so they do not apply while the controller of the route runs, potentially allowing an unauthenticated request to reach a protected controller. For example, with the route /admin/report/{id}, the host app.{domain} and the rule access_control: [{ path: ^/admin, roles: ROLE_ADMIN }], an anonymous request for /admin/report/1 is sent to the login page. A request with the Host header app and path /x./admin/report/1 instead reaches the controller, with domain="/x". With the required domain: .+, the real hostname works: app.example.com and /x./admin/report/1 match with domain="example.com./x". Applications are affected if they have routes with host placeholders protected by path-based rules. With the default requirement, the Host header must be the host of the route without its last labels, such as app: framework.trusted_hosts blocks that, while a web server that only serves known names may not, for instance, Nginx passing the raw Host header to FastCGI for a request line that carries an absolute URI. If the requirement accepts /, such as .+, a real hostname works, and trusted_hosts does not help.
Характеристики атаки
Последствия
Строка CVSS v4.0