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 a user to follow that link.

How it works

Request::getBaseUrl() looks for the front controller's name further into the path when it isn't at the start, to support front controllers in a subdirectory. It kept everything before that name, which the client chooses, and that part could start with a host. Every URL built from the base URL then pointed there. See the Symfony advisory.

The 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. The server setups recommended in Symfony's docs aren't affected. framework.trusted_hosts doesn't help, because the request's real host is unchanged.

The fix returns an empty base URL for these requests, so generated URLs stay on your host.

Reported and fixed by Nicolas Grekas.