VAITP Dataset

← Back to the dataset

CVE-2019-17514

Potentially misleading information in Python documentation

  • CVSS 7.5
  • CWE-682: Incorrect Calculation
  • Information Leakage
  • Local

library/glob.html in the Python 2 and 3 documentation before 2016 has potentially misleading information about whether sorting occurs, as demonstrated by irreproducible cancer-research results. NOTE: the effects of this documentation cross application domains, and thus it is likely that security-relevant code elsewhere is affected. This issue is not a Python implementation bug, and there are no reports that NMR researchers were specifically relying on library/glob.html. In other words, because the older documentation stated "finds all the pathnames matching a specified pattern according to the rules used by the Unix shell," one might have incorrectly inferred that the sorting that occurs in a Unix shell also occurred for glob.glob. There is a workaround in newer versions of Willoughby nmr-data_compilation-p2.py and nmr-data_compilation-p3.py, which call sort() directly.

CVSS base score
7.5
Published
2019-10-12
OWASP
A04 Insecure Design
Orthogonal defect classification
Interface
Code defect classification
Incorrect Interface
Category
Information Leakage
Subcategory
Insecure Handling of Sensitive Data
Accessibility scope
Local
Impact
Information Disclosure
Fixed by upgrading
Yes

Solution

Update the Python documentation to clarify that glob.glob does not guarantee sorting and recommend using sorted(glob.glob(…)) for sorted results.

Vulnerable code sample

import glob

files = glob.glob("*.txt")

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 glob
import os

files = glob.glob("*.txt")

valid_files = [f for f in files if os.path.isfile(f) and os.access(f, os.R_OK)]

with open("output.txt", "w") as output:
    for file in valid_files:
        try:
            with open(file, "r") as input:
                output.write(input.read())
        except Exception as e:
            print(f"Error reading file {file}: {e}")

Cite this entry

@misc{vaitp:cve201917514,
  title        = {{Potentially misleading information in Python documentation}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2019},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2019-17514},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2019-17514/}}
}
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 ::