request.url.path is not the request's path. It is the path field of a URL Starlette builds by concatenating the scheme, the Host header, and scope["path"], then handing the result to urlsplit. When the Host header contains a /, urlsplit reads it as the URL's path delimiter and request.url.path returns whatever the header named. The router still dispatches on scope["path"]. CVE-2026-48710 is a middleware that gates on the first label and a sink that runs the second.
CVE-2026-48710: Starlette's request.url.path Is Not the Request's Path
vendor
patterns
cve
proof of concept
There are two paths in every Starlette request
The ASGI scope dict is a structured wire-level interface. scope["path"] is the path the server parsed from the HTTP request line. Starlette's router uses it. The route table on a FastAPI() app is matched against it. Whatever function ends up running, it ran because scope["path"] named it.
request.url.path is a different field. It is a property on a URL object that Request.url constructs lazily from the scope. The constructor lives in starlette/datastructures.py:
class URL:
def __init__(self, url: str = "", scope: Scope | None = None, **components):
if scope is not None:
scheme = scope.get("scheme", "http")
server = scope.get("server", None)
path = scope["path"]
query_string = scope.get("query_string", b"")
host_header = None
for key, value in scope["headers"]:
if key == b"host":
host_header = value.decode("latin-1")
break
if host_header is not None:
url = f"{scheme}://{host_header}{path}"
elif server is None:
url = path
...
self._url = urlself._url is a string. The .path property runs urlsplit(self._url).path. The path returned by that property is not the path the router used. It is the path field that urlsplit recovers from a string Starlette wrote by joining four pieces: the scheme, ://, the Host header, and the scope path.
Three of those pieces come from the server's own configuration. One is from the client.
The bypass is urlsplit reading the Host header
Pick a Host value that, when concatenated, produces a URL whose .path differs from scope["path"].
GET /admin HTTP/1.1
Host: 127.0.0.1:8000/health?x=The scheme is http. The scope path is /admin. The Host header is 127.0.0.1:8000/health?x=. The string Starlette concatenates is:
http://127.0.0.1:8000/health?x=/adminHand that to urlsplit:
>>> from urllib.parse import urlsplit
>>> urlsplit("http://127.0.0.1:8000/health?x=/admin")
SplitResult(scheme='http', netloc='127.0.0.1:8000', path='/health', query='x=/admin', fragment='')urlsplit has no model of what the application meant. It applies RFC 3986's grammar to the string. / after the authority opens the path. ? ends the path and opens the query. The scope path falls into the query.
request.url.path is now /health. request.scope["path"] is still /admin. Both live on the same Request object. They disagree.
Any middleware that reads request.url.path and uses it to make an authorization decision is reading a label whose value the Host header controls. The PoC's lab makes the disagreement visible by writing the middleware exactly that way:
@app.middleware("http")
async def intentionally_vulnerable_path_auth(request: Request, call_next):
middleware_path_seen = request.url.path # vulnerable sink
real_scope_path = request.scope.get("path")
if middleware_path_seen.startswith(PUBLIC_PATH_PREFIXES):
response = await call_next(request)
...PUBLIC_PATH_PREFIXES includes /health. middleware_path_seen is /health. The middleware allows. call_next(request) advances the request to the router. The router reads scope["path"], which is still /admin. The /admin handler runs. Whatever the application would return for an authenticated /admin request, the response is returned unauthenticated.
The curl from the lab's manual_test.sh:
curl -i -H "Host: 127.0.0.1:8000/health?x=" http://127.0.0.1:8000/admin
# expected: 200, admin-dashboard-dataThe two paths are a filter and a sink that were never written to agree
Starlette ships two consumers of "the path of this request." scope["path"] is the value the protocol parser put there. request.url.path is the value urlsplit recovers from a string Starlette assembles on demand. They are derived through different code, from different inputs, and they have always been allowed to differ.
The author of an auth middleware reading request.url.path is not making an obvious mistake. The label looks like the request's path. The Starlette docs describe request.url as the URL of the request. Both scope["path"] and request.url.path return /health for a healthy request to /health. The difference only manifests when an attacker controls a header that one of the constructors reads.
That is the shape this blog has been naming gate-narrower-than-sink. Two parsers read what should be the same logical input. The grammar of the gate's parser, urlsplit applied to a string that includes the Host header, is a different grammar than the sink's, the ASGI server's request-line parser writing to scope["path"]. The input the sink accepts but the gate does not match flows through unfiltered. The W3 Total Cache CVE this blog covered was the same shape with two PHP regexes describing the same template syntax differently. This one is the same shape with urllib.parse.urlsplit on one side and the ASGI server on the other.
The PoC's lab pins the version its README calls fixed
The PoC ships two artifacts: a network scanner and an intentionally vulnerable FastAPI lab. The scanner's README says:
Affected: Starlette ≤ 0.46.1 / FastAPI ≤ 0.115.x Fixed in: Starlette 0.46.2+
The lab's requirements.txt says:
fastapi==0.115.12
starlette==0.46.2
uvicorn[standard]==0.34.2
pydantic>=2.7,<3The lab's README explains that both apps, app_vulnerable.py on port 8000 and app_fixed.py on port 8001, use the same intentionally vulnerable Starlette package version. The manual_test.sh script expects the vulnerable app on 0.46.2 to return 200 for the bypass. It does.
The PoC author shipped a working demonstration that the version the scanner's documentation calls fixed is not. The app_fixed.py next to it works around the bug by reading request.scope["path"] instead of request.url.path. The pattern-level fix the lab demonstrates is a developer-side change, not a framework upgrade.
The Starlette URL constructor on 0.46.2 concatenates the Host header into the string urlsplit reads, with no validation:
if host_header is not None:
url = f"{scheme}://{host_header}{path}"That line is identical in 0.46.1, 0.46.2, 0.47.0, 0.47.1, 0.47.2, 0.47.3, 0.48.0, all of 0.49.x through 0.52.x, 1.0.0, and 1.0.1. Every version the scanner names as fixed still ships the line.
The fix is one regex on the Host header
Commit 764dab0 in the Starlette repo, May 21, 2026, titled "Ignore malformed Host header when constructing request.url":
+# Rejects Host header chars (/, ?, #, @, ...) that would let urlsplit produce a path differing from scope["path"].
+_HOST_RE = re.compile(r"^([a-z0-9.-]+|\[[a-f0-9]*:[a-f0-9.:]+\])(?::[0-9]+)?$", re.IGNORECASE)
...
- if host_header is not None:
+ if host_header is not None and _HOST_RE.fullmatch(host_header):
url = f"{scheme}://{host_header}{path}"The maintainer's own comment names the bug. A Host header containing /, ?, #, or @ is rejected because allowing it lets urlsplit produce a path differing from scope["path"]. The line that names the threat is added in the same commit as the line that closes it.
_HOST_RE shipped in Starlette 1.1.0, tagged 2026-05-23. The PoC was published 2026-05-28, five days after 1.1.0, three hours before 1.2.0. The "Fixed in: Starlette 0.46.2+" line was wrong when it was written.
host-header-as-self, again
This blog has named the shape: host-header-as-self. A server validates inbound requests against its own URL and derives that URL from a header the client sets. The signed "intended for X" check becomes "intended for whatever the client claims X is." That post traced the Apache Airflow AWS Auth Manager's _prepare_request reading the Host header into request_data['http_host'], which flowed into python3-saml's Destination check, which compared a signed SAML attribute against a value the IdP and the attacker both controlled.
CVE-2026-48710 is the same shape one layer down. Airflow's bug used the Host header to compute the SAML self-URL the cryptographic gate compared against. Starlette's bug uses the Host header to compute the request.url.path value any custom auth middleware might gate on. The shared mechanism in both cases is the assembly of a string out of server fields and a client-supplied header, followed by a structural operation (signature check, startswith) that treats the whole string as the server's.
The Airflow exhibit's pre-patch line was host = request.headers.get("host", request.client.host if request.client else "localhost"). The Starlette pre-patch line is url = f"{scheme}://{host_header}{path}". Both functions believed they were computing the server's notion of itself. Both were transcribing the client's claim about it.
Close
The PoC's scanner is competent. The mechanism it tests for is real. The lab it ships is internally consistent: the version pinned in requirements.txt does demonstrate the bypass, and the app_fixed.py next to it does demonstrate the developer-side mitigation. The wrong sentence is the four-word claim at the top of the scanner's README that names a framework version that does not contain the fix.
The fix is one regex on the Host header. It landed in main five days before the PoC dropped, in a release the PoC's README does not name.