# CVE-2026-48060: Litestar XSS via CSRF token injection in templates

Source: https://junglewise.ai/threats/cve-2026-48060-litestar-xss-via-csrf-token-injection-in-templates  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-07-28. Updated: 2026-07-28  
License: CC BY 4.0 with a link back

CVE-2026-48060 · Severity: high · CVSS 8.1 · Published 2026-07-28

Litestar is a web framework used to build high-performance Python applications. A security flaw in how it handles Cross-Site Request Forgery (CSRF) protection allows attackers to inject malicious code into web pages viewed by users. If exploited, this could lead to unauthorized access to user accounts, theft of sensitive session data, or the defacement of the website.

Technologies: [litestar (PyPI)](https://junglewise.ai/threats/technologies/litestar). Vendors: [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is CVE-2026-48060 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-48060 being exploited in the wild.

**How severe is CVE-2026-48060?** High severity, with a CVSS score of 8.1, published 28 July 2026.

**Which products and versions are affected?** litestar (PyPI) < 2.22.0, ECOSYSTEM:introduced=0,fixed=2.22.0.

**Is there a fix for CVE-2026-48060?** Yes. litestar (PyPI): upgrade to 2.22.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-48060 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-48060?** Check whether you run litestar (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- litestar (PyPI): upgrade to 2.22.0 or later

  ```sh
  pip install "litestar>=2.22.0"
  ```


## Technical details

A Cross-Site Scripting (XSS) vulnerability exists in Litestar when using a template engine (such as Jinja2, Mako, or MiniJinja) alongside CSRF protection. The root cause is that the `csrf_input` variable, which contains the CSRF token from a cookie, is marked as 'safe' or otherwise excluded from automatic HTML escaping when following standard documentation examples. An attacker can poison the `csrftoken` cookie with malicious HTML or JavaScript. If a victim visits a site on the same top-level domain that sets this cookie and is then redirected to the vulnerable Litestar application, the payload will execute in the victim's browser context. This allows for session hijacking or arbitrary actions on behalf of the user. The vulnerability is addressed in version 2.20.0.

## Affected products

- litestar-org Litestar < 2.20.0

## Identifiers

- CVE-2026-48060
- GHSA-542p-wvx7-72m4
- PYSEC-2026-2604

## Timeline

- 2026-05-20: advisory: GitHub Security Advisory GHSA-542p-wvx7-72m4 published
- 2026-07-28: disclosed: CVE-2026-48060 published to NVD
- 2026-02-08: patched: Version 2.20.0 released

## References

- [https://github.com/litestar-org/litestar/releases/tag/v2.20.0](https://github.com/litestar-org/litestar/releases/tag/v2.20.0)
- [https://github.com/litestar-org/litestar/security/advisories/GHSA-542p-wvx7-72m4](https://github.com/litestar-org/litestar/security/advisories/GHSA-542p-wvx7-72m4)

## Related threats

- [Litestar AllowedHostsMiddleware host validation bypass](https://junglewise.ai/threats/cve-2026-48061-litestar-allowedhostsmiddleware-host-validation-bypass)
- [PYSEC-2026-2605 - Litestar and Starlite vulnerable to Path Traversal](https://junglewise.ai/threats/cve-2024-32982-litestar-and-starlite-vulnerable-to-path-traversal)
- [PYSEC-2026-1553 - Litestar X-Forwarded-For Header Spoofing Vulnerability Enables Rate Limit Evasion](https://junglewise.ai/threats/cve-2025-59152-litestar-x-forwarded-for-header-spoofing-vulnerability-enables)
- [PYSEC-2026-1944 - Litestar allows unbounded resource consumption (DoS vulnerability)](https://junglewise.ai/threats/cve-2024-52581-litestar-allows-unbounded-resource-consumption-dos-vulnerability)
- [Litestar's FileStore key canonicalization collisions allow response cache mixup/poisoning (ASCII ord + Unicode NFKD)](https://junglewise.ai/threats/cve-2026-25480-litestar-s-filestore-key-canonicalization-collisions-allow)
