Skip to main content
Menu
Advisories

Cross-site scripting (XSS) in JupyterLab via an imported settings file or a language pack's translations

GHSA-W3JJ-J4C7-FXHJPublished Updated GitHub

Description

JupyterLab built the placeholder text of the Contextual Help panel and of the JSON Settings Editor's error pane as HTML from translated interface strings, without escaping them. A settings file that adds a prefix to every translated string (the stringsPrefix setting), or a language pack with changed translations, could therefore put a script into that placeholder, and JupyterLab ran it when either panel was shown.

Users are affected if both 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; and
  • one of these applies:
  • they imported a settings file written by someone else through Settings > Settings Editor > Import (JupyterLab 4.4.0 and later);
  • they use a language pack whose translations someone else changed, with that language selected.

The script then runs as soon as the Settings Editor or Contextual Help shows its placeholder: at the next page load after an import, because the Settings Editor is still open then, or when the user opens either panel.

Impact

The script ran in the JupyterLab page, in the same origin and session as the user. It could use the Jupyter Server REST API as the user: read and write files, start kernels and run code in them, and open terminals where terminals are enabled.

Imported settings file

Nothing ran at import time. The script ran at the next page load if the Settings Editor was still open, which it is after an import unless the user closes it, and otherwise when the user opened the Settings Editor or Contextual Help. After the reload every translated label in the interface started with the prefix text, so the change was visible. By then the script had usually run, and opening the Settings Editor to undo the change ran it too. The attacker needs no account on the server, but nothing happens without the user's import.

Language pack

A language pack is a Python package, and installing one is already a privileged act: whoever can get a package installed can run code on the server without this issue. Translations are different, because they are reviewed as text: they reach the language packs through the translation pipeline from Crowdin. Anyone able to change the translation of one of the three placeholder strings could run script in the page of every user who selected that language and then opened Contextual Help or the JSON Settings Editor.

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 placeholder is now built as text, so neither a translation nor the prefix is parsed as HTML. The Settings Editor also refuses a strings prefix that contains <, > or &. An extension that passed HTML as a string initialContent to InspectorPanel now gets it shown as text; it can pass a widget instead.

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.

Workarounds

Do not import settings files from other people until you have upgraded. Unticking a section on the import screen in the versions up to and including 4.6.6 did not work correctly, so that is not sufficient.

On Linux and macOS, print your translation settings to check whether a past import turned the prefix on:

cat "$(jupyter lab path | awk -F': ' '/User Settings directory/ {print $2}')/@jupyterlab/translation-extension/plugin.jupyterlab-settings"

On Windows, run jupyter lab path, then open the file @jupyterlab\translation-extension\plugin.jupyterlab-settings with a text editor, in the User Settings directory that the command prints.

If the file does not exist, or it does not set displayStringsPrefix to true, the prefix is off. Otherwise, delete the stringsPrefix and displayStringsPrefix entries, then reload JupyterLab.

Administrators can remove both panels that show the placeholder, which also closes the language pack route, by disabling the plugins that provide them:

jupyter labextension disable @jupyterlab/inspector-extension:inspector
jupyter labextension disable @jupyterlab/settingeditor-extension:plugin

Confirm that both plugins are disabled by running:

jupyter labextension list

This removes Contextual Help, the JSON Settings Editor, and the Import and Export buttons. The form-based Settings Editor keeps working.

References

Acknowledgments

Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-N913JUF0. Also reported by @adityasunny06help-coder and @rexpository

Affected versions

References

GitHub · jupyterlab/jupyterlab