{"id":"CVE-2026-118516","aliases":["CVE-2026-118516","GHSA-xqw3-x93m-887x"],"related":[],"kind":"vulnerability","state":"published","title":"Symfony: Host Placeholders Can Match the Start of the Path in Compiled URL Matchers, Bypassing Path-Based Access Control","summary":"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.\n\n\n\n\nFor 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\".\n\n\n\n\nApplications 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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.\n\n\n\n\nFor 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\".\n\n\n\n\nApplications 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.","source":"cvelist"},{"lang":"en","text":"### Description\n\nFor 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.\n\nWith 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\"`.\n\nApplications 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.\n\n### Resolution\n\nThe 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.\n\nThe fix is in the dumper, so an application keeps its vulnerable compiled routes until its cache is cleared. Clear the cache after upgrading.\n\nThe patches for this issue are available [here](https://github.com/symfony/symfony/commit/067cde51e29f6d605de4de53322a02c6e23b5416) for branch 5.4 (and forward-ported to 6.4, 7.4, 8.1 and 8.2).\n\n### Credits\n\nSymfony would like to thank Vincent Cassiau (CyberVanguard) for reporting the issue and Nicolas Grekas for providing the fix.\n\nSymfony would also like to thank [Bruno Dias](https://github.com/cx-bruno-dias) and [Ana Lisboa](https://github.com/cx-ana-lisboa) from Checkmarx for their help getting a CVE assigned.","format":"markdown","source":"ghsa"}],"published":"2026-11-04T12:33:08.482Z","modified":"2026-12-01T21:30:04.484Z","severity":{"scorer":"Checkmarx","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N","score":6.3,"rating":"MEDIUM"},"severities":[{"scorer":"Checkmarx","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N","score":6.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N","rating":"MEDIUM"}],"cwes":["CWE-436","CWE-863"],"affected":[{"ranges":[{"type":"git","introduced":"0","fixed":"5.4.56","status":"affected"},{"type":"git","introduced":"6.0.0","fixed":"6.4.50","status":"affected"},{"type":"git","introduced":"7.0.0","fixed":"7.4.23","status":"affected"},{"type":"git","introduced":"8.0.0","fixed":"8.1.11","status":"affected"}],"vendor":"sensiolabs","product":"symfony","package":"symfony/routing","repo":"https://github.com/symfony/routing","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"5.4.56"}],"ecosystem":"Packagist","package":"symfony/routing","purl":"pkg:composer/symfony/routing","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"6.0.0","status":"affected","fixed":"6.4.50"}],"ecosystem":"Packagist","package":"symfony/routing","purl":"pkg:composer/symfony/routing","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"7.0.0","status":"affected","fixed":"7.4.23"}],"ecosystem":"Packagist","package":"symfony/routing","purl":"pkg:composer/symfony/routing","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"8.0.0","status":"affected","fixed":"8.1.11"}],"ecosystem":"Packagist","package":"symfony/routing","purl":"pkg:composer/symfony/routing","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"5.4.56"}],"ecosystem":"Packagist","package":"symfony/symfony","purl":"pkg:composer/symfony/symfony","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"6.0.0","status":"affected","fixed":"6.4.50"}],"ecosystem":"Packagist","package":"symfony/symfony","purl":"pkg:composer/symfony/symfony","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"7.0.0","status":"affected","fixed":"7.4.23"}],"ecosystem":"Packagist","package":"symfony/symfony","purl":"pkg:composer/symfony/symfony","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"8.0.0","status":"affected","fixed":"8.1.11"}],"ecosystem":"Packagist","package":"symfony/symfony","purl":"pkg:composer/symfony/symfony","source":"ghsa"}],"references":[{"url":"https://github.com/symfony/symfony/security/advisories/GHSA-xqw3-x93m-887x","tags":["third-party-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/symfony/symfony/commit/067cde51e29f6d605de4de53322a02c6e23b5416","tags":["patch","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-118516","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/FriendsOfPHP/security-advisories/blob/master/symfony/routing/CVE-2026-118516.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/FriendsOfPHP/security-advisories/blob/master/symfony/symfony/CVE-2026-118516.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/symfony/symfony","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/symfony/symfony/releases/tag/v5.4.56","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/symfony/symfony/releases/tag/v6.4.50","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/symfony/symfony/releases/tag/v7.4.23","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/symfony/symfony/releases/tag/v8.1.11","tags":["web"],"sources":["ghsa"]},{"url":"https://symfony.com/cve-2026-118516","tags":["web"],"sources":["ghsa"]}],"credits":["Vincent Cassiau (CyberVanguard)","Nicolas Grekas"],"assigner":"Checkmarx","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-11-09T21:12:52.419Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-118516","url":"https://www.cve.org/CVERecord?id=CVE-2026-118516","licence":"CVE Terms of Use","modified":"2026-11-09T21:13:06.710Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-xqw3-x93m-887x","url":"https://github.com/advisories/GHSA-xqw3-x93m-887x","licence":"CC-BY-4.0","modified":"2026-12-01T21:30:04.484Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-118516","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-118516","licence":"Public domain","modified":"2026-11-09T22:18:28.437Z"}],"updatedAt":"2026-12-01T21:47:24.720Z","epss":{"score":0.00472,"percentile":0.42427,"date":"2026-12-01T12:00:22.000Z"}}