VAITP Dataset

← Back to the dataset

CVE-2017-16618

YAML loading in OwlMixin before 2.0.0a12 allows Python command execution due to improper use of "load" instead of "safe_load"

  • CVSS 9.8
  • CWE-611: Improper Restriction of XML External Entity Reference (XXE)
  • Input Validation and Sanitization
  • Local

An exploitable vulnerability exists in the YAML loading functionality of util.py in OwlMixin before 2.0.0a12. A "Load YAML" string or file (aka load_yaml or load_yamlf) can execute arbitrary Python commands resulting in command execution because load is used where safe_load should have been used. An attacker can insert Python into loaded YAML to trigger this vulnerability.

CVSS base score
9.8
Published
2017-11-08
OWASP
A06 Vulnerable and Outdated Components
Orthogonal defect classification
Function
Code defect classification
Incorrect Functionality
Category
Input Validation and Sanitization
Subcategory
Insecure Parsing or Deserialization
Accessibility scope
Local
Impact
Arbitrary Code Execution
Affected component
Python
Fixed by upgrading
Yes

Solution

Update OwlMixin to version 2.0.0a12 or higher.

Vulnerable code sample

import yaml

def load_yaml(data):
    return yaml.load(data)

def load_yamlf(filename):
    with open(filename, 'r') as f:
        return yaml.load(f)

Patched code sample

Here is an example of how the vulnerability CVE-2017-16618 was fixed:
```
import yaml

def load_yaml(data):
    return yaml.safe_load(data)

def load_yamlf(filename):
    with open(filename, 'r') as f:
        return yaml.safe_load(f)
```
Note that the `safe_load` function is used instead of the `load` function to prevent arbitrary Python command execution.

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

Cite this entry

@misc{vaitp:cve201716618,
  title        = {{YAML loading in OwlMixin before 2.0.0a12 allows Python command execution due to improper use of "load" instead of "safe_load"}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2017},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2017-16618},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2017-16618/}}
}

Download this entry as JSON Download the whole dataset

Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.