CVE-2021-39207 (published 2021-09-10T23:15Z)

parlai is a framework for training and evaluating AI models on a variety of openly available dialogue datasets. In affected versions the package is vulnerable to YAML deserialization attack caused by unsafe loading which leads to Arbitary code execution. This security bug is patched by avoiding unsafe loader users should update to version above v1.1.0. If upgrading is not possible then users can change the Loader used to SafeLoader as a workaround. See commit 507d066ef432ea27d3e201da08009872a2f37725 for details.

Severity: MEDIUM
CVSS v2 base score: 6.5 (AV:N/AC:L/Au:S/C:P/I:P/A:P)
CVSS v3 base score: 8.8, HIGH (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/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/facebookresearch/ParlAI
commit_details: repo_url: https://github.com/facebookresearch/ParlAI
author: huntr.dev | the place to protect open source
author_date: 2021-01-26 21:06:01+00:00
msg: RCE Fixed (#3402)

Co-authored-by: Anon-Artist <61599526+Anon-Artist@users.noreply.github.com>
Co-authored-by: Jamie Slome <jamie@418sec.com>
repository: repo_url: https://github.com/facebookresearch/ParlAI
repo_name: facebookresearch/ParlAI
description: A framework for training and evaluating AI models on a variety of openly available dialogue datasets.
repo_language: Python
owner: facebookresearch
file_changes: filename: config.py
change_type: ModificationType.MODIFY
diff: @@ -36,7 +36,7 @@ def parse_configuration_file(config_path):
     result = {}
     result["configs"] = {}
     with open(config_path) as f:
-        cfg = yaml.load(f.read(), Loader=yaml.FullLoader)
+        cfg = yaml.load(f.read(), Loader=yaml.SafeLoader)
         # get world path
         result["world_path"] = cfg.get("world_module")
         if not result["world_path"]:

programming_language: Python
repo_url: https://github.com/facebookresearch/ParlAI
commit_details: repo_url: https://github.com/facebookresearch/ParlAI
author: Abhiram V
author_date: 2021-02-03 17:52:21+00:00
msg: Update model_chat_blueprint.py (#3429)
repository: repo_url: https://github.com/facebookresearch/ParlAI
repo_name: facebookresearch/ParlAI
description: A framework for training and evaluating AI models on a variety of openly available dialogue datasets.
repo_language: Python
owner: facebookresearch
file_changes: filename: model_chat_blueprint.py
change_type: ModificationType.MODIFY
diff: @@ -453,7 +453,7 @@ class ModelChatBlueprint(BaseModelChatBlueprint):
 
     def _get_shared_models(self, args: "DictConfig") -> Dict[str, dict]:
         with open(args.blueprint.model_opt_path) as f:
-            all_model_opts = yaml.load(f.read())
+            all_model_opts = yaml.safe_load(f.read())
         active_model_opts = {
             model: opt
             for model, opt in all_model_opts.items()
@@ -557,5 +557,5 @@ class ModelImageChatBlueprint(BaseModelChatBlueprint):
 
     def _get_shared_models(self, args: "DictConfig") -> Dict[str, dict]:
         with open(args.blueprint.model_opt_path) as f:
-            model_opts = yaml.load(f.read())
+            model_opts = yaml.safe_load(f.read())
         return TurkLikeAgent.get_bot_agents(args=args, model_opts=model_opts)

programming_language: Python