VAITP Dataset

← Back to the dataset

CVE-2026-31831

Tautulli < 2.17.0 allows unauthenticated file read via path traversal.

  • CVSS 8.7
  • CWE-23
  • Input Validation and Sanitization
  • Remote

Tautulli is a Python based monitoring and tracking tool for Plex Media Server. Prior to version 2.17.0, the /newsletter/image/images API endpoint is vulnerable to path traversal, allowing unauthenticated attackers to read arbitrary files from the application server's filesystem. This issue has been patched in version 2.17.0.

CVSS base score
8.7
Published
2026-03-30
OWASP
A01 Broken Access Control
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Input Validation and Sanitization
Subcategory
Path Traversal
Accessibility scope
Remote
Impact
Information Disclosure
Affected component
Tautulli
Fixed by upgrading
Yes

Solution

Upgrade Tautulli to version 2.17.0 or later.

Vulnerable code sample

import os
from flask import Flask, send_file, abort

app = Flask(__name__)

# This is a representative example of the vulnerable code pattern.
# The actual base path may differ.
NEWSLETTER_IMAGE_BASE_PATH = '/app/data/newsletter_images/'

@app.route('/newsletter/image/images/<path:filename>')
def get_newsletter_image(filename):
    # VULNERABILITY: The user-supplied 'filename' is directly joined with
    # a base path without any sanitization. An attacker can use '..'
    # sequences to traverse the filesystem and access arbitrary files.
    # Example malicious request: GET /newsletter/image/images/../../../../../etc/passwd
    image_path = os.path.join(NEWSLETTER_IMAGE_BASE_PATH, filename)

    # The application proceeds to serve the file from the constructed path.
    # The check for existence happens on the potentially malicious path.
    if not os.path.isfile(image_path):
        abort(404, description="Image not found.")

    try:
        return send_file(image_path)
    except Exception:
        abort(500, description="Error reading file.")

Patched code sample

import os
import werkzeug.utils

def get_safe_newsletter_image_path(base_directory, unsafe_filename):
    """
    Represents the patched logic to prevent path traversal.

    The vulnerability existed because `unsafe_filename` was directly joined with
    the base directory path. An attacker could provide a filename like
    '../../../../etc/passwd' to read arbitrary files.

    The fix involves sanitizing the filename to remove any directory components
    before joining it with the base path. This ensures that the file access
    is restricted to the intended `base_directory`. The werkzeug.utils.secure_filename
    is a robust way to achieve this, but os.path.basename achieves a similar goal
    by stripping directory information.
    
    Args:
        base_directory (str): The trusted root directory where images are stored.
        unsafe_filename (str): The untrusted filename from user input.

    Returns:
        str: A safe, absolute file path that is confirmed to be within the
             base_directory. Returns the base_directory path if filename is malicious.
    """
    # FIX: Sanitize the user-provided filename to remove directory traversal
    # characters and sequences. werkzeug.utils.secure_filename is a common
    # and robust method in web applications for this purpose.
    # An input like '../../../../etc/passwd' becomes 'etc_passwd'.
    safe_filename = werkzeug.utils.secure_filename(unsafe_filename)

    # Construct the full path using the now-safe filename.
    safe_filepath = os.path.join(base_directory, safe_filename)

    # For added security (defense-in-depth), resolve the real path and check
    # if it is truly within the intended base directory.
    if os.path.commonprefix((os.path.realpath(safe_filepath), os.path.realpath(base_directory))) != os.path.realpath(base_directory):
        # If the path somehow escaped, do not proceed.
        # This could happen if secure_filename has a flaw or is bypassed.
        return os.path.realpath(base_directory)

    # The resulting path is now safe to use for file operations.
    return safe_filepath

Payload

/newsletter/image/images/../../../../../../../../etc/passwd

Cite this entry

@misc{vaitp:cve202631831,
  title        = {{Tautulli < 2.17.0 allows unauthenticated file read via path traversal.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-31831},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-31831/}}
}
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 ::