PyYAML: yaml.load() API could execute arbitrary code
Published Jun 27, 2018
9.8
CRITICALCVSS 3.1
EPSS 5.66%
Description
In PyYAML before 5.1, the yaml.load() API could execute arbitrary code if used with untrusted data. The load() function has been deprecated in version 5.1 and the 'UnsafeLoader' has been introduced for backward compatibility with the function.
Affected products
No data.
Configuration 2
- 28
- 29
- 30
No data.
Red Hat Ceph Storage 1.3
PyYAML
Will not fix
Red Hat Enterprise Linux 6
PyYAML
Will not fix
Red Hat Enterprise Linux 7
PyYAML
Will not fix
Red Hat Enterprise Linux 8
PyYAML
Will not fix
Red Hat Enterprise Linux OpenStack Platform 7 (Kilo)
PyYAML
Will not fix
Red Hat Enterprise MRG 2
PyYAML
Will not fix
Red Hat OpenStack Platform 10 (Newton)
PyYAML
Will not fix
Red Hat OpenStack Platform 12 (Pike)
PyYAML
Will not fix
Red Hat OpenStack Platform 13 (Queens)
PyYAML
Will not fix
Red Hat OpenStack Platform 15 (Stein)
PyYAML
Not affected
Red Hat OpenStack Platform 8 (Liberty)
PyYAML
Will not fix
Red Hat OpenStack Platform 9 (Mitaka)
PyYAML
Will not fix
Red Hat Satellite 5
PyYAML
Will not fix
Red Hat Software Collections
python27-PyYAML
Will not fix
Red Hat Software Collections
rh-python36-PyYAML
Will not fix
| Product | Package | State | Advisory |
|---|---|---|---|
| Red Hat Ceph Storage 1.3 | PyYAML | Will not fix | n/a |
| Red Hat Enterprise Linux 6 | PyYAML | Will not fix | n/a |
| Red Hat Enterprise Linux 7 | PyYAML | Will not fix | n/a |
| Red Hat Enterprise Linux 8 | PyYAML | Will not fix | n/a |
| Red Hat Enterprise Linux OpenStack Platform 7 (Kilo) | PyYAML | Will not fix | n/a |
| Red Hat Enterprise MRG 2 | PyYAML | Will not fix | n/a |
| Red Hat OpenStack Platform 10 (Newton) | PyYAML | Will not fix | n/a |
| Red Hat OpenStack Platform 12 (Pike) | PyYAML | Will not fix | n/a |
| Red Hat OpenStack Platform 13 (Queens) | PyYAML | Will not fix | n/a |
| Red Hat OpenStack Platform 15 (Stein) | PyYAML | Not affected | n/a |
| Red Hat OpenStack Platform 8 (Liberty) | PyYAML | Will not fix | n/a |
| Red Hat OpenStack Platform 9 (Mitaka) | PyYAML | Will not fix | n/a |
| Red Hat Satellite 5 | PyYAML | Will not fix | n/a |
| Red Hat Software Collections | python27-PyYAML | Will not fix | n/a |
| Red Hat Software Collections | rh-python36-PyYAML | Will not fix | n/a |
No package ranges for this CVE.
Remediation
Red Hat statement
The default loading mechanism in PyYAML contains fundamental and long-standing functionality that allows for arbitrary code execution. The yaml.load() function (when called without a specified loader), has been documented as inherently unsafe since its first release. When processing YAML input, this function can call any Python function, including those that execute system commands (i.e., os.system()). In response, the PyYAML maintainers have deprecated the plain use of yaml.load() to encourage developers to explicitly choose a safer option. The yaml.safe_load() function is the intended replacement. It handles a safe subset of the YAML language and disables the dangerous features that permit arbitrary code execution, effectively neutralizing the RCE threat from untrusted input. However, to maintain backwards compatibility the yaml.load() function remains available. Its default behavior (as of PyYAML 5.1) was to use FullLoader and issue a warning. FullLoader was deemed not safe for untrusted data, and as of PyYAML 6.0 yaml.load() requires an explicit Loader argument. The original vulnerable loader is also retained (again, in the interest of backwards compatibility) which provides the attack vector. The code executed via PyYAML runs as the user invoking the python binary calling the pyyaml module– there is no inherent privilege escalation. Therefore any exploit affecting any substantial impact requires privilege escalation via a separate vulnerability or poor application design and/or poor coding practices. Given that the vulnerability in PyYAML’s load function provides a mechanism for threat actors to potentially impact a system via a wide range of Python functions, Red Hat must err on the side of caution and view the possible impact to Confidentiality, Integrity, and Availability as High.
Red Hat mitigation
Any codebases written in Python and employing the PyYAML library should be audited. Developers should replace every instance of the deprecated yaml.load() function with the secure alternative, yaml.safe_load(), especially when handling configuration or data from untrusted sources. Any applications invoking python where PyYAML is available should run as a non-privileged user.
Metrics
No CVSS v4.0 score for this CVE.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
AV:N/AC:L/Au:N/C:P/I:P/A:P
This CVE is not in the KEV list.
No CISA SSVC assessment for this CVE yet.
Estimated probability of exploitation in the wild in the next 30 days (FIRST EPSS). As of Oct 1, 2026.
Score over time
2021–2026- EPSS v1
- EPSS v2
- EPSS v3
- EPSS v4
- EPSS v5
Percentile over time
- EPSS v1
- EPSS v2
- EPSS v3
- EPSS v4
- EPSS v5
Table of values (20 key points)
Flat stretches are collapsed; showing up to 120 newest points.
| Date | Score | Percentile | Model |
|---|---|---|---|
| Oct 1, 2026 | 5.66% (0.05656) | 92.73th | v5 (v2026.06.15) |
| Jun 15, 2026 | 6.08% (0.06081) | 92.46th | v5 (v2026.06.15) |
| Mar 30, 2025 | 4.78% (0.04784) | 88.45th | v4 (v2025.03.14) |
| Mar 29, 2025 | 13.97% (0.13971) | 90.56th | v4 (v2025.03.14) |
| Mar 17, 2025 | 4.78% (0.04784) | 88.73th | v4 (v2025.03.14) |
| Dec 12, 2024 | 1.42% (0.01419) | 87.04th | v3 (v2023.03.01) |
| Jun 6, 2024 | 1.42% (0.01419) | 86.53th | v3 (v2023.03.01) |
| Nov 18, 2023 | 1.44% (0.01440) | 85.13th | v3 (v2023.03.01) |
| Nov 8, 2023 | 1.57% (0.01572) | 85.79th | v3 (v2023.03.01) |
| Jul 8, 2023 | 1.17% (0.01173) | 83.08th | v3 (v2023.03.01) |
| Jun 21, 2023 | 1.65% (0.01648) | 85.80th | v3 (v2023.03.01) |
| May 8, 2023 | 1.61% (0.01607) | 85.48th | v3 (v2023.03.01) |
| Mar 7, 2023 | 1.14% (0.01144) | 82.54th | v3 (v2023.03.01) |
| Mar 6, 2023 | 3.81% (0.03806) | 85.56th | v2 (v2022.01.01) |
| Apr 1, 2022 | 3.81% (0.03806) | 84.08th | v2 (v2022.01.01) |
| Feb 4, 2022 | 3.81% (0.03806) | 67.27th | v2 (v2022.01.01) |
| Feb 3, 2022 | 3.59% (0.03590) | 68.40th | v1 |
| Jan 6, 2022 | 3.59% (0.03590) | 68.10th | v1 |
| Sep 1, 2021 | 3.59% (0.03590) | 82.08th | v1 |
| Apr 14, 2021 | 3.59% (0.03590) | 0.00th | v1 |
References (21)
- https://access.redhat.com/security/cve/CVE-2017-18342 Vendor Advisory
- https://bugzilla.redhat.com/show_bug.cgi?id=1595743 Issue Tracking
- https://github.com/advisories/GHSA-rprw-h62v-c2w7 Advisory
- https://github.com/marshmallow-code/apispec/issues/278 x_refsource_MISCThird Party Advisory
- https://github.com/pypa/advisory-database/tree/main/vulns/pyyaml/PYSEC-2018-49.yaml
- https://github.com/yaml/pyyaml/blob/master/CHANGES x_refsource_MISCRelease NotesThird Party Advisory
- https://github.com/yaml/pyyaml/commit/7b68405c81db889f83c32846462b238ccae5be80
- https://github.com/yaml/pyyaml/issues/193 x_refsource_MISCThird Party Advisory
- https://github.com/yaml/pyyaml/issues/207#issuecomment-472520007
- https://github.com/yaml/pyyaml/pull/74 x_refsource_MISCPatchThird Party Advisory
- https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load%28input%29-Deprecation x_refsource_MISC
- https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load(input)-Deprecation
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/JEX7IPV5P2QJITAMA5Z63GQCZA5I6NVZ/ vendor-advisoryx_refsource_FEDORA
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/KSQQMRUQSXBSUXLCRD3TSZYQ7SEZRKCE/ vendor-advisoryx_refsource_FEDORA
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/M6JCFGEIEOFMWWIXGHSELMKQDD4CV2BA/ vendor-advisoryx_refsource_FEDORA
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/JEX7IPV5P2QJITAMA5Z63GQCZA5I6NVZ
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/KSQQMRUQSXBSUXLCRD3TSZYQ7SEZRKCE
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/M6JCFGEIEOFMWWIXGHSELMKQDD4CV2BA
- https://nvd.nist.gov/vuln/detail/CVE-2017-18342
- https://security.gentoo.org/glsa/202003-45 vendor-advisoryx_refsource_GENTOOThird Party Advisory
- https://www.cve.org/CVERecord?id=CVE-2017-18342
Change history (0)
No recorded changes yet.