VAITP Dataset

← Back to the dataset

CVE-2026-108258

Path traversal in Shiny for Python bookmark restore allows reading arbitrary files.

  • CVSS 6.9
  • CWE-22
  • Input Validation and Sanitization
  • Remote

Shiny for Python is a framework for building interactive web applications in Python. From 1.4.0 until 1.6.4, bookmark restore accepts a client-supplied state_id and joins it into the server-side shiny_bookmarks directory without validating that it is a single safe path segment. An unauthenticated request can use parent-directory segments or an absolute path to make the server open input.json and values.json outside the bookmark store, even when bookmark_store is set to disable. In applications configured with bookmark_store set to server and using ui.input_file(), the restore handler can additionally copy and expose an attacker-selected file from an attacker-selected directory. This issue is fixed in version 1.6.4.

CVSS base score
6.9
Published
2026-10-09
OWASP
A04 Insecure Design
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
shiny
Fixed by upgrading
Yes

Solution

Upgrade Shiny for Python to version 1.6.4 or later.

Vulnerable code sample

import os
from shiny import App, ui, server

BASE_BOOKMARK_DIR = "/var/shiny_bookmarks"

def restore_bookmark(state_id: str):
    # VULNERABLE: joins client-supplied state_id without validation
    bookmark_path = os.path.join(BASE_BOOKMARK_DIR, state_id)
    with open(os.path.join(bookmark_path, "input.json"), "r") as f:
        input_data = f.read()
    with open(os.path.join(bookmark_path, "values.json"), "r") as f:
        values_data = f.read()
    return {"input": input_data, "values": values_data}

Patched code sample

import os
from shiny import App, ui, server

BASE_BOOKMARK_DIR = "/var/shiny_bookmarks"

def restore_bookmark(state_id: str):
    # FIX: validate state_id to be a single safe path segment
    safe_state = os.path.basename(state_id)
    bookmark_path = os.path.join(BASE_BOOKMARK_DIR, safe_state)
    with open(os.path.join(bookmark_path, "input.json"), "r") as f:
        input_data = f.read()
    with open(os.path.join(bookmark_path, "values.json"), "r") as f:
        values_data = f.read()
    return {"input": input_data, "values": values_data}

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.

  • Merge commit from fork (posit-dev/py-shiny)
    shiny/bookmark/_bookmark.py · BookmarkApp._create_effects, shiny/bookmark/_bookmark_state.py, shiny/bookmark/_bookmark_state.py · _local_dir, shiny/bookmark/_restore_state.py, shiny/bookmark/_restore_state.py · RestoreContext.from_query_string, shiny/bookmark/_restore_state.py · RestoreContext._decode_state_qs, shiny/bookmark/_restore_state.py · RestoreContext._load_state_qs, shiny/input_handler.py, shiny/input_handler.py · _#7, shiny/_app.py · App._on_root_request_cb

Cite this entry

@misc{vaitp:cve2026108258,
  title        = {{Path traversal in Shiny for Python bookmark restore allows reading arbitrary files.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-108258},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-108258/}}
}

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.