GHSA-674p-xv2x-rf3g: Litestar Litestar Has Potential Log Injection Vulnerability

LOW
CVSS 3.7
CWE-117
Published
Advisory Summary

GHSA-674p-xv2x-rf3g is a LOW (CVSS 3.7) litestar has potential log injection vulnerability (CWE-117: Improper Output Neutralization for Logs) affecting Litestar libraries in the PyPI ecosystem. The issue involves litestar has potential log injection in exception logging. Remediation is available by upgrading affected packages to version 2.17.0.

GHSA-674p-xv2x-rf3g at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-674p-xv2x-rf3g
Severity LOW
CVSS v3.1 Base Score 3.7
CWE Classification CWE-117: Improper Output Neutralization for Logs
Affected Product Litestar
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 3.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity Low (I:L)
Availability None (A:N)

How to Fix GHSA-674p-xv2x-rf3g

To remediate this vulnerability, upgrade all affected Litestar dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

litestar fixed: 2.17.0
pip install litestar>=2.17.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show litestar

How to Check if You Are Affected

To determine whether your Python environment is affected by GHSA-674p-xv2x-rf3g, inspect your installed packages using pip:

pip show litestar

Analyze the terminal output to locate any version of Litestar in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.17.0), your application is affected.

Note: The pip show litestar command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-117: Improper Output Neutralization for Logs, where the product constructs a log message from external input, but it does not neutralize or incorrectly neutralizes special elements when the message is written to a log file. In Litestar, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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.

GHSA-674p-xv2x-rf3g Affected Litestar Versions

1 component(s)
Fixed Versions:
2.17.0
Product / Package Ecosystem Affected Versions Fixed Version
litestar
PyPI
< 2.17.0
2.17.0

References

Frequently Asked Questions

What is GHSA-674p-xv2x-rf3g?
GHSA-674p-xv2x-rf3g is a security vulnerability in Litestar involving Litestar has potential log injection in exception logging under CWE-117: Improper Output Neutralization for Logs.
Which Litestar versions are affected?
Affected versions include releases prior to 2.17.0 across affected packages: litestar.
What version fixes GHSA-674p-xv2x-rf3g?
Upgrading to 2.17.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is litestar affected?
Yes, litestar is affected in releases prior to 2.17.0. Upgrade your dependency to 2.17.0 or later.
What is the CVSS score of GHSA-674p-xv2x-rf3g?
GHSA-674p-xv2x-rf3g has a CVSS v3.1 base score of 3.7 (LOW) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N.
What CWE is associated with GHSA-674p-xv2x-rf3g?
GHSA-674p-xv2x-rf3g is classified under CWE-117: Improper Output Neutralization for Logs (The product constructs a log message from external input, but it does not neutralize or incorrectly neutralizes special elements when the message is written to a log file.).
How can I check PyPI dependencies for GHSA-674p-xv2x-rf3g?
Run the dependency tree command: 'pip show litestar'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-674p-xv2x-rf3g",
  "modified" : "2025-08-11T23:07:36Z",
  "published" : "2025-08-11T23:07:36Z",
  "aliases" : [ ],
  "summary" : "Litestar has potential log injection in exception logging",
  "details" : "### Summary\n\nLitestar 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.\n\n### Details\n\nLitestar directly formats unquoted path into exception logs without validation or escaping when using default exception logging handler.\n\nhttps://github.com/litestar-org/litestar/blob/1e0dc7c4d67151c836208a3e360051e983b5083a/litestar/logging/config.py#L145-L150\n\nAttackers can inject newlines in logs by embedding`%0d%0a` in url path.\n\n`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.\n\n### PoC\n\n```\ncurl \"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\"\n```\n\nlogging:\n\n```\n2025-07-15 00:00:00 - litestar - ERROR - Uncaught exception (connection_type=http, path=/)\nINFO:     127.0.0.1:8192 - \"POST /login HTTP/1.1\" 200 OK\n...\n```\n\nIf 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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "litestar"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.17.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.16.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/litestar-org/litestar/security/advisories/GHSA-674p-xv2x-rf3g"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/litestar-org/litestar/commit/03b5813d4f448dd710af9ba6252d798cb9fc087f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/litestar-org/litestar"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-117" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-08-11T23:07:36Z",
    "nvd_published_at" : null
  }
}