CVE-2021-4118: Pytorch lightning Pytorch-lightning Is Vulnerable To Deserialization Vulnerability
HIGHCVE-2021-4118 is a HIGH (CVSS 7.8) pytorch-lightning is vulnerable to deserialization vulnerability (CWE-502: Deserialization of Untrusted Data) affecting Pytorch lightning libraries in the PyPI ecosystem. The issue involves pytorch-lightning is vulnerable to deserialization of untrusted data. Remediation is available by upgrading affected packages to version 1.6.0.
CVE-2021-4118 at a Glance
Security Impact
CVSS: 7.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H).
How to Fix CVE-2021-4118
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.
pip install pytorch-lightning>=1.6.0
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-2021-4118, 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 1.6.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-502: Deserialization of Untrusted Data, where the product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid. 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
CVE-2021-4118 Affected Pytorch lightning Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
pytorch-lightning
|
PyPI |
< 1.6.0
|
1.6.0
|
References
Frequently Asked Questions
What is CVE-2021-4118?
Which Pytorch lightning versions are affected?
What version fixes CVE-2021-4118?
Is pytorch-lightning affected?
What is the CVSS score of CVE-2021-4118?
What CWE is associated with CVE-2021-4118?
How can I check PyPI dependencies for CVE-2021-4118?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-2vj5-px25-gjrp",
"modified" : "2024-10-25T20:50:29Z",
"published" : "2022-01-06T23:58:59Z",
"aliases" : [ "CVE-2021-4118" ],
"summary" : "pytorch-lightning is vulnerable to Deserialization of Untrusted Data",
"details" : "pytorch-lightning is vulnerable to Deserialization of Untrusted Data.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "pytorch-lightning"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.6.0"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-4118"
}, {
"type" : "WEB",
"url" : "https://github.com/PyTorchLightning/pytorch-lightning/issues/11045"
}, {
"type" : "WEB",
"url" : "https://github.com/PyTorchLightning/pytorch-lightning/pull/11099"
}, {
"type" : "WEB",
"url" : "https://github.com/pytorchlightning/pytorch-lightning/commit/62f1e82e032eb16565e676d39e0db0cac7e34ace"
}, {
"type" : "WEB",
"url" : "https://github.com/PyTorchLightning/pytorch-lightning/releases/tag/1.6.0"
}, {
"type" : "ADVISORY",
"url" : "https://github.com/advisories/GHSA-2vj5-px25-gjrp"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/pytorch-lightning/PYSEC-2021-874.yaml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/pytorchlightning/pytorch-lightning"
}, {
"type" : "WEB",
"url" : "https://huntr.dev/bounties/31832f0c-e5bb-4552-a12c-542f81f111e6"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-502" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2022-01-05T17:49:21Z",
"nvd_published_at" : "2021-12-23T18:15:00Z"
}
}