CVE-2020-1747: Pyyaml Improper Input Validation Vulnerability
CRITICALCVE-2020-1747 is a CRITICAL (CVSS 9.8) improper input validation vulnerability (CWE-20: Improper Input Validation) affecting Pyyaml libraries in the PyPI ecosystem. The issue involves improper input validation in pyyaml. Remediation is available by upgrading affected packages to version 5.3.1.
CVE-2020-1747 at a Glance
Security Impact
CVSS: 9.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2020-1747
To remediate this vulnerability, upgrade all affected Pyyaml 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 pyyaml>=5.3.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show pyyaml
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2020-1747, inspect your installed packages using pip:
pip show pyyaml
Analyze the terminal output to locate any version of Pyyaml in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.3.1), your application is affected.
Note: The pip show pyyaml command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Pyyaml, 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-2020-1747 Affected Pyyaml Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
pyyaml
|
PyPI |
≥ 5.1b7
< 5.3.1
|
5.3.1
|
References
Frequently Asked Questions
What is CVE-2020-1747?
Which Pyyaml versions are affected?
What version fixes CVE-2020-1747?
Is pyyaml affected?
What is the CVSS score of CVE-2020-1747?
What CWE is associated with CVE-2020-1747?
How can I check PyPI dependencies for CVE-2020-1747?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-6757-jp84-gxfx",
"modified" : "2024-10-31T16:17:34Z",
"published" : "2021-04-20T16:14:24Z",
"aliases" : [ "CVE-2020-1747" ],
"summary" : "Improper Input Validation in PyYAML",
"details" : "A vulnerability was discovered in the PyYAML library in versions before 5.3.1, where it is susceptible to arbitrary code execution when it processes untrusted YAML files through the full_load method or with the FullLoader loader. Applications that use the library to process untrusted input may be vulnerable to this flaw. An attacker could use this flaw to execute arbitrary code on the system by abusing the python/object/new constructor.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "pyyaml"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "5.1b7"
}, {
"fixed" : "5.3.1"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-1747"
}, {
"type" : "WEB",
"url" : "https://github.com/github/advisory-database/pull/4942"
}, {
"type" : "WEB",
"url" : "https://github.com/yaml/pyyaml/pull/386"
}, {
"type" : "WEB",
"url" : "https://github.com/yaml/pyyaml/commit/0cedb2a0697b2bc49e4f3841b8d4590b6b15657e"
}, {
"type" : "WEB",
"url" : "https://github.com/yaml/pyyaml/commit/5080ba513377b6355a0502104846ee804656f1e0"
}, {
"type" : "WEB",
"url" : "https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2020-1747"
}, {
"type" : "ADVISORY",
"url" : "https://github.com/advisories/GHSA-6757-jp84-gxfx"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/pyyaml/PYSEC-2020-96.yaml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/yaml/pyyaml"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/7PPAS6C4SZRDQLR7C22A5U3QOLXY33JX"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/K5HEPD7LEVDPCITY5IMDYWXUMX37VFMY"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/MMQXSZXNJT6ERABJZAAICI3DQSQLCP3D"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/WORRFHPQVAFKKXXWLSSW6XKUYLWM6CSH"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZBJA3SGNJKCAYPSHOHWY3KBCWNM5NYK2"
}, {
"type" : "WEB",
"url" : "https://www.oracle.com/security-alerts/cpujul2022.html"
}, {
"type" : "WEB",
"url" : "http://lists.opensuse.org/opensuse-security-announce/2020-04/msg00017.html"
}, {
"type" : "WEB",
"url" : "http://lists.opensuse.org/opensuse-security-announce/2020-05/msg00017.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-20" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2021-04-07T22:29:00Z",
"nvd_published_at" : "2020-03-24T15:15:00Z"
}
}