Skip to main content
Menu
Advisories

Path traversal in JupyterLab's HTML viewer let one click in a crafted file trust a notebook

GHSA-F74X-HGWM-2849Published Updated GitHub

Description

JupyterLab's HTML viewer gives each file a base URL under the server's file endpoint, and that URL carries the user's XSRF token. A crafted file name could make that base URL point at another server endpoint, such as the one that marks a notebook as trusted. One click on a link in the file then trusted a notebook from the attacker, and its script ran when the user opened it.

Users are affected if all of the following conditions are true:

  • they run JupyterLab 3.0.0 to 4.6.6, or an application that bundles it such as Notebook 7;
  • they use a browser that sends hyperlink pings, such as Chrome or another Chromium-based browser; and
  • a folder they open in JupyterLab holds files from someone else, such as a cloned repository, an unpacked archive or a shared folder, and that person knows the path of the folder below the server's root directory.

The attack then needs the user to do three things, in this order:

  1. Open the crafted file in the HTML viewer. Double-clicking a workspace file (.jupyterlab-workspace) from the same person does this, and so does a link that opens the file in the viewer (JupyterLab 4.7.0b1 and later).
  2. Click a link in that file.
  3. Open that person's notebook.

Firefox sends hyperlink pings only when browser.send_pings is set to true in about:config, so Firefox users who keep the default (false) are not affected.

Impact

The notebook was marked as trusted although the user neither ran nor trusted it. When the user opened it, its saved output ran script in the JupyterLab page, with the user's access to the Jupyter Server REST API: read and write files, start kernels and run code in them, and open terminals where terminals are enabled. The same click could also reach other server endpoints, for example to stop the server.

Patches

JupyterLab 4.6.7 and 4.7.0rc0 contain the patch. No 4.5.x release with the fix is planned, so users of JupyterLab 4.5 and earlier should upgrade to 4.6.7. The HTML viewer now escapes the path of the file before it gets the base URL from the URL resolver, so the base URL is the address of that file under /files/.

Notebook bundles its own copy of the affected code, so Notebook users need to update notebook to 7.6.6 (or 7.7.0rc0 for pre-releases) as well as jupyterlab. Users of other applications that depend on JupyterLab should update the jupyterlab package too. Applications built from the npm packages get the fix in @jupyterlab/services 7.6.7 and 7.7.0-rc.0.

Workarounds

Until you have upgraded, open HTML files and workspace files from other people in Firefox, which does not send hyperlink pings unless browser.send_pings is set to true in about:config.

Administrators can turn the HTML viewer off by disabling its plugin:

jupyter labextension disable @jupyterlab/htmlviewer-extension:plugin

Confirm that @jupyterlab/htmlviewer-extension:plugin is disabled by running:

jupyter labextension list

HTML files then open in the text editor, and no file is shown as a web page.

References

Published in the same release:

Acknowledgments

Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-OSZQH6D4.

Affected versions

References

GitHub · jupyterlab/jupyterlab