Low

Litestar has potential log injection in exception logging

  • Disclosed: 11.08.2025
  • Updated: 11.10.2026 12:19

Summary

Litestar does not escape url paths when logging exceptions. This makes logger vulnerable to CRLF injection if logging level is configured to debug or log_exceptions is set to "always", which allows attackers to inject newlines and forge log entries.

Details

Litestar directly formats unquoted path into exception logs without validation or escaping when using default exception logging handler.

https://github.com/litestar-org/litestar/blob/1e0dc7c4d67151c836208a3e360051e983b5083a/litestar/logging/config.py#L145-L150

Attackers can inject newlines in logs by embedding%0d%0a in url path.

log_exceptions="always" is not enabled by default. However, it is set in the examples of documentation (https://github.com/litestar-org/litestar/blob/1e0dc7c4d67151c836208a3e360051e983b5083a/docs/usage/logging.rst#logging). User will be impacted if they directly copy the logging config from docs.

PoC

bash
curl "http://172.17.0.2:8000/%29%0D%0AINFO:%20%20%20%20%20127.0.0.1:8192%20-%20%22POST%20/login%20HTTP/1.1%22%20200%20OK%0D%0A%28"

logging:

2025-07-15 00:00:00 - litestar - ERROR - Uncaught exception (connection_type=http, path=/)
INFO:     127.0.0.1:8192 - "POST /login HTTP/1.1" 200 OK
...

If stacktracks for 404 are configured to be ignored (disable_stack_trace={404},), attacker may also exploit this by sending malformed requests to cause 400/500 exceptions and avoid 404 in endpoints with str path parameters.

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
Python (PyPI) litestar < 2.17.0 2.17.0

References

CVSS score 3.7/10
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N
Weakness (CWE)
CWE-117
Platform
Python (PyPI)
Package
litestar
Disclosed
11.08.2025
Updated
11.10.2026 12:19

Sources and licenses

OSV / GitHub Advisory Database - GHSA-674p-xv2x-rf3g - CC BY 4.0

Vulnerability history: litestar

All published vulnerabilities of this package (Python (PyPI)), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (9) in the archive
Total entries
9
First → latest
05.2024 06.2026
Without a fix
0
Exploited in attacks
0

Severity breakdown

  • High 5
  • Medium 3
  • Low 1

Disclosures per year

  1. 2024: 2
  2. 2025: 2
  3. 2026: 5
Severity:
  1. High · 8.1 CVE-2026-48060 < 2.22.0 2.22.0
  2. High · 7.5 CVE-2025-59152 >= 2.17.0, < 2.18.0 2.18.0
  3. Litestar has potential log injection in exception logging this entry
    Low · 3.7 ghsa-674p-xv2x-rf3g < 2.17.0 2.17.0
  4. High · 7.5 CVE-2024-52581 < 2.13.0 2.13.0
  5. High · 8.2 CVE-2024-32982 >= 2.8.0, < 2.8.3, >= 2.7.0, < 2.7.2, >= 2.0.0, < 2.6.4 2.8.3, 2.7.2, 2.6.4

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.