VAITP Dataset

← Back to the dataset

CVE-2026-111059

XSS via unsanitized Markdown in Mercury < 3.2.11 allowing HTML injection.

  • CVSS 6.1
  • CWE-79
  • Input Validation and Sanitization
  • Remote

Mercury is a Python framework for sharing Jupyter notebooks as web applications and dashboards. From 3.0.0 until 3.2.11, mr.Markdown converts attacker-controlled Markdown to HTML without sanitizing raw HTML before assigning it to an ipywidgets.HTML sink. Event-handler attributes and other active HTML can therefore reach the DOM and execute when another user views the application. This issue is fixed in version 3.2.11.

CVSS base score
6.1
Published
2026-10-19
OWASP
A03 Injection
Orthogonal defect classification
Assignment
Code defect classification
Incorrect Assignment
Category
Input Validation and Sanitization
Subcategory
Insecure Parsing or Deserialization
Accessibility scope
Remote
Impact
Arbitrary Code Execution
Affected component
Python
Fixed by upgrading
Yes

Solution

Upgrade Mercury to version 3.2.11 or later.

Vulnerable code sample

import mr
import ipywidgets as widgets

def render_markdown(md_text: str) -> widgets.HTML:
    # VULNERABLE: raw HTML from user input is rendered without sanitization
    html_content = mr.Markdown(md_text).value
    return widgets.HTML(value=html_content)

Patched code sample

import mr
import ipywidgets as widgets

def render_markdown(md_text: str) -> widgets.HTML:
    # FIX: enable sanitization to strip unsafe HTML tags and attributes
    html_content = mr.Markdown(md_text, sanitize=True).value
    return widgets.HTML(value=html_content)

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

  • sanitize Markdown and HTML Message (mljar/mercury)
    mercury/chat/message.py, mercury/chat/message.py · Message.append_html, mercury/chat/message.py · Message.set_content, mercury/chat/message.py · Message._render, mercury/chat/message.py · Message.__init__, mercury/md.py, mercury/md.py · Markdown, mercury/md.py · MarkdownWidget._add_inline_style, mercury/md.py · MarkdownWidget._to_html, mercury/md.py · MarkdownWidget.__init__

Cite this entry

@misc{vaitp:cve2026111059,
  title        = {{XSS via unsanitized Markdown in Mercury < 3.2.11 allowing HTML injection.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-111059},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-111059/}}
}

Download this entry as JSON Download the whole dataset

Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.