VAITP Dataset

← Back to the dataset

CVE-2026-91771

Path traversal in wandb ≤ 0.28 allows arbitrary file writes via crafted filenames.

  • CVSS 8.7
  • 22
  • Input Validation and Sanitization
  • Remote

Weights & Biases wandb before 0.29.0 fails to validate the file name from server responses in the File.download function, allowing path traversal attacks. Attackers controlling the backend can supply file names with directory traversal sequences to write files outside the intended download directory, potentially enabling code execution through modification of shell startup files or Python import paths.

CWE
22
CVSS base score
8.7
Published
2026-09-15
OWASP
A05 Security Misconfiguration
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Input Validation and Sanitization
Subcategory
Path Traversal
Accessibility scope
Remote
Impact
Arbitrary Code Execution
Affected component
wandb
Fixed by upgrading
Yes

Solution

Upgrade Weights & Biases to version 0.29.0 or later, which validates file names and prevents path‑traversal downloads.

Vulnerable code sample

import os
import requests

class File:
    def __init__(self, url: str, download_dir: str):
        self.url = url
        self.download_dir = download_dir

    def download(self):
        # VULNERABLE: writes filename from server without validation, allowing path traversal
        resp = requests.get(self.url, stream=True)
        resp.raise_for_status()
        # server supplies header "X-Wandb-Filename"
        filename = resp.headers.get("X-Wandb-Filename", "download.bin")
        target_path = os.path.join(self.download_dir, filename)
        with open(target_path, "wb") as f:
            for chunk in resp.iter_content(chunk_size=8192):
                if chunk:
                    f.write(chunk)
        return target_path

Patched code sample

import os
import requests

class File:
    def __init__(self, url: str, download_dir: str):
        self.url = url
        self.download_dir = download_dir

    def download(self):
        # FIX: sanitize filename to prevent directory traversal
        resp = requests.get(self.url, stream=True)
        resp.raise_for_status()
        filename = resp.headers.get("X-Wandb-Filename", "download.bin")
        # Strip path components and ensure the result stays within download_dir
        safe_name = os.path.basename(filename)
        target_path = os.path.normpath(os.path.join(self.download_dir, safe_name))
        # Ensure the normalized path is still under download_dir
        if not os.path.commonpath([self.download_dir, target_path]) == os.path.abspath(self.download_dir):
            raise ValueError("Unsafe filename detected")
        with open(target_path, "wb") as f:
            for chunk in resp.iter_content(chunk_size=8192):
                if chunk:
                    f.write(chunk)
        return target_path

Payload

__VAITP_MODEL_REFUSED__

Cite this entry

@misc{vaitp:cve202691771,
  title        = {{Path traversal in wandb ≤ 0.28 allows arbitrary file writes via crafted filenames.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-91771},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-91771/}}
}
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 ::