CVE-2024-21645: Pyload ng Pyload Log Injection Vulnerability Vulnerability

MODERATE
Advisory Identifier: GHSA-ghmw-rwh8-6qmr
CVSS 5.3
CWE-74
Published
Advisory Summary

CVE-2024-21645 is a MODERATE (CVSS 5.3) pyload log injection vulnerability vulnerability (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')) affecting Pyload ng libraries in the PyPI ecosystem. The issue involves pyload log injection vulnerability. Remediation is available by upgrading affected packages to version 0.5.0b3.dev77.

CVE-2024-21645 at a Glance

CVE Identifier CVE-2024-21645
GHSA Identifier GHSA-ghmw-rwh8-6qmr
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
Affected Product Pyload ng
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.3

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

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
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 CVE-2024-21645

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

pyload-ng fixed: 0.5.0b3.dev77
pip install pyload-ng>=0.5.0b3.dev77
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 pyload-ng

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2024-21645, inspect your installed packages using pip:

pip show pyload-ng

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection'), where the product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. In Pyload ng, 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 A log injection vulnerability was identified in `pyload`. This vulnerability allows any unauthenticated actor to inject arbitrary messages into the logs gathered by `pyload`. ### Details `pyload` will generate a log entry when attempting to sign in with faulty credentials. This entry will be in the form of `Login failed for user 'USERNAME'`. However, when supplied with a username containing a newline, this newline is not properly escaped. Newlines are also the delimiter between log entries. This allows the attacker to inject new log entries into the log file. ### PoC Run `pyload` in the default configuration by running the following command ``` pyload ``` We can now sign in as the pyload user and view the logs at `http://localhost:8000/logs`. ![Viewing the logs](https://user-images.githubusercontent.com/44903767/294433796-f2c96e39-8000-4649-99bb-9c50e786243d.png) Any unauthenticated attacker can now make the following request to inject arbitrary logs. ``` curl 'http://localhost:8000/login?next=http://localhost:8000/' -X POST -H 'Content-Type: application/x-www-form-urlencoded' --data-raw $'do=login&username=wrong\'%0a[2024-01-05 02:49:19] HACKER PinkDraconian THIS ENTRY HAS BEEN INJECTED&password=wrong&submit=Login' ``` If we now were to look at the logs again, we see that the entry has successfully been injected. ![PoC2](https://user-images.githubusercontent.com/44903767/294434785-2fc6dce4-3e2c-4da0-8e80-a6bba882f756.png) ### Impact Forged or otherwise, corrupted log files can be used to cover an attacker’s tracks or even to implicate another party in the commission of a malicious act.

CVE-2024-21645 Affected Pyload ng Versions

1 component(s)
Fixed Versions:
0.5.0b3.dev77
Product / Package Ecosystem Affected Versions Fixed Version
pyload-ng
PyPI
< 0.5.0b3.dev77
0.5.0b3.dev77

References

Frequently Asked Questions

What is CVE-2024-21645?
CVE-2024-21645 is a security vulnerability in Pyload ng involving pyload Log Injection vulnerability under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection').
Which Pyload ng versions are affected?
Affected versions include releases prior to 0.5.0b3.dev77 across affected packages: pyload-ng.
What version fixes CVE-2024-21645?
Upgrading to 0.5.0b3.dev77 (or the latest patched release for your respective branch) resolves the vulnerability.
Is pyload-ng affected?
Yes, pyload-ng is affected in releases prior to 0.5.0b3.dev77. Upgrade your dependency to 0.5.0b3.dev77 or later.
What is the CVSS score of CVE-2024-21645?
CVE-2024-21645 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N.
What CWE is associated with CVE-2024-21645?
CVE-2024-21645 is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') (The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.).
How can I check PyPI dependencies for CVE-2024-21645?
Run the dependency tree command: 'pip show pyload-ng'. 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-ghmw-rwh8-6qmr",
  "modified" : "2024-01-08T15:55:22Z",
  "published" : "2024-01-08T15:29:55Z",
  "aliases" : [ "CVE-2024-21645" ],
  "summary" : "pyload Log Injection vulnerability",
  "details" : "### Summary\nA log injection vulnerability was identified in `pyload`. This vulnerability allows any unauthenticated actor to inject arbitrary messages into the logs gathered by `pyload`.\n\n### Details\n`pyload` will generate a log entry when attempting to sign in with faulty credentials. This entry will be in the form of `Login failed for user 'USERNAME'`. However, when supplied with a username containing a newline, this newline is not properly escaped. Newlines are also the delimiter between log entries. This allows the attacker to inject new log entries into the log file.\n\n### PoC\nRun `pyload` in the default configuration by running the following command\n```\npyload\n```\n\nWe can now sign in as the pyload user and view the logs at `http://localhost:8000/logs`.\n![Viewing the logs](https://user-images.githubusercontent.com/44903767/294433796-f2c96e39-8000-4649-99bb-9c50e786243d.png)\n\nAny unauthenticated attacker can now make the following request to inject arbitrary logs.\n\n```\ncurl 'http://localhost:8000/login?next=http://localhost:8000/' -X POST -H 'Content-Type: application/x-www-form-urlencoded' --data-raw $'do=login&username=wrong\\'%0a[2024-01-05 02:49:19]  HACKER               PinkDraconian  THIS ENTRY HAS BEEN INJECTED&password=wrong&submit=Login'\n```\n\nIf we now were to look at the logs again, we see that the entry has successfully been injected.\n![PoC2](https://user-images.githubusercontent.com/44903767/294434785-2fc6dce4-3e2c-4da0-8e80-a6bba882f756.png)\n\n### Impact\nForged or otherwise, corrupted log files can be used to cover an attacker’s tracks or even to implicate another party in the commission of a malicious act.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "pyload-ng"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.5.0b3.dev77"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/pyload/pyload/security/advisories/GHSA-ghmw-rwh8-6qmr"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-21645"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pyload/pyload/commit/4159a1191ec4fe6d927e57a9c4bb8f54e16c381d"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/pyload/pyload"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-74" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-01-08T15:29:55Z",
    "nvd_published_at" : "2024-01-08T14:15:47Z"
  }
}