CVE-2026-118516
JSON

6.3medium

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

Severity
6.3medium CVSS:4.0 by Checkmarx
Exploit likelihood
0.47% (higher than 42% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
Checkmarx
Also known as
GHSA-xqw3-x93m-887x

Description

The Symfony Routing components CompiledUrlMatcher and UrlMatcher interpret the host and path information differently, allowing path-based authorization rules to be bypassed in Symfony versions prior to 5.4.56, 6.x prior to 6.4.50, 7.x prior to 7.4.23, and 8.x prior to 8.1.11. For routes that define a host, CompiledUrlMatcher matches the string $host.'.'.$pathinfo against the host regular expression followed by the path regular expression, while UrlMatcher matches the host and the path separately. A host placeholder can therefore  match /, and consume the beginning of the path, so the request is routed to a controller, while UrlMatcher  would find no route. Rules that look at the path, such as access_control entries and firewall patterns, are evaluated against the actual request path, so they do not apply while the controller of the route runs, potentially allowing an unauthenticated request to reach a protected controller. For example, with the route /admin/report/{id}, the host app.{domain} and the rule access_control: [{ path: ^/admin, roles: ROLE_ADMIN }], an anonymous request for /admin/report/1 is sent to the login page. A request with the Host header app and path /x./admin/report/1 instead reaches the controller, with domain="/x". With the required domain: .+, the real hostname works: app.example.com and /x./admin/report/1 match with domain="example.com./x". Applications are affected if they have routes with host placeholders protected by path-based rules. With the default requirement, the Host header 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. If the requirement accepts /, such as .+, a real hostname works, and trusted_hosts does not help.

Affected

Product or packageVersionsReported by
symfony/routingbefore 5.4.56, from 6.0.0 before 6.4.50, from 7.0.0 before 7.4.23, from 8.0.0 before 8.1.11CVE List
symfony/routing (Packagist)before 5.4.56, from 6.0.0 before 6.4.50, from 7.0.0 before 7.4.23, from 8.0.0 before 8.1.11GitHub Advisory Database
symfony/symfony (Packagist)before 5.4.56, from 6.0.0 before 6.4.50, from 7.0.0 before 7.4.23, from 8.0.0 before 8.1.11GitHub Advisory Database

All scores

Checkmarx6.3medium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N
GitHubmedium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N

Classification

CWE-436CWE-863

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

The Symfony Routing components CompiledUrlMatcher and UrlMatcher interpret the host and path information differently, allowing path-based authorization rules to be bypassed in Symfony versions prior to 5.4.56, 6.x prior to 6.4.50, 7.x prior to 7.4.23, and 8.x prior to 8.1.11. For routes that define a host, CompiledUrlMatcher matches the string $host.'.'.$pathinfo against the host regular expression followed by the path regular expression, while UrlMatcher matches the host and the path separately. A host placeholder can therefore  match /, and consume the beginning of the path, so the request is routed to a controller, while UrlMatcher  would find no route. Rules that look at the path, such as access_control entries and firewall patterns, are evaluated against the actual request path, so they do not apply while the controller of the route runs, potentially allowing an unauthenticated request to reach a protected controller. For example, with the route /admin/report/{id}, the host app.{domain} and the rule access_control: [{ path: ^/admin, roles: ROLE_ADMIN }], an anonymous request for /admin/report/1 is sent to the login page. A request with the Host header app and path /x./admin/report/1 instead reaches the controller, with domain="/x". With the required domain: .+, the real hostname works: app.example.com and /x./admin/report/1 match with domain="example.com./x". Applications are affected if they have routes with host placeholders protected by path-based rules. With the default requirement, the Host header 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. If the requirement accepts /, such as .+, a real hostname works, and trusted_hosts does not help.

GitHub Advisory Database
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 regexp now captures the path ahead of each host alternative that has placeholders, and checks after the host regexp that the rest of the subject is that path. Since a host cannot contain /, the path starts at the first /, and host placeholders can no longer match any part of it, whatever their requirements. Valid requests keep the same route and the same parameters, as verified against UrlMatcher over eleven million generated cases.

The fix is in the dumper, so an application keeps its vulnerable compiled routes until its cache is cleared. Clear the cache after upgrading.

The patches for this issue are available here for branch 5.4 (and forward-ported to 6.4, 7.4, 8.1 and 8.2).

Credits

Symfony would like to thank Vincent Cassiau (CyberVanguard) for reporting the issue and Nicolas Grekas for providing the fix.

Symfony would also like to thank Bruno Dias and Ana Lisboa from Checkmarx for their help getting a CVE assigned.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-118516 changed 2026-11-09CVE Terms of Use
GitHub Advisory DatabaseGHSA-xqw3-x93m-887x changed 2026-12-01CC-BY-4.0
NVDCVE-2026-118516 changed 2026-11-09Public domain