Skip to content
XSS Disclosed report Intermediate CVE-2026-6658

jupyter/nbconvert allows Cross-site Scripting (XSS) via unsanitized `text/vnd.mermaid` output in HTML exports

The nbconvert HTML export template renders Mermaid cell output without escaping, so an attacker can inject HTML or JavaScript by breaking out of the pre tag. Anyone viewing the exported HTML could have arbitrary JavaScript run in their browser.

nbconvert

Originally disclosed on huntr

A vulnerability in jupyter/nbconvert versions <= 7.17.0 allows for Cross-site Scripting (XSS) via unsanitized text/vnd.mermaid output in HTML exports. The data_mermaid block in share/templates/lab/base.html.j2 renders text/vnd.mermaid cell output directly into HTML without escaping, enabling attackers to inject arbitrary HTML/JavaScript by breaking out of the <pre> tag. This vulnerability impacts any server using nbconvert to render notebooks as HTML, allowing attackers to execute arbitrary JavaScript in the context of users viewing the HTML export.

From the GitHub Advisory Database (GHSA-9754-6rhw-gj3h, CC BY 4.0).

The original report as published on the GitHub Advisory Database. Images and videos are our own copies; raw HTML is shown as text. View it on GitHub Advisory Database.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The template inserts the Mermaid output into the HTML without escaping it, so special characters can close the surrounding tag and add new markup or script.

Impact

An attacker could execute arbitrary JavaScript in the context of users viewing the HTML export, which could lead to actions being taken as those users.

What the attacker needed

Victim opens an exported HTML notebook; notebook contains malicious Mermaid output

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When a notebook is turned into a web page, some cell output is meant to be a diagram (Mermaid). The tool put that text straight into the page without cleaning it, so a malicious notebook could include code that runs in the browser of whoever opens the exported page.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.