VDB
KO

PYSEC-2026-161

BadHost: Missing Host header validation poisons request.url.path, bypassing path-based security checks

Details

Starlette reconstructs the requested URL based on the HTTP Host request header and requested path, but does not perform any validation of the Host header value. This allows attackers to inject paths into the host part, prepending the actual path. However, routing in Starlette is based on the actual request path. This inconsistent interpretation of HTTP requests may lead to issues such as authentication bypass when the authentication depends on the reconstructed URL’s path.

Are you affected?

Enter the version of the package you're using.

Affected packages

PyPI / starlette
Introduced in: 0 Fixed in: 1.0.1
Fix pip install --upgrade 'starlette>=1.0.1'

References