Symfony's host placeholder bug puts path-based access control on the wrong side of parsing

Symfony Routing versions before 5.4.56, 6.x before 6.4.50, 7.x before 7.4.23, and 8.x before 8.1.11 contain CVE-2026-118516. The flaw affects applications that combine routes with host placeholders and path-based security rules.

How the bypass works

CompiledUrlMatcher compares the host and path together for routes with a host. UrlMatcher handles them separately. A host placeholder that can match / may consume the beginning of the real path in the compiled matcher, while path-based rules such as access_control evaluate the actual request path and find a different result.

In the example published by Symfony, a route for /admin/report/{id} is protected by a path rule, but a crafted host and path can reach the controller with domain="/x". The controller runs even though the path rule sees a different value than the route matcher.

Applications are not affected merely because they use Symfony. They need a route with a host placeholder and a path-based rule protecting it. The default host requirement limits the attack, and framework.trusted_hosts can block the minimal host form. A permissive requirement such as .+ can keep the bypass reachable even when the real host name is used.

Fix and clear the cache

Upgrade to the fixed release for the deployed branch. The correction is in the route dumper, so clearing the application cache is part of the remediation. A server that keeps an old compiled route cache can remain vulnerable after the package update.

Review routes with host placeholders and the security rules around them. Test the real path and the crafted host-and-path case against the final compiled route table. Keep the Host validation layer strict and do not rely on a web server configuration that forwards arbitrary host headers unchanged.

Longer-term control

Prefer authorization checks that use the same canonical request values as routing. Add regression tests that compare compiled and non-compiled matching for unusual host labels, absolute-form request targets, encoded paths, and missing or malformed Host headers.

References