Description
Litestar is an Asynchronous Server Gateway Interface (ASGI) framework. Prior to version 2.20.0, Litestar instances which use a template engine in conjunction with CSRF protection are vulnerable to HTML Injection which can be escalated to Cross Site Scripting due to the contents of the CSRF cookie being excluded from automatic escaping by the template engine when configured inline with documentation recommendations. This issue has been patched in version 2.20.0.
Published: 2026-07-28
Score: 8.1 High
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

Litestar is an asynchronous server gateway interface framework that allows developers to build event‑driven web applications. Versions earlier than 2.20.0 are affected when a template engine is combined with CSRF protection. In these configurations, the value of the CSRF cookie is inserted into rendered templates without the template engine applying the usual escaping rules, creating an HTML injection flaw that can be promoted to cross‑site scripting; untrusted cookie content can generate arbitrary script or markup within the user’s browser. When an attacker can influence the CSRF cookie value—typically by compromising the victim’s browser context—this flaw enables attackers to execute scripts in the victim’s context, leading to data leakage, session hijacking, or other exploitation outcomes.

Affected Systems

The affected product is the Litestar ASGI framework from litestar‑org. Versions prior to 2.20.0 are vulnerable, where the combination of a template engine and CSRF protection is enabled per official configuration guidance. No other vendors or products are listed as affected.

Risk and Exploitability

The CVSS score of 8.1 marks this as a major vulnerability, while an EPSS score of less than 1% indicates a very low current exploitation probability. The flaw is not catalogued in the CISA KEV list. Because the flaw is triggered by user‑controllable content placed in a CSRF cookie, the attack vector likely requires the attacker to set a malicious CSRF cookie for the victim, which can be achieved only if the attacker can influence the victim’s browser context—such as via a separate XSS or phishing vector. When enabled, the malicious payload is rendered by the client’s browser, exposing the user to potential data theft or session compromise.

Generated by OpenCVE AI on August 4, 2026 at 12:50 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade Litestar to version 2.20.0 or newer, which contains the patch that ensures CSRF cookie values are properly escaped before template rendering.
  • If upgrading immediately is not feasible, review the template configuration and apply manual escaping to the CSRF cookie value when it is included in templates.
  • Temporarily disable automatic inclusion of the CSRF cookie value in any inline template rendering until a patched version is deployed.

Generated by OpenCVE AI on August 4, 2026 at 12:50 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-542p-wvx7-72m4 Litestar has HTML Injection Through its CSRF Token
History

Tue, 28 Jul 2026 20:45:00 +0000

Type Values Removed Values Added
First Time appeared Litestar-org
Litestar-org litestar
Vendors & Products Litestar-org
Litestar-org litestar

Tue, 28 Jul 2026 20:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}


Tue, 28 Jul 2026 19:30:00 +0000

Type Values Removed Values Added
Description Litestar is an Asynchronous Server Gateway Interface (ASGI) framework. Prior to version 2.20.0, Litestar instances which use a template engine in conjunction with CSRF protection are vulnerable to HTML Injection which can be escalated to Cross Site Scripting due to the contents of the CSRF cookie being excluded from automatic escaping by the template engine when configured inline with documentation recommendations. This issue has been patched in version 2.20.0.
Title Litestar: HTML Injection Through CSRF Token
Weaknesses CWE-79
References
Metrics cvssV3_1

{'score': 8.1, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N'}


Subscriptions

Litestar-org Litestar
cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-07-28T19:39:13.421Z

Reserved: 2026-05-20T18:25:25.707Z

Link: CVE-2026-48060

cve-icon Vulnrichment

Updated: 2026-07-28T19:39:10.209Z

cve-icon NVD

Status : Deferred

Published: 2026-07-28T20:17:25.760

Modified: 2026-07-30T20:02:12.943

Link: CVE-2026-48060

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-08-04T13:00:11Z

Weaknesses
  • CWE-79

    Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')