CVE-2021-4118 (published 2021-12-23T18:15Z)

pytorch-lightning is vulnerable to Deserialization of Untrusted Data

Severity: MEDIUM
CVSS v2 base score: 6.8 (AV:N/AC:M/Au:N/C:P/I:P/A:P)
CVSS v3 base score: 7.8, HIGH (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-502
cwe_name: Deserialization of Untrusted Data
description: The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
extended_description: 
            It is often convenient to serialize objects for communication or to save them for later use. However, deserialized data or code can often be modified without using the provided accessor functions if it does not use cryptography to protect itself. Furthermore, any cryptography would still be client-side security -- which is a dangerous security assumption.
            Data that is untrusted can not be trusted to be well-formed.
            When developers place no restrictions on "gadget chains," or series of instances and method invocations that can self-execute during the deserialization process (i.e., before the object is returned to the caller), it is sometimes possible for attackers to leverage them to perform unauthorized actions, like generating a shell.
         
         

Fix information:
repo_url: https://github.com/pytorchlightning/pytorch-lightning
commit_details: repo_url: https://github.com/pytorchlightning/pytorch-lightning
author: Carlos Mocholí
author_date: 2021-12-17 21:27:15+01:00
msg: Fix CVE-2020-1747 and CVE-2020-14343 (#11099)
repository: repo_url: https://github.com/pytorchlightning/pytorch-lightning
repo_name: Lightning-AI/pytorch-lightning
description: Pretrain, finetune and deploy AI models on multiple GPUs, TPUs with zero code changes.
repo_language: Python
owner: pytorchlightning
file_changes: filename: CHANGELOG.md
change_type: ModificationType.MODIFY
diff: @@ -293,10 +293,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
 
 ### Fixed
 
-- Fixed a bug to disable logging hyperparameters in logger if there are no hparams ([#11105](https://github.com/PyTorchLightning/pytorch-lightning/issues/11105))
+- Fixed security vulnerabilities CVE-2020-1747 and CVE-2020-14343 caused by the `PyYAML` dependency ([#11099](https://github.com/PyTorchLightning/pytorch-lightning/pull/11099))
 
 
--
+- Fixed a bug to disable logging hyperparameters in logger if there are no hparams ([#11105](https://github.com/PyTorchLightning/pytorch-lightning/issues/11105))
 
 
 - Avoid the deprecated `onnx.export(example_outputs=...)` in torch 1.10 ([#11116](https://github.com/PyTorchLightning/pytorch-lightning/pull/11116))

programming_language: Markdown
filename: saving.py
change_type: ModificationType.MODIFY
diff: @@ -344,7 +344,7 @@ def load_hparams_from_yaml(config_yaml: str, use_omegaconf: bool = True) -> Dict
         return {}
 
     with fs.open(config_yaml, "r") as fp:
-        hparams = yaml.load(fp, Loader=yaml.UnsafeLoader)
+        hparams = yaml.full_load(fp)
 
     if _OMEGACONF_AVAILABLE:
         if use_omegaconf:

programming_language: Python
filename: requirements.txt
change_type: ModificationType.MODIFY
diff: @@ -4,7 +4,7 @@ numpy>=1.17.2
 torch>=1.7.*
 future>=0.17.1  # required for builtins in setup.py
 tqdm>=4.41.0
-PyYAML>=5.1
+PyYAML>=5.4
 fsspec[http]>=2021.05.0, !=2021.06.0
 tensorboard>=2.2.0
 torchmetrics>=0.4.1

programming_language: Batchfile
filename: test_csv.py
change_type: ModificationType.MODIFY
diff: @@ -12,7 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 import os
-from argparse import Namespace
 from unittest.mock import MagicMock
 
 import pytest
@@ -95,7 +94,6 @@ def test_file_logger_log_hyperparams(tmpdir):
         "bool": True,
         "dict": {"a": {"b": "c"}},
         "list": [1, 2, 3],
-        "namespace": Namespace(foo=Namespace(bar="buzz")),
         "layer": torch.nn.BatchNorm1d,
     }
     logger.log_hyperparams(hparams)

programming_language: Python