VDB
Sign up

PYSEC-2026-161

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

Quick fix

PYSEC-2026-161 — starlette: upgrade to the fixed version with the command below.

pip install --upgrade 'starlette>=1.0.1'

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: 0Fixed in: 1.0.1
Fixpip install --upgrade 'starlette>=1.0.1'

References