Маршрутизатор перенаправляет запрос на тот же URL с или без его следящей косой чертой или со схемой, которая требуется маршруту. Для этого игрок возвращает RedirectController::urlRedirectAction() с информацией о пути запроса в качестве пути. Так как Symfony 5.4.44, 6.4.12 и 7.1.5, urlRedirectAction() поворачивает путь, который начинается с // в <scheme>://..., так что протокол-относительные цели, настроенные в маршрутах, работают.
Информация о пути запроса начинается с //, когда это делает его URI. Таким образом, эти перенаправления отправляют браузер на хост, написанный в начале пути: GET https://app.example//evil.example/edit/ 301 Location: https://evil.example/edit This влияет на маршруты, чей путь начинается с заполнителя, который принимает /, например /path/edit с требованием .+. Перенаправление trailing-slash применяется ко всем из них, и схема перенаправляет на те, которые требуют схемы.
Фронтальный контроллер в подкаталоге не препятствует этому. Совпадение теперь кодирует косую или обратную косую черту, которая следует за ведущей косой чертой пути, на который она перенаправляет, как% 2F или% 5C. Это также происходит, когда между вкладками или новыми строками.
Целевой маршрут по-прежнему совпадает с ним, и протокол-относительные цели, настроенные в маршрутах, продолжают работать. Матчеры компонента Routing кодируют его перед вызовом RedirectableUrlMatcherInterface::redirect(), так что другие реализации этого метода также получают кодированный путь.
Показать оригинальное описание (EN)
The router redirects a request to the same URL with or without its trailing slash, or with the scheme that a route requires. To do so, the matcher returns RedirectController::urlRedirectAction() with the path info of the request as path. Since Symfony 5.4.44, 6.4.12 and 7.1.5, urlRedirectAction() turns a path that starts with // into <scheme>://..., so that protocol-relative targets configured in routes work. The path info of a request starts with // when its URI does. So these redirects send the browser to the host written at the start of the path: GET https://app.example//evil.example/edit/ => 301 Location: https://evil.example/edit This affects routes whose path starts with a placeholder that accepts /, like /{path}/edit with the .+ requirement. The trailing-slash redirect applies to all of them, and the scheme redirect to the ones that require a scheme. A front controller in a subdirectory doesn't prevent it. The matcher now encodes the slash or backslash that follows the leading slash of the path it redirects to, as %2F or %5C. It also does so when tabs or newlines come in between. The target route still matches it, and protocol-relative targets configured in routes keep working. The matchers of the Routing component encode it too before calling RedirectableUrlMatcherInterface::redirect(), so that other implementations of this method get the encoded path as well.
Характеристики атаки
Последствия
Строка CVSS v4.0