CVE-2020-1747

9.8 CRITICAL

📋 TL;DR

This vulnerability allows arbitrary code execution when PyYAML processes untrusted YAML files using the full_load method or FullLoader loader. Applications using PyYAML versions before 5.3.1 to parse untrusted YAML input are affected. Attackers can exploit this to execute arbitrary Python code on vulnerable systems.

💻 Affected Systems

Products:
  • PyYAML library
  • Any application using PyYAML
Versions: All versions before 5.3.1
Operating Systems: All operating systems running Python
Default Config Vulnerable: ⚠️ Yes
Notes: Only vulnerable when processing untrusted YAML input using full_load() or FullLoader. Safe_load() is not affected.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise with attacker gaining full control over the vulnerable system, potentially leading to data theft, ransomware deployment, or lateral movement.

🟠

Likely Case

Remote code execution leading to application compromise, data exfiltration, or service disruption depending on the application's privileges and functionality.

🟢

If Mitigated

No impact if proper input validation and patching are implemented, or if only trusted YAML sources are processed.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires the application to process attacker-controlled YAML input. The vulnerability is well-documented with public proof-of-concept examples available.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 5.3.1 and later

Vendor Advisory: https://github.com/yaml/pyyaml/pull/386

Restart Required: No

Instructions:

1. Update PyYAML: pip install --upgrade pyyaml>=5.3.1
2. Verify installation: pip show pyyaml
3. Test that vulnerable methods no longer accept dangerous constructors

🔧 Temporary Workarounds

Use SafeLoader instead of FullLoader

all

Replace FullLoader with SafeLoader in code to prevent dangerous YAML constructors from being processed

Replace: yaml.load(data, Loader=yaml.FullLoader) with: yaml.load(data, Loader=yaml.SafeLoader)
Replace: yaml.full_load(data) with: yaml.safe_load(data)

Input validation and sanitization

all

Implement strict input validation to only accept YAML from trusted sources

🧯 If You Can't Patch

  • Implement strict network controls to prevent untrusted YAML input from reaching vulnerable systems
  • Use application-level firewalls or WAFs to block malicious YAML payloads

🔍 How to Verify

Check if Vulnerable:

Check PyYAML version: pip show pyyaml | grep Version
If version is <5.3.1 and application uses full_load() or FullLoader with untrusted input, it's vulnerable.

Check Version:

pip show pyyaml | grep Version

Verify Fix Applied:

Verify PyYAML version is >=5.3.1: pip show pyyaml | grep Version
Test that dangerous constructors like '!!python/object/new' are rejected.

📡 Detection & Monitoring

Log Indicators:

  • Unusual process execution from Python applications
  • Errors related to YAML parsing failures
  • Application crashes when processing YAML

Network Indicators:

  • Unusual outbound connections from applications that process YAML
  • Large YAML payloads being sent to applications

SIEM Query:

source="application_logs" AND ("full_load" OR "FullLoader") AND ("python/object" OR "!!python")

🔗 References

📤 Share & Export