GHSA-674p-xv2x-rf3g: Litestar has potential log injection in exception logging
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 logexceptions 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.
Published Aug 11, 2025
Affected packages
litestar
- Ecosystem
- PyPI
- Affected
- <= 2.16.0
- Fixed in
- 2.17.0
- Check
pip show litestar
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
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
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.
Credited to Cycloctane.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More PyPI vulnerabilities
All PyPI entriesCVE-2026-48060
Litestar has HTML Injection Through its CSRF Token
high8.1Jun 10, 2026CVE-2026-48061
Litestar: AllowedHostsMiddleware bypasses host validation via client-controlled X-Forwarded-Host header
medium5.9Jun 10, 2026CVE-2026-25478
Litestar's CORS origin allowlist has a bypass due to unescaped regex metacharacters in allowed origins
high7.4Feb 9, 2026CVE-2026-25479
Litestar's AllowedHosts has a validation bypass due to unescaped regex metacharacters in configured host patterns
medium6.5Feb 9, 2026CVE-2026-25480
Litestar's FileStore key canonicalization collisions allow response cache mixup/poisoning (ASCII ord + Unicode NFKD)
medium6.5Feb 9, 2026CVE-2025-59152
Litestar X-Forwarded-For Header Spoofing Vulnerability Enables Rate Limit Evasion
high7.5Oct 6, 2025
