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

CVE-2026-111059: Mercury Framework XSS Vulnerability

CVE-2026-111059 is a cross-site scripting flaw in Mercury Python framework that allows attackers to inject malicious HTML through unsanitized Markdown conversion. 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-111059 Overview

CVE-2026-111059 is a stored Cross-Site Scripting (XSS) vulnerability in Mercury, a Python framework that converts Jupyter notebooks into interactive web applications and dashboards. Versions 3.0.0 through 3.2.10 are affected. The mr.Markdown component converts attacker-controlled Markdown into HTML and assigns the result to an ipywidgets.HTML sink without sanitizing raw HTML. Event-handler attributes and other active HTML markup can therefore reach the DOM and execute when another user views the application. The issue is tracked under CWE-79 and resolved in version 3.2.11.

Critical Impact

Authenticated or anonymous Markdown input is rendered to any viewer's browser, enabling session hijacking, credential theft, and arbitrary JavaScript execution within the Mercury application context.

Affected Products

  • Mercury (mljar/mercury) versions 3.0.0 through 3.2.10
  • Jupyter notebook applications published via Mercury using the mr.Markdown component
  • Multi-user Mercury deployments that render user-submitted or shared Markdown content

Discovery Timeline

  • 2026-10-19 - CVE-2026-111059 published to NVD
  • 2026-10-20 - Last updated in NVD database

Technical Details for CVE-2026-111059

Vulnerability Analysis

Mercury's mr.Markdown widget accepts Markdown text, converts it to HTML using the Python markdown library, and then assigns the output to an ipywidgets.HTML widget. The ipywidgets.HTML sink treats its value as trusted HTML and injects it directly into the browser DOM. Because Markdown allows inline HTML passthrough, an attacker can embed tags such as <img onerror=...>, <svg onload=...>, or <iframe srcdoc=...> inside Markdown payloads. When another user loads the Mercury application, the browser parses and executes the embedded handlers. The attacker's script runs in the victim's origin and can read authenticated session cookies, exfiltrate dashboard data, or pivot to other application endpoints.

Root Cause

The root cause is missing output sanitization between Markdown-to-HTML conversion and HTML widget rendering. Mercury relied on the Markdown converter alone, which preserves raw HTML by design. No HTML sanitizer stripped event-handler attributes, <script> elements, or dangerous URL schemes before the HTML reached the ipywidgets.HTML sink.

Attack Vector

An attacker supplies Markdown containing active HTML through any Mercury input surface that feeds mr.Markdown, such as chat messages, shared notebook content, or widget parameters. The attack requires user interaction, meaning a second user must view the rendered output. Because the rendered content crosses user boundaries within the Mercury application, the scope is changed and the payload executes with the victim's privileges.

python
# Patch excerpt from mercury/chat/message.py
# Source: https://github.com/mljar/mercury/commit/c798a85924e6614c6fea7afe5a560e4554a1d09b
from IPython.display import display, HTML as DHTML, Javascript, Markdown

from ..theme import THEME
from .._markdown import render_markdown

MSG_CSS_CLASS = "mljar-chat-msg"
DEFAULT_EMOJI_BACKGROUND = "#e5e7eb"

The fix routes Markdown through a new centralized render_markdown helper, and pyproject.toml adds the nh3 HTML sanitizer as a required dependency:

text
# Patch excerpt from pyproject.toml
# Source: https://github.com/mljar/mercury/commit/c798a85924e6614c6fea7afe5a560e4554a1d09b
"anywidget>=0.9.0",
"toml",
"markdown",
"nh3>=0.3.2,<0.4",
"pandas"

Detection Methods for CVE-2026-111059

Indicators of Compromise

  • Markdown content stored or transmitted to Mercury that contains inline <script>, on*= event handlers, javascript: URIs, or <iframe srcdoc=...> payloads.
  • Browser console errors or unexpected outbound requests originating from the Mercury application origin when viewing shared notebooks or chat messages.
  • Mercury server logs showing POST or WebSocket traffic from untrusted clients containing HTML tags inside Markdown fields.

Detection Strategies

  • Inspect stored Markdown fields in Mercury datastores for raw HTML tags and event-handler attributes using regex searches such as on\w+\s*= or <script.
  • Enable Content Security Policy (CSP) report-only mode in the reverse proxy fronting Mercury to surface inline script executions attributable to this flaw.
  • Correlate Mercury process versions with the mercury package metadata to identify instances running versions prior to 3.2.11.

Monitoring Recommendations

  • Monitor outbound network connections from browsers accessing Mercury dashboards for beacons to unknown domains that may indicate cookie or token exfiltration.
  • Audit changes to shared notebooks and chat messages, and alert on content containing HTML markup that is not expected in normal Markdown workflows.
  • Track installed Mercury package versions across Python environments and flag any installation below 3.2.11.

How to Mitigate CVE-2026-111059

Immediate Actions Required

  • Upgrade Mercury to version 3.2.11 or later across every environment that renders Markdown through mr.Markdown.
  • Audit existing stored Markdown content and remove or neutralize any entries containing raw HTML, inline scripts, or event-handler attributes.
  • Rotate session tokens and API credentials used by Mercury accounts if logs indicate exposure to malicious Markdown payloads.

Patch Information

The vendor fix is published in GitHub Release v3.2.11 and the patch commit c798a85. The fix introduces the nh3 HTML sanitizer (nh3>=0.3.2,<0.4) and routes Markdown output through a centralized render_markdown helper before it reaches any ipywidgets.HTML sink. Full details are in GitHub Security Advisory GHSA-2658-85cv-9wwq.

Workarounds

  • Restrict Mercury application access to trusted authors only, preventing untrusted users from submitting Markdown content until the patch is applied.
  • Deploy a strict Content Security Policy that disallows inline scripts and event handlers for Mercury endpoints.
  • Pre-process Markdown input server-side with an HTML sanitizer such as nh3 or bleach before storing or forwarding it to the mr.Markdown component.
bash
# Upgrade Mercury to the patched version
pip install --upgrade "mercury>=3.2.11"

# Verify the installed version
python -c "import mercury; print(mercury.__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.