CVE-2024-8019: Pytorch lightning Path Traversal Vulnerability

CRITICAL
Advisory Identifier: GHSA-4cv3-v7pv-rfhf
CVSS 9.1
CWE-434
Published
Advisory Summary

CVE-2024-8019 is a CRITICAL (CVSS 9.1) path traversal vulnerability (CWE-434: Unrestricted Upload of File with Dangerous Type) affecting Pytorch lightning libraries in the PyPI ecosystem. The issue involves pytorch lightning path traversal vulnerability. Remediation is available by upgrading affected packages to version 2.4.0.

CVE-2024-8019 at a Glance

CVE Identifier CVE-2024-8019
GHSA Identifier GHSA-4cv3-v7pv-rfhf
Severity CRITICAL
CVSS v3.1 Base Score 9.1
CWE Classification CWE-434: Unrestricted Upload of File with Dangerous Type
Affected Product Pytorch lightning
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 9.1

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

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 High (I:H)
Availability High (A:H)

How to Fix CVE-2024-8019

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

pytorch-lightning fixed: 2.4.0
pip install pytorch-lightning>=2.4.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 pytorch-lightning

How to Check if You Are Affected

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

pip show pytorch-lightning

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-434: Unrestricted Upload of File with Dangerous Type, where the product allows the upload or transfer of dangerous file types that are automatically processed within its environment. In Pytorch lightning, 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

In lightning-ai/pytorch-lightning version 2.3.2, a vulnerability exists in the `LightningApp` when running on a Windows host. The vulnerability occurs at the `/api/v1/upload_file/` endpoint, allowing an attacker to write or overwrite arbitrary files by providing a crafted filename. This can lead to potential remote code execution (RCE) by overwriting critical files or placing malicious files in sensitive locations.

CVE-2024-8019 Affected Pytorch lightning Versions

1 component(s)
Fixed Versions:
2.4.0
Product / Package Ecosystem Affected Versions Fixed Version
pytorch-lightning
PyPI
< 2.4.0
2.4.0

References

Frequently Asked Questions

What is CVE-2024-8019?
CVE-2024-8019 is a security vulnerability in Pytorch lightning involving PyTorch Lightning path traversal vulnerability under CWE-434: Unrestricted Upload of File with Dangerous Type.
Which Pytorch lightning versions are affected?
Affected versions include releases prior to 2.4.0 across affected packages: pytorch-lightning.
What version fixes CVE-2024-8019?
Upgrading to 2.4.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is pytorch-lightning affected?
Yes, pytorch-lightning is affected in releases prior to 2.4.0. Upgrade your dependency to 2.4.0 or later.
What is the CVSS score of CVE-2024-8019?
CVE-2024-8019 has a CVSS v3.1 base score of 9.1 (CRITICAL) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H.
What CWE is associated with CVE-2024-8019?
CVE-2024-8019 is classified under CWE-434: Unrestricted Upload of File with Dangerous Type (The product allows the upload or transfer of dangerous file types that are automatically processed within its environment.).
How can I check PyPI dependencies for CVE-2024-8019?
Run the dependency tree command: 'pip show pytorch-lightning'. 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-4cv3-v7pv-rfhf",
  "modified" : "2025-03-21T21:56:03Z",
  "published" : "2025-03-20T12:32:46Z",
  "aliases" : [ "CVE-2024-8019" ],
  "summary" : "PyTorch Lightning path traversal vulnerability",
  "details" : "In lightning-ai/pytorch-lightning version 2.3.2, a vulnerability exists in the `LightningApp` when running on a Windows host. The vulnerability occurs at the `/api/v1/upload_file/` endpoint, allowing an attacker to write or overwrite arbitrary files by providing a crafted filename. This can lead to potential remote code execution (RCE) by overwriting critical files or placing malicious files in sensitive locations.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "pytorch-lightning"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.4.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-8019"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/lightning-ai/pytorch-lightning/commit/330af381de88cff17515418a341cbc1f9f127f9a"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/pytorch/pytorch"
  }, {
    "type" : "WEB",
    "url" : "https://huntr.com/bounties/2754298b-5af5-48ef-8b38-999093ddf2bd"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-434" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-03-21T21:56:03Z",
    "nvd_published_at" : "2025-03-20T10:15:39Z"
  }
}