Class Deserialization Issue in PyYAML 5.1 through 5.1.2

pyyaml Updated 02 Oct 2025

Summary

19/02/2020
N/A
Yes i
Critical
9.8

CVE-2019-20477: PyYAML 5.1 through 5.1.2 has insufficient restrictions on the load and load_all functions because of a class deserialization issue, e.g., Popen is a class in the subprocess module. Affects pyyaml across 2 version ranges.

< 5.2-1 >= e471e86bf6dabdad45a1438c20a4a5c033eb9034, <= a9b98a3daa43d43afd8051b014d5b4154d141913

Fixed in 5.2-1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

PyYAML is a YAML parser and emitter for Python. It allows developers to easily read and write YAML files, which are commonly used for configuration purposes. PyYAML is widely used in various applications and frameworks. However, versions 5.1 through 5.1.2 of PyYAML suffer from a class deserialization issue, which can lead to security vulnerabilities.

Vulnerability Detail

The vulnerability in PyYAML arises due to insufficient restrictions on the load and load_all functions. This issue allows for class deserialization, which means that an attacker can execute arbitrary code by crafting a malicious YAML file. For example, the Popen class in the subprocess module can be exploited. It is important to note that this vulnerability is a result of an incomplete fix for a previous vulnerability (CVE-2017-18342). The impact of this vulnerability can be severe, as it allows for remote code execution and potential compromise of the affected system.

How To Fix

Minimum fixed version

5.2-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade pyyaml

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There is no known workaround for this vulnerability. It is crucial to apply the recommended fix by upgrading PyYAML to a secure version.

Conclusion

The class deserialization issue in PyYAML versions 5.1 through 5.1.2 poses a significant security risk, allowing for remote code execution. It is crucial to upgrade PyYAML to version 5.2-1 or later to mitigate this vulnerability. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for pyyaml →

Share this vulnerability

FAQ

PyYAML is a YAML parser and emitter for Python. It allows developers to easily read and write YAML files.

Versions 5.1 through 5.1.2 of PyYAML are affected by this vulnerability.

This vulnerability allows for remote code execution and potential compromise of the affected system.

No, there is no known workaround. It is necessary to upgrade PyYAML to a secure version.

To fix this vulnerability, upgrade PyYAML to version 5.2-1 or later.

Related vulnerabilities

Recent vulnerabilities recorded for pyyaml.

How To Fix

Minimum fixed version

5.2-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade pyyaml

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback