CVE-2021-39207: Parlai Deserialization Of Untrusted Data Vulnerability

MODERATE
Advisory Identifier: GHSA-m87f-9fvv-2mgg
CVSS 8.4
CWE-502
Published
Advisory Summary

CVE-2021-39207 is a MODERATE (CVSS 8.4) deserialization of untrusted data vulnerability (CWE-502: Deserialization of Untrusted Data) affecting Parlai libraries in the PyPI ecosystem. The issue involves deserialization of untrusted data in parlai. Remediation is available by upgrading affected packages to version 1.1.0.

CVE-2021-39207 at a Glance

CVE Identifier CVE-2021-39207
GHSA Identifier GHSA-m87f-9fvv-2mgg
Severity MODERATE
CVSS v3.1 Base Score 8.4
CWE Classification CWE-502: Deserialization of Untrusted Data
Affected Product Parlai
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.4

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

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

How to Fix CVE-2021-39207

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

parlai fixed: 1.1.0
pip install parlai>=1.1.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 parlai

How to Check if You Are Affected

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

pip show parlai

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

Note: The pip show parlai 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 Parlai, 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

### Impact Due to use of unsafe YAML deserialization logic, an attacker with the ability to modify local YAML configuration files could provide malicious input, resulting in remote code execution or similar risks. ### Patches The issue can be patched by upgrading to v1.1.0 or later. It can also be patched by replacing YAML deserialization with equivalent safe_load calls. ### References - https://github.com/facebookresearch/ParlAI/commit/507d066ef432ea27d3e201da08009872a2f37725 - https://github.com/facebookresearch/ParlAI/commit/4374fa2aba383db6526ab36e939eb1cf8ef99879 - https://anon-artist.github.io/blogs/blog3.html

CVE-2021-39207 Affected Parlai Versions

1 component(s)
Fixed Versions:
1.1.0
Product / Package Ecosystem Affected Versions Fixed Version
parlai
PyPI
< 1.1.0
1.1.0

References

Frequently Asked Questions

What is CVE-2021-39207?
CVE-2021-39207 is a security vulnerability in Parlai involving Deserialization of Untrusted Data in parlai under CWE-502: Deserialization of Untrusted Data.
Which Parlai versions are affected?
Affected versions include releases prior to 1.1.0 across affected packages: parlai.
What version fixes CVE-2021-39207?
Upgrading to 1.1.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is parlai affected?
Yes, parlai is affected in releases prior to 1.1.0. Upgrade your dependency to 1.1.0 or later.
What is the CVSS score of CVE-2021-39207?
CVE-2021-39207 has a CVSS v3.1 base score of 8.4 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:L.
What CWE is associated with CVE-2021-39207?
CVE-2021-39207 is classified under CWE-502: Deserialization of Untrusted Data (The product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid.).
How can I check PyPI dependencies for CVE-2021-39207?
Run the dependency tree command: 'pip show parlai'. 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-m87f-9fvv-2mgg",
  "modified" : "2024-10-09T21:00:01Z",
  "published" : "2021-09-13T20:05:39Z",
  "aliases" : [ "CVE-2021-39207" ],
  "summary" : "Deserialization of Untrusted Data in parlai",
  "details" : "### Impact\nDue to use of unsafe YAML deserialization logic, an attacker with the ability to modify local YAML configuration files could provide malicious input, resulting in remote code execution or similar risks.\n\n### Patches\nThe issue can be patched by upgrading to v1.1.0 or later. It can also be patched by replacing YAML deserialization with equivalent safe_load calls.\n\n### References\n\n- https://github.com/facebookresearch/ParlAI/commit/507d066ef432ea27d3e201da08009872a2f37725\n- https://github.com/facebookresearch/ParlAI/commit/4374fa2aba383db6526ab36e939eb1cf8ef99879\n- https://anon-artist.github.io/blogs/blog3.html",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:L"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "parlai"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.1.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/facebookresearch/ParlAI/security/advisories/GHSA-m87f-9fvv-2mgg"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-39207"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/facebookresearch/ParlAI/commit/4374fa2aba383db6526ab36e939eb1cf8ef99879"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/facebookresearch/ParlAI/commit/507d066ef432ea27d3e201da08009872a2f37725"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-mwgj-7x7j-6966"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/facebookresearch/ParlAI"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/facebookresearch/ParlAI/releases/tag/v1.1.0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/parlai/PYSEC-2021-330.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/parlai/PYSEC-2021-334.yaml"
  }, {
    "type" : "WEB",
    "url" : "http://packetstormsecurity.com/files/164136/Facebook-ParlAI-1.0.0-Code-Execution-Deserialization.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-502" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-09-13T19:10:21Z",
    "nvd_published_at" : "2021-09-10T23:15:00Z"
  }
}