Skip to main content

Litestar CVE-2026-48061

| EUVDEUVD-2026-52437 MEDIUM
Use of Less Trusted Source (CWE-348)
2026-06-10 https://github.com/litestar-org/litestar GHSA-3qmc-cj7q-62hv PYSEC-2026-2603
5.9
CVSS 3.1 · Vendor: https://github.com/litestar-org/litestar
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Identify Litestar app accepting direct or proxy-passthrough connections
  2. Delivery
    Send HTTP/1.0 request omitting Host header
  3. Exploit
    Set X-Forwarded-Host to allowlisted domain
  4. Install
    Middleware falls back to attacker-controlled header and validates it
  5. C2
    Application processes request as if from trusted host
  6. Execute
    Inject attacker domain into password reset link or cache key
  7. Impact
    Harvest victim credentials or poison cached content

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V6 - Authentication IP-independent access control
Exploitation Conditions

Exploitation requires three concurrent conditions: (1) the Litestar application must have AllowedHostsConfig configured, activating AllowedHostsMiddleware; (2) the application must be reachable by the attacker without an upstream reverse proxy that strips or overwrites the X-Forwarded-Host header - meaning either direct exposure of the Litestar process port or a misconfigured proxy chain that passes X-Forwarded-Host through unchanged; and (3) the attacker must be able to deliver a request with no Host header, achievable via HTTP/1.0 clients, raw TCP connections, or certain misconfigured intermediaries. The CVSS PR:N and UI:N confirm no authentication and no victim interaction are required once these deployment conditions are met. Exploitation is limited by AC:H: applications correctly fronted by a proxy enforcing Host header normalization and stripping X-Forwarded-Host are not exploitable. The specific vulnerable code path is AllowedHostsMiddleware.__call__ at litestar/middleware/allowed_hosts.py:68.

Impact

The CVSS 3.1 score of 5.9 (AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N) reflects network exploitability with no authentication or user interaction required, but high attack complexity because successful exploitation depends on a non-default deployment condition: the application must be reachable without an upstream reverse proxy that strips or overwrites X-Forwarded-Host. Deployments behind nginx, Caddy, or HAProxy configured to strip this header are not exploitable, which meaningfully limits real-world exposure relative to the raw CVSS network vector. No EPSS score was provided in the input data and cannot be inferred. No CISA KEV listing is present, so active exploitation in the wild is not confirmed. However, a functional PoC is publicly available in the GitHub security advisory itself, and the attack class - host header injection - is well-documented with established abuse chains (password reset poisoning, cache poisoning). The integrity-only impact (I:H, C:N) may understate risk in applications that use the resolved host value to generate password reset URLs, because indirect credential theft is a realistic downstream consequence. Overall, this is a moderate-priority issue for directly-exposed Litestar deployments; lower priority for properly proxy-fronted deployments.

Exploit ScenarioDerived

An attacker sends an HTTP/1.0 request directly to a Litestar application's port, deliberately omitting the Host header and including the header X-Forwarded-Host: trusted.example.com (a domain on the application's allowlist). The middleware, finding no Host header, falls back to the attacker-supplied X-Forwarded-Host value, validates it as allowed, and forwards the request to the application handler. If the handler uses the resolved host to generate a password reset URL, the resulting link points to trusted.example.com - which the attacker controls or has poisoned - redirecting the victim's reset token. A functional PoC demonstrating this bypass is included in the GitHub security advisory.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jun 10, 2026

Host validation bypass in Litestar's AllowedHostsMiddleware allows unauthenticated remote attackers to circumvent the allowed-hosts allowlist by omitting the HTTP Host header and substituting a client-controlled X-Forwarded-Host header set to any whitelisted domain. Affected are all Litestar deployments (pip/litestar < 2.22.0) using AllowedHostsConfig that are reachable without a trusted reverse proxy stripping X-Forwarded-Host - a condition reflected in the CVSS AC:H rating. Publicly available exploit code exists demonstrating the bypass; no CISA KEV listing at time of analysis.

RemediationAI

Upgrade to Litestar 2.22.0 or later, which removes the X-Forwarded-Host fallback in AllowedHostsMiddleware (vendor patch commit: https://github.com/litestar-org/litestar/commit/6930a20ceb543912cd651b42deae5b9f3637a262; advisory: https://github.com/litestar-org/litestar/security/advisories/GHSA-3qmc-cj7q-62hv). If immediate patching is not feasible, configure an upstream reverse proxy (nginx, Caddy, HAProxy) to explicitly strip or overwrite the X-Forwarded-Host header on all inbound client requests before they reach the Litestar process - this prevents the attacker-controlled value from reaching the middleware. Trade-off: stripping X-Forwarded-Host at the proxy will break any application logic that legitimately relies on that header for host forwarding. As an additional layer, block or reject HTTP/1.0 connections at the network edge, since omitting the Host header is most natural with HTTP/1.0 clients; trade-off is potential breakage of legacy integrations. These compensating controls do not fix the code-level trust issue and should not substitute for the 2.22.0 upgrade.

Affected VersionsENISA

litestar < 2.22.0

Affected Packages

pypi litestar fix: 2.22.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Litestar is a Python ASGI web framework. Its AllowedHostsMiddleware (litestar/middleware/allowed_hosts.py:68) validates the request's hostname against a configured regex allowlist. The root cause maps to CWE-348 (Use of Less Trusted Source): the vulnerable code resolved the host value as headers.get('host', headers.get('x-forwarded-host', '')).split(':')[0], falling back to the X-Forwarded-Host header - a proxy-set, client-controllable header - whenever the Host header was absent. HTTP/1.1 mandates the Host header, but HTTP/1.0 clients, raw TCP connections, and misconfigured proxies may omit it, creating the exploitation window. X-Forwarded-Host carries no trust guarantees without prior proxy-layer enforcement. The fix in commit 6930a20 removes the fallback entirely, changing the lookup to headers.get('host').split(':')[0] so only the standard Host header is evaluated. The affected pip package identifier is pkg:pip/litestar.

Know when Python gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/litestar-org/litestar) PRIMARY 5.9 MEDIUM
AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N

Primary rating from Vendor (https://github.com/litestar-org/litestar) · only source for this CVE.

CVSS VectorVendor: https://github.com/litestar-org/litestar

Attack Vector
Network
Attack Complexity
High
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
High
Availability
None

DescriptionCVE.org

Summary

AllowedHostsMiddleware trusts the X-Forwarded-Host header as a fallback when the Host header is absent. Since X-Forwarded-Host is a client-controllable header, an attacker can bypass the allowed hosts validation by omitting the Host header and supplying an X-Forwarded-Host header set to a whitelisted domain. This enables host header injection attacks such as password reset poisoning, cache poisoning, and server-side request routing manipulation.

Details

In AllowedHostsMiddleware.__call__, the host value used for validation is resolved as follows:

https://github.com/litestar-org/litestar/blob/main/litestar/middleware/allowed_hosts.py#L68

python
headers = MutableScopeHeaders(scope=scope)
if host := headers.get("host", headers.get("x-forwarded-host", "")).split(":")[0]:
    if self.allowed_hosts_regex.fullmatch(host):
        await self.app(scope, receive, send)
        return

When Host is absent (e.g., HTTP/1.0 clients, misconfigured proxies, or raw TCP connections), the middleware falls back to X-Forwarded-Host without any verification that the request actually passed through a trusted reverse proxy.

An attacker can send a request with no Host header and set X-Forwarded-Host to any whitelisted domain, bypassing the entire allowed hosts check. The application then processes the request as if it originated from a trusted host.

This is particularly dangerous when applications use the resolved host value for:

  • Generating password reset links (Host header injection → link points to attacker domain)
  • Cache key generation (cache poisoning)
  • Routing or backend selection decisions

PoC

python
"""
PoC: Allowed Hosts Bypass via X-Forwarded-Host in Litestar 3.0.0b0

Affected:
  litestar/middleware/allowed_hosts.py:68
  -> headers.get("host", headers.get("x-forwarded-host", "")).split(":")[0]
"""

import asyncio
from litestar import Litestar, get
from litestar.config.allowed_hosts import AllowedHostsConfig
from litestar.testing import TestClient


@get("/")
async def index() -> dict:
    return {"status": "ok"}


app = Litestar(
    route_handlers=[index],
    allowed_hosts=AllowedHostsConfig(allowed_hosts=["trusted.example.com"]),
)
# --- 1. Baseline: invalid host is blocked ---

with TestClient(app=app) as c:
    resp = c.get("/", headers={"host": "evil.com"})
    assert resp.status_code == 400
    print(f"[*] Host: evil.com -> {resp.status_code} (blocked)")
# --- 2. Bypass: ASGI scope without Host, with X-Forwarded-Host ---

async def test_bypass():
    scope = {
        "type": "http",
        "method": "GET",
        "path": "/",
        "root_path": "",
        "scheme": "http",
        "query_string": b"",
        "headers": [
# No "host" header - only x-forwarded-host
            (b"x-forwarded-host", b"trusted.example.com"),
        ],
        "server": ("testserver", 80),
        "app": app,
        "litestar_app": app,
        "state": {},
    }

    captured = {}

    async def receive():
        return {"type": "http.request", "body": b""}

    async def send(message):
        if message["type"] == "http.response.start":
            captured["status"] = message["status"]

    await app(scope, receive, send)
    return captured["status"]

status = asyncio.run(test_bypass())
print(f"[*] No Host + X-Forwarded-Host: trusted.example.com -> {status} (bypassed)")
assert status == 200, f"Expected 200, got {status}"
print(f"[!] AllowedHosts check passed using client-controlled X-Forwarded-Host")

Output:

[*] Host: evil.com -> 400 (blocked)
[*] No Host + X-Forwarded-Host: trusted.example.com -> 200 (bypassed)
[!] AllowedHosts check passed using client-controlled X-Forwarded-Host

Impact

This is a host validation bypass vulnerability. Any application using AllowedHostsConfig is affected when deployed without a reverse proxy that strips X-Forwarded-Host, or when accepting HTTP/1.0 connections.

An attacker can bypass the allowed hosts restriction and have requests processed as if they originated from a trusted host. This can lead to:

  • Password reset poisoning: if the application uses the host value to generate reset links, the attacker can redirect them to a malicious domain
  • Cache poisoning: cached responses keyed on the host value can be polluted with attacker-controlled content
  • Routing manipulation: backend routing decisions based on host value can be influenced

Threat Intelligence Overview

EPSS Score
0.0%
Top 93% exploitable
Threat Intel
1
1 source
Data Quality
6 sources
Confidence: High

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
No
Human Impact· derived
Medium

Priority Score

30
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +30
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Authentication bypass attacks exploit flaws in the verification mechanisms that control access to systems and applications.

More in Python

View all
CVE-2025-24016 CRITICAL POC
9.9 Feb 10

Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t

CVE-2025-27520 CRITICAL POC
9.8 Apr 04

BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser

CVE-2025-2945 CRITICAL POC
9.9 Apr 03

pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi

CVE-2013-5093 MEDIUM POC
6.8 Sep 27

The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python

CVE-2025-32375 CRITICAL POC
9.8 Apr 09

BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2024-21644 HIGH POC
7.5 Jan 08

pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.

CVE-2026-33017 CRITICAL POC
9.3 Mar 17

Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301

CVE-2017-9462 HIGH POC
8.8 Jun 06

In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse

CVE-2026-49869 CRITICAL POC
10.0 Jun 26

Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to

CVE-2026-39987 CRITICAL POC
9.3 Apr 08

Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/

CVE-2024-21645 MEDIUM POC
5.3 Jan 08

pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy