Skip to main content
Vulnerability Database/CVE-2026-114140

CVE-2026-114140: Jupyter nbconvert Path Traversal Vulnerability

CVE-2026-114140 is a path traversal flaw in Jupyter nbconvert that allows attackers to write files to arbitrary locations when converting malicious notebooks. This post explains its impact, affected versions, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-114140 Overview

CVE-2026-114140 is a path traversal vulnerability [CWE-22] in Jupyter nbconvert, the tool that converts Jupyter notebooks into other formats using Jinja templates. Affected versions range from 5.4.0 through 7.17.1. The flaw resides in ExtractOutputPreprocessor within nbconvert/preprocessors/extractoutput.py, which joins attacker-controlled cell output metadata filenames to output_files_dir without restricting the result to the intended directory. A victim who converts a malicious notebook using the markdown, LaTeX, reStructuredText, or AsciiDoc exporter can have attacker-controlled output written to arbitrary filesystem locations accessible to their user account.

Critical Impact

Converting a malicious notebook can write arbitrary files to any location the victim user can access, enabling code placement, configuration tampering, and privilege escalation paths.

Affected Products

  • Jupyter nbconvert versions 5.4.0 through 7.17.1
  • Markdown, LaTeX, reStructuredText, and AsciiDoc exporters
  • Downstream tools and services that invoke nbconvert for notebook conversion

Discovery Timeline

  • 2026-10-21 - CVE-2026-114140 published to NVD
  • 2026-10-22 - Last updated in NVD database

Technical Details for CVE-2026-114140

Vulnerability Analysis

The ExtractOutputPreprocessor extracts binary outputs (images, attachments) from notebook cells and writes them to disk alongside the converted document. The preprocessor reads a filename string directly from each cell's output metadata and joins it to the configured output_files_dir. Because the join operation does not strip directory components or validate the resolved path, a filename containing ../ sequences or an absolute path escapes the intended output directory.

An attacker who crafts a notebook with poisoned output metadata can therefore place arbitrary bytes at any filesystem location the converting user can write to. Target paths include shell startup files, SSH authorized_keys, Python site-packages, cron entries, or application configuration. The vulnerability is reachable through pure conversion, so no cell execution is required. Re-executing the notebook cell replaces the malicious metadata, but merely running jupyter nbconvert on an untrusted notebook triggers the write.

Root Cause

The root cause is missing sanitization of the out.metadata["filename"] value before it is concatenated to output_files_dir. The code trusted notebook-supplied metadata as a safe basename, violating the principle of treating all externally sourced path components as untrusted input.

Attack Vector

Exploitation requires a victim to convert an attacker-supplied .ipynb file using one of the vulnerable exporters. Notebooks are commonly shared through email, Git repositories, data science collaboration platforms, and automated pipelines, giving attackers multiple delivery channels. User interaction is required, and the attacker must be able to influence a notebook that the victim converts locally or in a service pipeline.

python
                     if ext is None:
                         ext = "." + mime_type.rsplit("/")[-1]
                     if out.metadata.get("filename", ""):
-                        filename = out.metadata["filename"]
+                        fname = out.metadata["filename"]
+                        # Sanitize: use only the basename to prevent path traversal
+                        filename = os.path.basename(fname)
+                        if not filename:
+                            self.log.warning(
+                                "Output filename '%s' is invalid (empty basename), skipping",
+                                fname,
+                            )
+                            continue
+                        if filename != fname:
+                            self.log.warning(
+                                "Output filename '%s' contained path components, "
+                                "using basename '%s'",
+                                fname,
+                                filename,
+                            )
                         if not filename.endswith(ext):
                             filename += ext
                     else:

Source: GitHub commit ce4bd99. The patch replaces the raw metadata filename with os.path.basename(fname), discarding any directory components before use.

Detection Methods for CVE-2026-114140

Indicators of Compromise

  • Files written outside the configured output_files_dir during or shortly after an nbconvert run.
  • Notebook JSON containing metadata.filename values with ../, backslashes, or absolute paths in cell outputs.
  • Unexpected modifications to shell dotfiles, SSH authorized keys, or Python packages on workstations and build servers that convert notebooks.

Detection Strategies

  • Scan .ipynb files in repositories and inboxes for output metadata filenames that contain path separators or traversal sequences.
  • Instrument CI/CD jobs that run jupyter nbconvert to log all file writes outside the designated output directory.
  • Review process ancestry linking jupyter, nbconvert, or python -m nbconvert to writes in sensitive directories such as ~/.ssh, ~/.config, or system paths.

Monitoring Recommendations

  • Enable filesystem auditing on hosts and containers that process untrusted notebooks and alert on writes outside expected working directories.
  • Track installed nbconvert versions across developer endpoints and data science infrastructure to confirm patch coverage.
  • Monitor Git commits and pull requests that introduce notebooks with non-trivial output metadata filenames.

How to Mitigate CVE-2026-114140

Immediate Actions Required

  • Upgrade nbconvert to version 7.17.2 or later on every system that converts notebooks, including developer workstations, Jupyter servers, and CI pipelines.
  • Audit shared notebooks and notebook pipelines for malicious output metadata before converting.
  • Treat all externally sourced .ipynb files as untrusted input and convert them only inside isolated, non-privileged environments.

Patch Information

The fix is included in nbconvert 7.17.2. Technical details are documented in GitHub Security Advisory GHSA-pjvx-prjx-h659 and the v7.17.2 release notes. The patch sanitizes out.metadata["filename"] with os.path.basename() and skips outputs whose basename is empty.

Workarounds

  • Pre-process untrusted notebooks to strip or normalize metadata.filename fields on every output cell before conversion.
  • Run jupyter nbconvert as a dedicated low-privilege user inside a container or sandbox that restricts writable paths to a scratch directory.
  • Avoid using the markdown, LaTeX, reStructuredText, and AsciiDoc exporters on untrusted notebooks until the upgrade is applied.
bash
# Upgrade nbconvert to the fixed release
pip install --upgrade "nbconvert>=7.17.2"

# Verify the installed version
python -c "import nbconvert; print(nbconvert.__version__)"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.