VAITP Dataset

← Back to the dataset

CVE-2020-22083

jsonpickle 1.4.1 RCE in decode

  • CVSS 9.8
  • CWE-502 Deserialization of Untrusted Data
  • Input Validation and Sanitization
  • Remote

** DISPUTED ** jsonpickle through 1.4.1 allows remote code execution during deserialization of a malicious payload through the decode() function. Note: It has been argued that this is expected and clearly documented behaviour. pickle is known to be capable of causing arbitrary code execution, and must not be used with un-trusted data.

CVSS base score
9.8
Published
2020-12-17
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
Remote
Impact
Arbitrary Code Execution
Affected component
jsonpickle
Fixed by upgrading
Yes

Solution

Update jsonpickle to version 2.0.0 or higher.

Vulnerable code sample

import jsonpickle

# Vulnerable deserialization function
def vulnerable_deserialize(data):
    # Directly using jsonpickle's decode method without any restrictions
    return jsonpickle.decode(data)

# Example usage with a malicious payload
malicious_payload = '{"py/object": "__main__.YourMaliciousClass"}'
result = vulnerable_deserialize(malicious_payload)

Patched code sample

import jsonpickle

# Safe deserialization function
def safe_deserialize(data):
    # Use jsonpickle's `decode` method with a whitelist of allowed classes
    return jsonpickle.decode(data, classes=(YourAllowedClass1, YourAllowedClass2))

# Example usage
malicious_payload = '{"py/object": "__main__.YourMaliciousClass"}'
try:
    result = safe_deserialize(malicious_payload)
except Exception as e:
    print("Deserialization failed:", e)

Cite this entry

@misc{vaitp:cve202022083,
  title        = {{jsonpickle 1.4.1 RCE in decode}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2020},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2020-22083},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2020-22083/}}
}

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.