CVE-2020-14343: PyYAML Arbitrary Code Execution

pyyaml Updated 02 Oct 2025

Summary

09/02/2021
Yes i
Critical
9.8

CVE-2020-14343: A vulnerability was discovered in the PyYAML library in versions before 5.4, where it is susceptible to arbitrary code execution when it processes untrusted YAML files through the full_load method or with the FullLoader... Affects pyyaml versions < 5.4. Fixed in 5.4. How to fix ↓

Also tracked for

The same CVE-2020-14343 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

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

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

PyYAML is a Python library that allows parsing and emitting YAML files. It is widely used in applications that require YAML processing. However, versions before 5.4 are vulnerable to arbitrary code execution when processing untrusted YAML files. This vulnerability can be exploited through the full_load method or with the FullLoader loader, allowing an attacker to execute arbitrary code on the system. The vulnerability stems from an incomplete fix for CVE-2020-1747.

Vulnerability Detail

The vulnerability in PyYAML allows an attacker to execute arbitrary code by abusing the python/object/new constructor. When processing untrusted YAML files, the library fails to properly sanitize input, leading to code execution. This flaw poses a significant risk to applications that use PyYAML to process untrusted input, as an attacker can take control of the system and perform unauthorized actions. It is crucial to update to version 5.4 or newer to mitigate this vulnerability.

How To Fix

Minimum fixed version

5.4

This is the first release that contains the fix.

pip install --upgrade "pyyaml==5.4"

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

Conclusion

The vulnerability in PyYAML versions before 5.4 allows arbitrary code execution when processing untrusted YAML files. It is crucial to update to version 5.4 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 Python library that allows parsing and emitting YAML files. It is commonly used in applications that require YAML processing.

This vulnerability allows an attacker to execute arbitrary code on the system by abusing the python/object/new constructor. It can lead to unauthorized access, data leakage, and potential system compromise.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability. It analyzes your Pipfile.lock and provides real-time alerts for open-source vulnerabilities.

Currently, there is no known workaround for this vulnerability. It is recommended to update PyYAML to version 5.4 or later to mitigate the risk.

Related vulnerabilities

Recent vulnerabilities recorded for pyyaml.

How To Fix

Minimum fixed version

5.4

This is the first release that contains the fix.

pip install --upgrade "pyyaml==5.4"

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