CVE-2026-48060
Litestar: HTML Injection Through CSRF Token
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.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- Required
What an attacker can affect
- Confidentiality
- High
- Integrity
- High
- Availability
- None
Exploit likelihood
What each source reports
CVE List Score used
8.1
Litestar: HTML Injection Through CSRF Token
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.
- Record
CVE-2026-48060- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
EUVDEUVD-2026-49994
8.1
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.
- Record
EUVD-2026-49994- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-542p-wvx7-72m4
8.1
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
- Visit an application which contains a form, uses templating, has CSRF protection enabled, and which inserts the CSRF token as a hidden
inputfield on forms. A proof of concept application demonstrating this configuration is included later in this disclosure for ease of reproduction. - Observe that the server sets the
csrftokencookie when the page loads.
<img width="1152" height="372" alt="litestar_csrf_cookie_in_browser_dev_tools" src="https://github.com/user-attachments/assets/252a5746-0f5f-4c78-9b9c-3ff4fb98e942" />
- Set the value of the
csrftokencookie to"><h1>HTML Injection Test</h1>.
<img width="1142" height="426" alt="litestar_csrf_cookie_poisoned_with_html" src="https://github.com/user-attachments/assets/131e5015-e718-4539-8d03-969e81a34fdc" />
- Refresh the page.
- Observe that the contents of the cookie is rendered on the page.
<img width="1152" height="480" alt="litestar_successful_html_injection" src="https://github.com/user-attachments/assets/c997f679-7111-4620-a28d-25eabea34ca2" />
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:
# 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
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>
<body>
<div>
<form method="post">
{{ csrf_input | safe }}
<label for="fname">Username:</label><br>
<input type="text"…
- Record
GHSA-542p-wvx7-72m4- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
NVD
8.1
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.
- Record
CVE-2026-48060- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
OSV
8.1
Litestar: HTML Injection Through CSRF Token
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.
- Record
CVE-2026-48060- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
OSVGHSA-542p-wvx7-72m4
8.1
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
- Visit an application which contains a form, uses templating, has CSRF protection enabled, and which inserts the CSRF token as a hidden
inputfield on forms. A proof of concept application demonstrating this configuration is included later in this disclosure for ease of reproduction. - Observe that the server sets the
csrftokencookie when the page loads.
<img width="1152" height="372" alt="litestar_csrf_cookie_in_browser_dev_tools" src="https://github.com/user-attachments/assets/252a5746-0f5f-4c78-9b9c-3ff4fb98e942" />
- Set the value of the
csrftokencookie to"><h1>HTML Injection Test</h1>.
<img width="1142" height="426" alt="litestar_csrf_cookie_poisoned_with_html" src="https://github.com/user-attachments/assets/131e5015-e718-4539-8d03-969e81a34fdc" />
- Refresh the page.
- Observe that the contents of the cookie is rendered on the page.
<img width="1152" height="480" alt="litestar_successful_html_injection" src="https://github.com/user-attachments/assets/c997f679-7111-4620-a28d-25eabea34ca2" />
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:
# 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
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>
<body>
<div>
<form method="post">
{{ csrf_input | safe }}
<label for="fname">Username:</label><br>
<input type="text"…
- Record
GHSA-542p-wvx7-72m4- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
OSVPYSEC-2026-2604
8.1
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
- Visit an application which contains a form, uses templating, has CSRF protection enabled, and which inserts the CSRF token as a hidden
inputfield on forms. A proof of concept application demonstrating this configuration is included later in this disclosure for ease of reproduction. - Observe that the server sets the
csrftokencookie when the page loads.
<img width="1152" height="372" alt="litestar_csrf_cookie_in_browser_dev_tools" src="https://github.com/user-attachments/assets/252a5746-0f5f-4c78-9b9c-3ff4fb98e942" />
- Set the value of the
csrftokencookie to"><h1>HTML Injection Test</h1>.
<img width="1142" height="426" alt="litestar_csrf_cookie_poisoned_with_html" src="https://github.com/user-attachments/assets/131e5015-e718-4539-8d03-969e81a34fdc" />
- Refresh the page.
- Observe that the contents of the cookie is rendered on the page.
<img width="1152" height="480" alt="litestar_successful_html_injection" src="https://github.com/user-attachments/assets/c997f679-7111-4620-a28d-25eabea34ca2" />
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:
# 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
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>
<body>
<div>
<form method="post">
{{ csrf_input | safe }}
<label for="fname">Username:</label><br>
<input type="text"…
- Record
PYSEC-2026-2604- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N - Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
litestarPyPI |
before 2.22.0 | 2.22.0 |
litestarPyPI |
before 2.22.0, plus listed versions 1.0.0a02.0.02.0.0a32.0.0a42.0.0a5 Show 45 moreShow less2.0.0a62.0.0a72.0.0b12.0.0b22.0.0b32.0.0b42.0.0rc12.0.12.1.02.1.12.10.02.11.02.12.02.12.12.13.02.14.02.15.02.15.12.15.22.16.02.17.02.18.02.19.02.2.02.2.12.20.02.21.02.21.12.3.02.3.12.3.22.4.02.4.12.4.22.4.32.4.42.4.52.5.02.5.12.5.22.5.32.5.42.5.52.6.02.6.1 |
2.22.0 |
Public exploits
Links only. Every CVE stores no exploit code.
| Source | Link | Date |
|---|---|---|
| PoC in GitHub | Blinky-Keys/CVE-2026-48060 | 2026-05-19 |
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV, PoC in GitHub |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2026-48060 is a high vulnerability (CVSS 8.1) in Litestar-org Litestar, published June 10, 2026. Public exploit code exists. EPSS puts the chance of exploitation in the next 30 days at 0.35%, the 29th percentile. Fixed in litestar 2.22.0.
References
github.com/litestar-org/litestar/security/advisories/GHSA-542p-wvx7-72m4
github.com/litestar-org/litestar/releases/tag/v2.20.0
docs.litestar.dev/2/release-notes/changelog.html
github.com/advisories/GHSA-542p-wvx7-72m4
github.com/CVEProject/cvelistV5/tree/main/cves/2026/48xxx/CVE-2026-48060.json
nvd.nist.gov/vuln/detail/CVE-2026-48060
github.com/litestar-org/litestar
pypi.org/project/litestar
Left out here: 12 versions and the rest of 3 source descriptions. The JSON record has them.