Skip to content
Medium 6.5

Symfony: Host Placeholders Can Match the Start of the Path in Compiled URL Matchers, Bypassing Path-Based Access Control

CVE-2026-118516 First seen on SecPulse

Affected packages

PackageAffected → Fixed
sensiolabssymfony
< 5.4.56→ 5.4.56
≥ 6.0.0, < 6.4.50→ 6.4.50
≥ 7.0.0, < 7.4.23→ 7.4.23
≥ 8.0.0, < 8.1.11→ 8.1.11
composersymfony/routing
< 8.1.11→ 8.1.11
composersymfony/symfony
< 8.1.11→ 8.1.11
Packagistsymfony/routing
≥ 8.0.0, < 8.1.11→ 8.1.11
Packagistsymfony/symfony
≥ 8.0.0, < 8.1.11→ 8.1.11

Fix status by distribution

Records published by each distribution for this CVE. Fixed versions differ by release; check each link.

Original description The description as published by the source.

Description

For routes that have a host, CompiledUrlMatcher matches the string $host.'.'.$pathinfo against the host regexp followed by the path regexp. A host placeholder could match /, so it could eat the start of the path, while UrlMatcher matches the host and the path separately and finds no route. Rules that look at the path, such as access_control entries and the pattern of firewalls, judge the real path, so they do not apply, while the controller of the route runs.

With the route /admin/report/{id}, the host app.{domain} and access_control: [{ path: ^/admin, roles: ROLE_ADMIN }], an anonymous request for /admin/report/1 is sent to the login page, while one with the host app and the path /x./admin/report/1 reaches the controller, with domain="/x". With the requirement domain: .+, the real host name works: app.example.com and /x./admin/report/1 match with domain="example.com./x".

Applications are affected when they have routes with host placeholders protected by path-based rules. With the default requirement, the Host 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. With a requirement that accepts /, such as .+, the real host name works and trusted_hosts does not help.

Resolution

The compiled reg…

Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory

References

We use cookies for analytics and ad measurement. This setting applies to all Game co., Ltd. sites. Details