/

CVE-2026-54527

Severity:

CRITICAL RISK

(9.0)

Stored XSS (CWE-79) in JupyterLab Git rename history view

CVE-2026-54527

Analyzed

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Stored Cross-Site Scripting leading to session and data compromise

Severity:

CRITICAL RISK

(9.0)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A stored cross-site scripting (XSS) vulnerability in JupyterLab Git allows malicious JavaScript to execute when viewing commit history for renamed files.

By crafting a specially formatted filename in a Git repository, an attacker can run code in the victim's browser when they open the Git History tab and view the rename diff.

Affected context

This vulnerability appears in JupyterLab environments that use the JupyterLab Git extension between versions 0.30.0b3 and 0.53.x.

It specifically occurs when the Git History tab renders rename diffs and the PlainTextDiff.ts createHeader() method injects Git filenames directly into innerHTML without sanitization.

Any workflow where users browse commit history for renamed files in projects that may contain untrusted filenames is potentially exposed.

Exploit preconditions

  • Attack surface: JupyterLab Git UI, specifically the Git History tab showing renamed files.
  • Required access: Ability to create or push commits with filenames controlled by the attacker into a repository that a victim later opens in JupyterLab.
  • Trigger point: Victim user opens the JupyterLab Git History tab and selects a commit containing a rename with a crafted filename so that createHeader() renders it.
  • Why exploitation is possible: The component uses innerHTML with unsanitized filename data, allowing attacker-controlled HTML/JavaScript to be interpreted by the browser instead of treated as plain text.

Why this happens

The underlying issue is improper neutralization of user-controlled data before inserting it into the DOM, aligning with CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-site Scripting).

The PlainTextDiff.ts createHeader() function uses innerHTML to render Git filenames in the rename header, assuming filenames are trustworthy.

Because Git metadata can be influenced by attackers (for example, via cloned or shared repositories), treating filenames as HTML creates an injection point where script code is executed in the context of the JupyterLab origin.

Potential impact

  • Execution of arbitrary JavaScript in the victim's browser while using JupyterLab Git.
  • Theft or misuse of session information and authentication tokens accessible to the page.
  • Unauthorized actions in JupyterLab on behalf of the victim (e.g., manipulating files, triggering notebook executions via UI interactions).
  • Exposure of sensitive project data visible in the Jupyter environment, including code, outputs, and configuration details.
  • Lateral movement within the browser context, such as pivoting to other tabs or services that trust the same authentication state, where applicable.

General mitigation guidance

Effective mitigation focuses on treating all Git-derived metadata, including filenames, as untrusted and rendering it safely in the UI.

Common defensive patterns include:

  • Avoiding direct use of innerHTML for dynamic content; instead, use text-only DOM APIs (e.g., textContent, text nodes, or template bindings that escape by default).
  • Applying robust output encoding for any content inserted into the DOM when HTML rendering is truly required, tailored to the specific context (HTML, attribute, URL, etc.).
  • Centralizing HTML-escaping utilities and enforcing their usage for all user-controlled or external data paths in UI components.
  • Adopting secure-by-default component patterns where templating engines or frameworks escape data automatically unless explicitly overridden.
  • Minimizing the privilege of web components by limiting access to sensitive APIs and strongly separating display logic from security-relevant operations.

How teams detect issues like this

Detection can focus on both code-level patterns and runtime behavior:

  • Static analysis rules that flag uses of innerHTML, outerHTML, insertAdjacentHTML, or similar DOM sinks when fed with variables derived from external sources (e.g., Git metadata, network responses).
  • Code review checklists that explicitly require developers to justify any non-escaped HTML insertion and confirm proper encoding or sanitization.
  • Linting and type-checking rules within the front-end codebase that discourage or forbid direct HTML injection without going through approved, safe wrappers.
  • Browser-focused security testing that attempts to inject XSS payloads into fields like filenames, commit messages, and branches, verifying that rendered UI treats them as plain text.
  • Integration of automated SAST/DAST tools into CI pipelines to scan for known XSS patterns and regressions in UI components.

Sources

SourceLink
github.comgithub.com/jupyterlab/jupyterlab-git/commit/c6d37b88f36aa59aee317930b95e427fb9d6b09b
github.comgithub.com/jupyterlab/jupyterlab-git/releases/tag/v0.54.0
github.comgithub.com/jupyterlab/jupyterlab-git/security/advisories/GHSA-f962-v9hr-pfg5

Frequently asked

questions

This vulnerability is exploitable wherever developers or users open repositories in JupyterLab with the affected Git extension and view commit history for renamed files. Any user who interacts with an attacker-controlled repository in this way can have arbitrary JavaScript executed in their browser.

The attacker needs the ability to introduce crafted filenames into a Git repository that a victim later opens in JupyterLab. This can occur through shared repositories, pull requests, or cloned projects; no direct access to the victim's Jupyter environment is required beyond the victim viewing the history.

The safest pattern is to eliminate HTML injection by avoiding innerHTML for filenames and other external data, rendering them as text via textContent or equivalent safe bindings, and ensuring all UI components treat Git metadata as untrusted input.

Prevention relies on adopting a secure rendering model where all external or user-controllable data is encoded before insertion into the DOM, backed by coding standards, linting rules, security-focused code reviews, and automated analysis that flag dangerous DOM sinks and unescaped HTML operations.

Find out what's already
exploitable in your codebase.