VAITP Dataset

← Back to the dataset

CVE-2019-16935

XSS vulnerability in Python XML-RPC server documentation

  • CVSS 6.1
  • CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
  • Input Validation and Sanitization
  • Remote

The documentation XML-RPC server in Python through 2.7.16, 3.x through 3.6.9, and 3.7.x through 3.7.4 has XSS via the server_title field. This occurs in Lib/DocXMLRPCServer.py in Python 2.x, and in Lib/xmlrpc/server.py in Python 3.x. If set_server_title is called with untrusted input, arbitrary JavaScript can be delivered to clients that visit the http URL for this server.

CVSS base score
6.1
Published
2019-09-28
OWASP
A08 Software and Data Integrity Failures
Orthogonal defect classification
Interface
Code defect classification
Incorrect Interface
Category
Input Validation and Sanitization
Subcategory
Command Injection
Accessibility scope
Remote
Impact
Information Disclosure
Affected component
Python
Fixed by upgrading
Yes

Solution

Upgrade to Python 3.7.5 or higher.

Vulnerable code sample

# Import the glob module
import glob

# Get a list of all the files in the current directory that match a pattern
# The glob.glob() function does not guarantee any order of the files
# However, the older documentation stated that it follows the rules of the Unix shell
# This might imply that the files are sorted alphabetically
files = glob.glob("*.txt")

# Process the files in some way
# For example, concatenate them into one file
# The order of the files might affect the outcome
with open("output.txt", "w") as output:
    for file in files:
        with open(file, "r") as input:
            output.write(input.read())

Patched code sample

# Import the glob module
import glob

# Get a list of all the files in the current directory that match a pattern
# The glob.glob() function does not guarantee any order of the files
# However, the newer documentation states that explicitly
# To ensure a consistent order, we can call the sort() function on the list
files = glob.glob("*.txt")
files.sort()

# Process the files in some way
# For example, concatenate them into one file
# The order of the files will not affect the outcome
with open("output.txt", "w") as output:
    for file in files:
        with open(file, "r") as input:
            output.write(input.read())

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

Cite this entry

@misc{vaitp:cve201916935,
  title        = {{XSS vulnerability in Python XML-RPC server documentation}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2019},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2019-16935},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2019-16935/}}
}

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.