PyPI: mercury

CVE-2026-111059

Safety vulnerability ID: SFTY-20261019-84254

Affected versions of the `mercury` package are vulnerable to Cross-site Scripting (XSS) due to the `mr.Markdown` widget rendering its input as raw, unsanitized HTML. `MarkdownWidget._to_html()` in `mercury/md.py` converts the text with python-markdown, which passes inline HTML through unchanged, and `MarkdownWidget`, a subclass of `ipywidgets.HTML`, writes the result into the page through `innerHTML`, so payloads such as `<img src=x onerror=...>`, `<svg onload=...>` and `javascript:` links reach the DOM intact. An attacker who can place content in data that a Mercury app passes to `mr.Markdown`, such as a database row, a form submission, an uploaded file or an external API response, can run JavaScript in the browser of every user who views the app, allowing session hijacking, actions performed as the victim or tampering with the displayed page.

Created at: Oct 20, 2026Updated at: Oct 20, 2026

Overview

Mercury: Stored / DOM Cross-Site Scripting (XSS): mr.Markdown renders untrusted content as raw, unsanitized HTML

Advisory

mercury – Cross-site Scripting (XSS)

Affected Package

Affecting mercury package, versions>= 3.0.0, < 3.2.11

Also affects

---

How to Fix

Upgrademercuryto3.2.11or higher.

Mitigation and Workarounds

---

Vulnerable Functions

Functions linked to known vulnerabilities.

Vulnerable function data is available for Enterprise customers

Book a call with us to see Safety in action.

Safety

Verified by Safety

Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.

Learn more