CVE-2017-18342 PyYAML insecurely deserializes YAML strings leading to arbitrary code execution

Critical 9.8 Published Updated

Attackers can execute arbitrary code by providing malicious YAML data to the unsafe load function in PyYAML.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2017-18342?

CVE-2017-18342 is a critical unsafe deserialization vulnerability in Fedoraproject Fedora, published on 27 Jun 2018. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official 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.

Weakness: CWE-502

Which versions are affected by CVE-2017-18342?

3 open source packages ship an affected version, including pyyaml and PyYAML. It affects 2 products.

PackageAffectedFixed in
pyyaml PyPIAll versions5.1
pyyaml PyPIAll versions5.1
PyYAML PyPIAll versions5.1
Linux distribution packages (2)
python-openapi-spec-validator openSUSE:TumbleweedAll versions0.7.1-1.3
python-openapi-spec-validator openSUSE:TumbleweedAll versions0.9.0-1.1

Products include Fedoraproject Fedora, Pyyaml Pyyaml.

How do I fix CVE-2017-18342?

Upgrade pyyaml to 5.1 or later.

Upgrade, and only deserialise data from trusted sources or with an allow-list of types. More about Unsafe deserialization.

Is CVE-2017-18342 being exploited?

There is no known exploitation of CVE-2017-18342 in the wild and no public exploit code.

All Fedoraproject Fedora vulnerabilities

Sources

Also known as DEBIAN-CVE-2017-18342, GHSA-rprw-h62v-c2w7, MGASA-2019-0125, PYSEC-2018-49, UBUNTU-CVE-2017-18342, openSUSE-SU-2024:11247-1 and 2 more.

Is CVE-2017-18342 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free