CVE-2026-25479: Litestar Litestar's AllowedHosts Has A Validation Vulnerability

MODERATE
Advisory Identifier: GHSA-93ph-p7v4-hwh4
CVSS 6.5
CWE-185
Published
Advisory Summary

CVE-2026-25479 is a MODERATE (CVSS 6.5) litestar's allowedhosts has a validation vulnerability (CWE-185: Incorrect Regular Expression) affecting Litestar libraries in the PyPI ecosystem. The issue involves litestar's allowedhosts has a validation bypass due to unescaped regex metacharacters in configured host patterns. Remediation is available by upgrading affected packages to version 2.20.0.

CVE-2026-25479 at a Glance

CVE Identifier CVE-2026-25479
GHSA Identifier GHSA-93ph-p7v4-hwh4
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-185: Incorrect Regular Expression
Affected Product Litestar
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2026-25479

To remediate this vulnerability, upgrade all affected Litestar dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

litestar fixed: 2.20.0
pip install litestar>=2.20.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show litestar

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-25479, inspect your installed packages using pip:

pip show litestar

Analyze the terminal output to locate any version of Litestar in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.20.0), your application is affected.

Note: The pip show litestar command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-185: Incorrect Regular Expression, where the product specifies a regular expression in a way that causes data to be improperly matched or compared. In Litestar, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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) ``` 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) ``` 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.

CVE-2026-25479 Affected Litestar Versions

1 component(s)
Fixed Versions:
2.20.0
Product / Package Ecosystem Affected Versions Fixed Version
litestar
PyPI
≥ 2.19.0
< 2.20.0
All 1 versions
2.19.0
2.20.0

References

Frequently Asked Questions

What is CVE-2026-25479?
CVE-2026-25479 is a security vulnerability in Litestar involving Litestar's AllowedHosts has a validation bypass due to unescaped regex metacharacters in configured host patterns under CWE-185: Incorrect Regular Expression.
Which Litestar versions are affected?
Affected versions include releases prior to 2.20.0 across affected packages: litestar.
What version fixes CVE-2026-25479?
Upgrading to 2.20.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is litestar affected?
Yes, litestar is affected in releases prior to 2.20.0. Upgrade your dependency to 2.20.0 or later.
What is the CVSS score of CVE-2026-25479?
CVE-2026-25479 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N.
What CWE is associated with CVE-2026-25479?
CVE-2026-25479 is classified under CWE-185: Incorrect Regular Expression (The product specifies a regular expression in a way that causes data to be improperly matched or compared.).
How can I check PyPI dependencies for CVE-2026-25479?
Run the dependency tree command: 'pip show litestar'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-93ph-p7v4-hwh4",
  "modified" : "2026-02-09T22:38:10Z",
  "published" : "2026-02-09T17:19:00Z",
  "aliases" : [ "CVE-2026-25479" ],
  "summary" : "Litestar's AllowedHosts has a validation bypass due to unescaped regex metacharacters in configured host patterns",
  "details" : "### Summary\nAllowedHosts 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\n\n### Details\nIn 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.\n\n### PoC\nServer (poc_allowed_hosts_server.py)\n\n```\nfrom litestar import Litestar, get\nfrom litestar.middleware.allowed_hosts import AllowedHostsConfig\n\n@get(\"/\")\nasync def index() -> str:\n    return \"ok\"\n\nconfig = AllowedHostsConfig(allowed_hosts=[\"example.com\"])\napp = Litestar([index], allowed_hosts_config=config)\n```\n\n`uvicorn poc_allowed_hosts_server:app --host 127.0.0.1 --port 8001`\n\nClient (poc_allowed_hosts_client.py)\n\n```\nimport http.client\n\ndef req(host_header: str) -> tuple[int, bytes]:\n    c = http.client.HTTPConnection(\"127.0.0.1\", 8001, timeout=3)\n    c.request(\"GET\", \"/\", headers={\"Host\": host_header})\n    r = c.getresponse()\n    body = r.read()\n    c.close()\n    return r.status, body\n\nprint(\"evil.com:\", *req(\"evil.com\"))\nprint(\"exampleXcom:\", *req(\"exampleXcom\"))\n```\n\nExpected (vulnerable behavior):\nHost: evil.com → 400 invalid host\n\nHost: exampleXcom → 200 ok (bypass)\n\n### Impact\nType: security control bypass (host allowlist)\nWho 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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "litestar"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.19.0"
      }, {
        "fixed" : "2.20.0"
      } ]
    } ],
    "versions" : [ "2.19.0" ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/litestar-org/litestar/security/advisories/GHSA-93ph-p7v4-hwh4"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-25479"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/litestar-org/litestar/commit/06b36f481d1bfea6f19995cfb4f203aba45c4ace"
  }, {
    "type" : "WEB",
    "url" : "https://docs.litestar.dev/2/release-notes/changelog.html#2.20.0"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/litestar-org/litestar"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/litestar-org/litestar/releases/tag/v2.20.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-185" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-02-09T17:19:00Z",
    "nvd_published_at" : "2026-02-09T20:15:57Z"
  }
}