VAITP Dataset

← Back to the dataset

CVE-2026-110650

OS command injection in thumbnail <= 1.5 via crafted file paths in generate_thumbnail().

  • CVSS 9.3
  • CWE-78
  • Input Validation and Sanitization
  • Remote

The thumbnail Python package through 1.5 contains an OS command injection vulnerability in generate_thumbnail() that allows attackers to execute commands by supplying shell metacharacters in file paths. Attackers who control a file name passed to generate_thumbnail, such as an uploaded file, can inject commands into os.system() calls running ffmpeg, convert or unoconv with the Python process privileges.

CVSS base score
9.3
Published
2026-10-14
OWASP
A03 Injection
Orthogonal defect classification
Interface
Code defect classification
Missing Check
Category
Input Validation and Sanitization
Subcategory
Command Injection
Accessibility scope
Remote
Impact
Arbitrary Code Execution
Affected component
thumbnail
Fixed by upgrading
Yes

Solution

Upgrade the thumbnail package to version 1.6 or newer, which removes the unsafe os.system() calls.

Vulnerable code sample

import os
from typing import Optional

def generate_thumbnail(input_path: str, output_path: str, size: Optional[str] = None) -> None:
    """
    Generate a thumbnail for a given file using external tools.
    """
    # Determine which tool to use based on file extension
    _, ext = os.path.splitext(input_path.lower())
    if ext in {'.pdf', '.doc', '.docx'}:
        # Use unoconv for documents
        cmd = f"unoconv -f pdf \"{input_path}\" && ffmpeg -i \"{input_path}.pdf\" -vf \"scale={size or '200:-1'}\" \"{output_path}\""
    else:
        # Use ffmpeg directly for media files
        cmd = f"ffmpeg -i \"{input_path}\" -vf \"scale={size or '200:-1'}\" \"{output_path}\""
    # VULNERABLE: unsanitized input_path allows command injection
    os.system(cmd)

Patched code sample

import os
import shlex
from typing import Optional

def generate_thumbnail(input_path: str, output_path: str, size: Optional[str] = None) -> None:
    """
    Generate a thumbnail for a given file using external tools.
    """
    # Determine which tool to use based on file extension
    _, ext = os.path.splitext(input_path.lower())
    if ext in {'.pdf', '.doc', '.docx'}:
        # Use unoconv for documents
        # FIX: safely quote arguments to prevent injection
        unoconv_cmd = ["unoconv", "-f", "pdf", input_path]
        os.system(" ".join(map(shlex.quote, unoconv_cmd)) + f" && ffmpeg -i {shlex.quote(input_path)}.pdf -vf scale={shlex.quote(size or '200:-1')} {shlex.quote(output_path)}")
    else:
        # Use ffmpeg directly for media files
        # FIX: safely quote arguments to prevent injection
        ffmpeg_cmd = ["ffmpeg", "-i", input_path, "-vf", f"scale={size or '200:-1'}", output_path]
        os.system(" ".join(map(shlex.quote, ffmpeg_cmd)))

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:cve2026110650,
  title        = {{OS command injection in thumbnail <= 1.5 via crafted file paths in generate_thumbnail().}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-110650},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-110650/}}
}

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.