A crafted link to your app can make the page it opens point its links, form actions, redirects and assets at another host. A login form could then send a user's password to the attacker, or the page could load the attacker's scripts. The attacker needs the user to follow that link.

Request::getBaseUrl() could take a host from the start of the request path when building the base URL.

Who is affected

Apps on symfony/http-foundation (also part of symfony/symfony) whose front controller sits in a subdirectory, with a web server that sends it paths that don't start with that directory. A root .htaccess that rewrites every URL to public/ does that. The Symfony advisory also lists servers that set SCRIPT_NAME to the request path, such as some nginx setups without fastcgi_split_path_info, and php -S with a router script outside the document root.

framework.trusted_hosts doesn't help. The server setups recommended in Symfony's docs aren't affected.

What to do

Update to 5.4.56, 6.4.50, 7.4.23 or 8.1.11. If you're on 8.0, update to 8.1.11. The fix returns an empty base URL for these requests, so generated URLs stay on your host.

Reported by Nicolas Grekas.