VAITP Dataset

← Back to the dataset

CVE-2026-110636

OS command injection in pypdftk via crafted pdf_path/out_file arguments.

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

pypdftk through 0.5 contains an OS command injection vulnerability in fill_form(), dump_data_fields(), and pdftk_cmd_util() that builds shell commands from caller-supplied paths. Attackers controlling pdf_path or out_file can inject shell metacharacters interpreted by subprocess.Popen with shell=True to execute OS commands as the Python process.

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

Solution

Upgrade pypdftk to version 0.6 or newer, which removes the shell=True calls and sanitizes pdf_path and out_file to eliminate the OS command injection.

Vulnerable code sample

import subprocess
import os

def fill_form(pdf_path: str, data_file: str, out_file: str) -> None:
    """
    Fill a PDF form using pdftk.
    """
    # VULNERABLE: builds command with untrusted paths and uses shell=True
    cmd = f"pdftk \"{pdf_path}\" fill_form \"{data_file}\" output \"{out_file}\""
    subprocess.Popen(cmd, shell=True).wait()

Patched code sample

import subprocess
import os
import shlex

def fill_form(pdf_path: str, data_file: str, out_file: str) -> None:
    """
    Fill a PDF form using pdftk.
    """
    # FIX: avoid shell=True and quote arguments safely
    cmd = [
        "pdftk",
        pdf_path,
        "fill_form",
        data_file,
        "output",
        out_file,
    ]
    subprocess.Popen(cmd, shell=False).wait()

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:cve2026110636,
  title        = {{OS command injection in pypdftk via crafted pdf_path/out_file arguments.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-110636},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-110636/}}
}

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.