VAITP Dataset

← Back to the dataset

CVE-2011-4213

Google App Engine Python SDK < 1.5.4 sandbox os module bypass

  • CVSS 7.2
  • CWE-264: Permissions, Privileges, and Access Controls
  • Input Validation and Sanitization
  • Local

The sandbox environment in the Google App Engine Python SDK before 1.5.4 does not properly prevent use of the os module, which allows local users to bypass intended access restrictions and execute arbitrary commands via a file_blob_storage.os reference within the code parameter to _ah/admin/interactive/execute, a different vulnerability than CVE-2011-1364.

CVSS base score
7.2
Published
2011-10-30
OWASP
A10 Server Side Request Forgery (SSRF)
Orthogonal defect classification
Function
Code defect classification
Incorrect Functionality
Category
Input Validation and Sanitization
Subcategory
Insecure Direct Object References (IDOR)
Accessibility scope
Local
Impact
Arbitrary Code Execution
Fixed by upgrading
Yes

Solution

Update Google App Engine Python SDK to version 1.5.4 or higher.

Vulnerable code sample

import os

def function(code):
    """Vulnerable function that demonstrates the security issue."""
    exec(code)

user_input = "os.system('echo Vulnerable!')"
function(user_input)

Patched code sample

import os

BLACKLIST = ['os.system', 'exec', 'eval', 'subprocess', 'open', '__import__']

def function(code):
    """Secure function that fixes the vulnerability."""
    # SECURE: This version prevents command injection
    for item in BLACKLIST:
        if item in code:
            raise ValueError(f"Use of {item} is not allowed.")
    
    exec(code)

user_input = "os.system('echo Vulnerable!')"

try:
    function(user_input)
except ValueError as e:
    print(f"Error: {e}")

Cite this entry

@misc{vaitp:cve20114213,
  title        = {{Google App Engine Python SDK < 1.5.4 sandbox os module bypass}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2011},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2011-4213},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2011-4213/}}
}
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 ::