Skip to content

GHSA-x746-7m8f-x49c CVE-2026-48817 PYSEC-2026-2280

Starlette: Arbitrary HTTP method dispatched to `HTTPEndpoint` attributes via `getattr`

Medium PyPI
Severity
5.3 / 10
Medium · CVSS 3.1
Exploit chance (EPSS)
0.21%
Chance of exploitation in the next 30 days. Higher than 11.61% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-470 Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')
Fix
1.1.0
Upgrade starlette to this version or later

Description

Summary

When dispatching a request, HTTPEndpoint selects the handler by lowercasing the HTTP method and looking it up as an attribute with getattr, without restricting the lookup to a known set of HTTP verbs.

When an HTTPEndpoint subclass is registered through Route(...) without an explicit methods= argument, the route does not constrain the method and every method reaches the endpoint. If a non-standard HTTP method whose lowercased name matches an attribute on the endpoint subclass reaches the endpoint, that attribute is invoked as if it were a request handler. An attacker can use this to reach methods that were never meant to be HTTP handlers, such as internal helpers, without the authorization checks applied by the intended public handler.

Details

HTTPEndpoint uses the client-supplied method name to resolve an instance attribute, without validating it against the set of HTTP verbs the endpoint supports. A method such as _DO_DELETE therefore resolves an attribute like _do_delete and invokes it. Non-standard methods are valid RFC 9110 token methods, so an endpoint must not treat the method name as a trusted attribute selector.

Impact

An application is affected when all of the following hold:

  • It defines an HTTPEndpoint subclass and registers it via Route(...) without an explicit methods= argument.
  • The subclass defines additional methods whose names match a non-standard HTTP-method token shape and that accept a single request argument and return a response.

This also affects frameworks built on Starlette, like FastAPI.

Mitigation

Register HTTPEndpoint subclasses with an explicit methods= argument on the Route, listing only the HTTP verbs the endpoint supports. The route then rejects any other method with 405 Method Not Allowed before it reaches the endpoint, so non-standard methods cannot resolve an attribute.

Affected versions

PyPI

PackageVulnerableFixed in
starlette
< 1.1.0
1.1.0
starlette
< 1.1.0
1.1.0

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

starlette PyPI → 1.1.0

pip
pip install --upgrade "starlette>=1.1.0"
poetry
poetry add "starlette>=1.1.0"
uv
uv add "starlette>=1.1.0"

Severity breakdown

CVSS 3.1 5.3

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
Low
Availability
None

Weakness

CWE-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')

The product uses external input with reflection to select which classes or code to use, but it does not sufficiently prevent the input from selecting improper classes or code.

How to prevent it
  • Architecture and Design: Refactor your code to avoid using reflection.
  • Architecture and Design: Do not use user-controlled inputs to select and load classes or code.
  • Implementation: Apply strict input validation by using allowlists or indirect selection to ensure that the user is only selecting allowable classes or code.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-86qp-5c8j-p5mr
Starlette has missing Host header validation that poisons request.url.path, bypassing path-based security checks
Medium Known exploited Also affects starlette
GHSA-82w8-qh3p-5jfq
Starlette: request.form() limits silently ignored for application/x-www-form-urlencoded enable DoS
High Also affects starlette
GHSA-jp82-jpqv-5vv3
Starlette: Unvalidated request path concatenated into authority poisons request.url.hostname
Medium Also affects starlette
GHSA-wqp7-x3pw-xc5r
Starlette: SSRF and NTLM credential theft via UNC paths in StaticFiles on Windows
High Also affects starlette
GHSA-7f5h-v6xp-fcq8
Starlette vulnerable to O(n^2) DoS via Range header merging in ``starlette.responses.FileResponse``
High Also affects starlette
GHSA-2c2j-9gv5-cj73
Starlette has possible denial-of-service vector when parsing large files in multipart forms
Medium Also affects starlette
GHSA-f96h-pmfr-66vw
Starlette Denial of service (DoS) via multipart/form-data
High Also affects starlette
GHSA-v5gw-mw7f-84px
Starlette has Path Traversal vulnerability in StaticFiles
High Also affects starlette
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor