VAITP Dataset

← Back to the dataset

CVE-2013-7489

Beaker library Python <=1.11.0 deserialization vulnerability

  • CVSS 6.8
  • CWE-502 Deserialization of Untrusted Data
  • Race Conditions
  • Remote

The Beaker library through 1.11.0 for Python is affected by deserialization of untrusted data, which could lead to arbitrary code execution.

CVSS base score
6.8
Published
2020-06-26
OWASP
A06 Vulnerable and Outdated Components
Orthogonal defect classification
Timing/Serialization
Code defect classification
Serialization Issues
Category
Race Conditions
Subcategory
Data Race Conditions in Threads
Accessibility scope
Remote
Impact
Arbitrary Code Execution
Affected component
Beaker
Fixed by upgrading
Yes

Solution

Update Beaker library to version 1.11.1 or higher.

Vulnerable code sample

import pickle

# Vulnerable code using pickle (not safe)
def load_data_vulnerable(data):
    return pickle.loads(data)

# Example of untrusted data that could execute arbitrary code
class MaliciousCode:
    def __reduce__(self):
        import os
        return (os.system, ("echo This could be arbitrary code execution!",))

# Simulating untrusted data
untrusted_data = pickle.dumps(MaliciousCode())

# Load data unsafely
try:
    result = load_data_vulnerable(untrusted_data)
except Exception as e:
    print(f"Error: {e}")

Patched code sample

import json
import pickle

# Vulnerable code using pickle (not safe)
def load_data_vulnerable(data):
    return pickle.loads(data)

# Fixed code using json (safer alternative)
def load_data_fixed(data):
    return json.loads(data)

# Example usage
if __name__ == "__main__":
    # Example of untrusted data
    untrusted_data = '{"key": "value"}'  # This would be a safe JSON string

    # Load data safely
    safe_data = load_data_fixed(untrusted_data)
    print(safe_data)

Cite this entry

@misc{vaitp:cve20137489,
  title        = {{Beaker library Python <=1.11.0 deserialization vulnerability}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2020},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2013-7489},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2013-7489/}}
}

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.