VAITP Dataset

← Back to the dataset

CVE-2019-10904

Roundup 1.6 XSS via URI in frontends/roundup.cgi and roundup/cgi/wsgi_handler.py mishandling 404 errors

  • CVSS 6.1
  • CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
  • Configuration Issues
  • Remote

Roundup 1.6 allows XSS via the URI because frontends/roundup.cgi and roundup/cgi/wsgi_handler.py mishandle 404 errors.

CVSS base score
6.1
Published
2019-04-06
OWASP
A05 Security Misconfiguration
Orthogonal defect classification
Function
Code defect classification
Incorrect Functionality
Category
Configuration Issues
Subcategory
Cross-Site Scripting (XSS)
Accessibility scope
Remote
Impact
Arbitrary Code Execution
Fixed by upgrading
Yes

Solution

Update Roundup to version 2.1.0 or higher.

Vulnerable code sample

from flask import Flask, request

app = Flask(__name__)

@app.route('/<path:path>', methods=['GET'])
def handle_request(path):
    resource = lookup_resource(path)
    
    if resource is None:
        return f"Error: Resource '{path}' not found", 404

    return resource

def lookup_resource(path):
    return None

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

Patched code sample

from flask import Flask, request, abort
import os

app = Flask(__name__)

ALLOWED_RESOURCES_DIR = '/path/to/allowed/resources'

@app.route('/<path:path>', methods=['GET'])
def handle_request(path):
    sanitized_path = os.path.normpath(path)
    if '..' in sanitized_path or sanitized_path.startswith('/'):
        return f"Error: Invalid resource '{path}'", 400
    
    resource = lookup_resource(sanitized_path)
    
    if resource is None:
        return f"Error: Resource '{path}' not found", 404

    return resource

def lookup_resource(path):
    resource_path = os.path.join(ALLOWED_RESOURCES_DIR, path)
    
    if not resource_path.startswith(ALLOWED_RESOURCES_DIR):
        return None

    if os.path.exists(resource_path):
        with open(resource_path, 'r') as file:
            return file.read()
    return None

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

Cite this entry

@misc{vaitp:cve201910904,
  title        = {{Roundup 1.6 XSS via URI in frontends/roundup.cgi and roundup/cgi/wsgi_handler.py mishandling 404 errors}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2019},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2019-10904},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2019-10904/}}
}
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 ::