Attacker Value
Moderate
(1 user assessed)
Exploitability
High
(1 user assessed)
User Interaction
None
Privileges Required
None
Attack Vector
Network
1

CVE-2020-14343

Disclosure Date: February 09, 2021
Add MITRE ATT&CK tactics and techniques that apply to this CVE.

Description

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 loader. Applications that use the library to process untrusted input may be vulnerable to this flaw. This flaw allows an attacker to execute arbitrary code on the system by abusing the python/object/new constructor. This flaw is due to an incomplete fix for CVE-2020-1747.

Add Assessment

2
Ratings
Technical Analysis

Overview

The PyYAML library contains a vulnerability where an attacker with control over data which is loaded using the load function can trigger arbitrary Python code execution. The latest version as of this writing (5.3.1) is affected. PyYAML version 4.1 changed the default load to use safe_load by default, however this was reverted in the 4.2 release. Later, in version 5.1 the PyYAML project implemented a new default FullLoader class which prevented function calls but is in sufficient to prevent code execution.

Details

The latest versions of PyYAML (5.1+) use a default loader implementation that allow deserialization of objects and references but not functions. The builtin map is a class in Python3 and can be used to apply the builtin eval function to indirectly trigger a function call.

!!python/object/new:tuple 
- !!python/object/new:map 
  - !!python/name:eval
  - [ "RCE_HERE" ]

An attacker looking to leverage this vulnerability would need to identify that YAML is loaded by the application and then submit their crafted data to be loaded.

Solution

The PyYAML library contains a two primary alternatives to load data safely. The first is to use the load_safe alternative, the second is to specify the SafeLoader class as the Loader keyword argument to the standard load function. This is detailed in the PyYAML-Deprecation) Wiki page. Developers using PyYAML should use one of these safe methods and ensure that they are not loading data from untrusted sources.

See: https://blog.arxenix.dev/pyyaml-cve/ for more information.

CVSS V3 Severity and Metrics
Base Score:
9.8 Critical
Impact Score:
5.9
Exploitability Score:
3.9
Vector:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Attack Vector (AV):
Network
Attack Complexity (AC):
Low
Privileges Required (PR):
None
User Interaction (UI):
None
Scope (S):
Unchanged
Confidentiality (C):
High
Integrity (I):
High
Availability (A):
High

General Information

Products

  • PyYAML

Additional Info

Technical Analysis