CVE-2026-25479: Litestar Litestar's AllowedHosts Has A Validation Vulnerability
MODERATECVE-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
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).
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.
pip install litestar>=2.20.0
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
CVE-2026-25479 Affected Litestar Versions
1 component(s)| 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?
Which Litestar versions are affected?
What version fixes CVE-2026-25479?
Is litestar affected?
What is the CVSS score of CVE-2026-25479?
What CWE is associated with CVE-2026-25479?
How can I check PyPI dependencies for CVE-2026-25479?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}