CVE-2026-25479
Regex Injection in Litestar Allowed Hosts Enables Host Bypass
Publication date: 2026-02-09
Last updated on: 2026-02-17
Assigner: GitHub, Inc.
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| litestar | litestar | to 2.20.0 (exc) |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-185 | The product specifies a regular expression in a way that causes data to be improperly matched or compared. |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
This vulnerability exists in the Litestar ASGI framework prior to version 2.20.0. The issue is in the allowed_hosts middleware, where allowlist entries are compiled into regular expressions without escaping regex metacharacters. This means special characters like '.' retain their regex meaning, allowing an attacker to supply a host that matches the regex pattern but is not the intended literal hostname, effectively bypassing host restrictions.
How can this vulnerability impact me? :
An attacker can exploit this vulnerability to bypass host restrictions by supplying a crafted host header that matches the regex pattern but is not an authorized hostname. This can lead to unauthorized access or manipulation of the application, potentially compromising confidentiality and integrity of data.
How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:
I don't know
How can this vulnerability be detected on my network or system? Can you suggest some commands?
I don't know
What immediate steps should I take to mitigate this vulnerability?
To mitigate this vulnerability, you should upgrade Litestar to version 2.20.0 or later, where the issue with allowlist entries being compiled into regex patterns with special meaning is fixed.