CVE-2026-25478 Overview
CVE-2026-25478 is a CORS (Cross-Origin Resource Sharing) origin validation bypass vulnerability in Litestar, an Asynchronous Server Gateway Interface (ASGI) framework. Prior to version 2.20.0, the CORSConfig.allowed_origins_regex is constructed using a regex built from configured allowlist values and validated with fullmatch(). Because regex metacharacters are not properly escaped, a malicious origin can unexpectedly match the allowlist pattern, enabling unauthorized cross-origin requests.
Critical Impact
Attackers can bypass CORS protections by crafting malicious origins that exploit unescaped regex metacharacters, potentially leading to unauthorized data exfiltration from affected web applications.
Affected Products
- Litestar ASGI Framework versions prior to 2.20.0
- Applications using CORSConfig.allowed_origins_regex with metacharacter-containing origins
- Web services relying on Litestar's CORS validation for access control
Discovery Timeline
- February 9, 2026 - CVE-2026-25478 published to NVD
- February 9, 2026 - Last updated in NVD database
Technical Details for CVE-2026-25478
Vulnerability Analysis
This vulnerability stems from improper handling of regex metacharacters in the CORS origin validation logic. When developers configure allowed origins in Litestar's CORS middleware, the framework constructs a regular expression pattern from these values without escaping special regex characters. The validation check uses allowed_origins_regex.fullmatch(origin) to determine if an incoming request's origin should be permitted.
Without proper escaping, characters like . (which matches any character in regex), *, +, ?, and others retain their special regex meanings. This allows attackers to craft origin values that satisfy the regex pattern but were never intended to be in the allowlist.
For example, if an application configures example.com as an allowed origin, the unescaped . would match any character, potentially allowing exampleXcom.attacker.com to pass validation.
Root Cause
The root cause is classified as CWE-942 (Permissive Cross-domain Policy with Untrusted Domains). The vulnerability occurs because the Litestar framework fails to escape regex metacharacters when building the allowed_origins_regex pattern from user-configured allowlist values. This results in overly permissive origin matching that can be exploited by malicious domains.
Attack Vector
The attack is network-based and requires user interaction. An attacker can exploit this vulnerability by:
- Identifying a web application using a vulnerable Litestar version with CORS configured
- Analyzing the configured allowed origins to identify exploitable regex patterns
- Registering a malicious domain that matches the unescaped regex pattern
- Hosting malicious content on that domain to make cross-origin requests
- Tricking users into visiting the malicious domain, which then exfiltrates sensitive data from the target application
The vulnerability enables attackers to bypass CORS restrictions, potentially accessing sensitive data that should only be available to explicitly trusted origins. See the GitHub Security Advisory GHSA-2p2x-hpg8-cqp2 for additional technical details.
Detection Methods for CVE-2026-25478
Indicators of Compromise
- Unexpected cross-origin requests from domains similar to but not matching configured allowed origins
- Access logs showing CORS-enabled requests from suspicious or recently registered domains
- Browser console logs indicating successful cross-origin requests from untrusted sources
- Network traffic analysis revealing data exfiltration to domains resembling legitimate allowed origins
Detection Strategies
- Review application logs for cross-origin requests from origins containing characters adjacent to dots in allowed origin configurations
- Implement monitoring for CORS Access-Control-Allow-Origin response headers being set for suspicious origins
- Audit Litestar configuration files for CORSConfig settings with origins containing regex metacharacters
- Deploy web application firewalls (WAF) with rules to detect anomalous origin patterns in requests
Monitoring Recommendations
- Enable verbose logging for CORS middleware to capture all origin validation decisions
- Set up alerts for CORS requests from newly registered domains or domains with unusual character patterns
- Monitor for increased cross-origin traffic volume that could indicate exploitation attempts
- Implement real-time analysis of origin headers against a strict allowlist separate from the framework's validation
How to Mitigate CVE-2026-25478
Immediate Actions Required
- Upgrade Litestar to version 2.20.0 or later immediately
- Audit existing CORS configurations for origins containing regex metacharacters
- Review application logs for any historical evidence of exploitation
- Consider implementing additional origin validation at the application layer as defense-in-depth
Patch Information
The vulnerability is fixed in Litestar version 2.20.0. The fix ensures that regex metacharacters in configured allowed origins are properly escaped before being used in pattern matching. Organizations should update their Litestar installations to this version or later.
For detailed information about the fix, refer to:
Workarounds
- If immediate upgrade is not possible, implement a custom CORS middleware that properly escapes metacharacters before regex compilation
- Use exact string matching for origin validation instead of regex-based matching as a temporary measure
- Deploy a reverse proxy or WAF to perform strict origin validation before requests reach the application
- Restrict CORS to specific, fully-qualified domain names and avoid wildcard or pattern-based configurations
# Upgrade Litestar to patched version
pip install --upgrade litestar>=2.20.0
# Verify installed version
pip show litestar | grep Version
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

