VAITP Dataset

← Back to the dataset

CVE-2020-15348

Python code injection in Zyxel CloudCNM SecuManager 3.1.0 and 3.1.1 via "delete_cpes_by_ids" function

  • CVSS 9.8
  • CWE-94 Improper Control of Generation of Code ('Code Injection')
  • Input Validation and Sanitization
  • Remote

Zyxel CloudCNM SecuManager 3.1.0 and 3.1.1 allows use of live/CPEManager/AXCampaignManager/delete_cpes_by_ids?cpe_ids= for eval injection of Python code.

CVSS base score
9.8
Published
2020-06-26
OWASP
A03 Injection
Orthogonal defect classification
Function
Code defect classification
Incorrect Functionality
Category
Input Validation and Sanitization
Subcategory
Command Injection
Accessibility scope
Remote
Impact
Arbitrary Code Execution
Affected component
Python
Fixed by upgrading
Yes

Solution

Update Zyxel CloudCNM SecuManager to version 3.1.2 or higher.

Vulnerable code sample

from flask import Flask, request

app = Flask(__name__)

# Simulated database of CPEs
CPE_DATABASE = {
    "1": "CPE 1",
    "2": "CPE 2",
    "3": "CPE 3"
}

@app.route('/live/CPEManager/AXCampaignManager/delete_cpes_by_ids', methods=['DELETE'])
def delete_cpes_by_ids():
    cpe_ids = request.args.get('cpe_ids')
    
    # Directly using eval on user input (vulnerable code)
    eval("delete_ids = " + cpe_ids)

    # Proceed with deletion of CPEs
    for cpe_id in delete_ids:
        if cpe_id in CPE_DATABASE:
            del CPE_DATABASE[cpe_id]

    return {"status": "success", "deleted_ids": delete_ids}, 200

if __name__ == '__main__':
    app.run()

Patched code sample

import json
from flask import Flask, request, abort

app = Flask(__name__)

# Simulated database of CPEs
CPE_DATABASE = {
    "1": "CPE 1",
    "2": "CPE 2",
    "3": "CPE 3"
}

@app.route('/live/CPEManager/AXCampaignManager/delete_cpes_by_ids', methods=['DELETE'])
def delete_cpes_by_ids():
    cpe_ids = request.args.get('cpe_ids')
    
    if not cpe_ids:
        abort(400, "Missing cpe_ids parameter")

    # Validate input to prevent eval injection
    try:
        cpe_ids_list = json.loads(cpe_ids)
        if not isinstance(cpe_ids_list, list) or not all(isinstance(i, str) for i in cpe_ids_list):
            raise ValueError
    except (ValueError, json.JSONDecodeError):
        abort(400, "Invalid cpe_ids format. Must be a JSON array of strings.")

    # Proceed with deletion of CPEs
    for cpe_id in cpe_ids_list:
        if cpe_id in CPE_DATABASE:
            del CPE_DATABASE[cpe_id]

    return json.dumps({"status": "success", "deleted_ids": cpe_ids_list}), 200

if __name__ == '__main__':
    app.run()

Cite this entry

@misc{vaitp:cve202015348,
  title        = {{Python code injection in Zyxel CloudCNM SecuManager 3.1.0 and 3.1.1 via "delete_cpes_by_ids" function}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2020},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2020-15348},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2020-15348/}}
}

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.