CVE-2026-8445 Overview
CVE-2026-8445 is a sanitizer bypass vulnerability in the justhtml Python library affecting versions <= 1.11.0. The flaw resides in the to_markdown() conversion path, which fails to escape HTML-significant characters such as < and > in text nodes. Untrusted input that appears safe when rendered through to_html() — including entity-decoded text like <script> and content from RCDATA or RAWTEXT elements such as <title>, <textarea>, <noscript>, and <plaintext> — is emitted as raw HTML in the Markdown output. When downstream renderers convert that Markdown back to HTML, attacker-controlled script executes in the victim's browser, resulting in cross-site scripting [CWE-79].
Critical Impact
Attackers can bypass HTML sanitization by routing untrusted content through Markdown conversion, achieving stored or reflected XSS in applications that trust justhtml output.
Affected Products
- justhtml versions <= 1.11.0
- Applications invoking to_markdown() on untrusted parsed HTML
- Pipelines that render justhtml Markdown output back to HTML via a Markdown renderer
Discovery Timeline
- 2026-08-23 - CVE-2026-8445 published to NVD
- 2026-08-26 - Last updated in NVD database
Technical Details for CVE-2026-8445
Vulnerability Analysis
The justhtml library exposes two output paths: to_html() and to_markdown(). The HTML path sanitizes content by escaping angle brackets and other HTML-significant characters in text nodes. The Markdown path escapes a limited set of Markdown metacharacters but preserves < and > verbatim. This asymmetry breaks the security contract callers expect when treating both outputs as equivalently sanitized.
During parsing, HTML entities like <script> are decoded into their literal characters within the internal document tree. Content inside RCDATA and RAWTEXT elements — <title>, <textarea>, <noscript>, and <plaintext> — is stored as literal text rather than parsed markup. When to_markdown() serializes these text nodes, the raw <script> sequence appears in the Markdown output. A downstream Markdown-to-HTML renderer then interprets those characters as active HTML tags.
Root Cause
The root cause is incomplete output encoding in the Markdown serializer. The function assumes text nodes are safe because they were parsed as text, but it fails to account for the fact that Markdown allows raw HTML pass-through by design. Any Markdown renderer configured to permit inline HTML will execute the injected markup.
Attack Vector
An attacker submits HTML content containing encoded payloads such as <img src=x onerror=alert(1)> or wraps a payload inside a <title> or <textarea> element. The application parses this input with justhtml, converts it to Markdown via to_markdown(), stores or transmits the Markdown, and later renders it as HTML. The injected script executes in the victim's browser session under the application's origin.
See the GitHub Security Advisory and the VulnCheck Advisory on Markdown Bypass for full technical detail.
Detection Methods for CVE-2026-8445
Indicators of Compromise
- Markdown documents produced by justhtml containing raw <script>, <img>, <iframe>, or event-handler attributes in text regions.
- Web application logs showing user-submitted HTML containing entity-encoded tags (<, >) followed by rendered pages exhibiting script execution.
- Unexpected outbound requests from browser sessions originating on pages that render Markdown output from justhtml.
Detection Strategies
- Grep application dependencies for justhtml<=1.11.0 in requirements.txt, pyproject.toml, or Pipfile.lock.
- Add unit tests that pass entity-encoded and RCDATA-wrapped payloads through to_markdown() and assert the output contains no raw < or > around known tag names.
- Deploy content-security-policy violation reporting to surface unexpected inline script execution in production.
Monitoring Recommendations
- Monitor CSP reports for script-src violations on pages that render user-generated Markdown.
- Alert on web application firewall (WAF) matches for encoded XSS payloads submitted to endpoints that feed the Markdown pipeline.
- Track dependency inventories for justhtml version drift using software composition analysis tooling.
How to Mitigate CVE-2026-8445
Immediate Actions Required
- Upgrade justhtml to version 1.12.0 or later across all environments.
- Audit any stored Markdown produced by vulnerable versions for embedded raw HTML before re-rendering.
- Disable raw HTML pass-through in downstream Markdown renderers where feasible.
Patch Information
The maintainer fixed the flaw in justhtml1.12.0 by properly escaping HTML-significant characters in text nodes during Markdown serialization. Refer to the GitHub Security Advisory GHSA-3rcm-vjrc-p45j for the release notes and patch reference.
Workarounds
- Post-process to_markdown() output through a strict HTML-stripping filter before storage or rendering.
- Configure the downstream Markdown renderer to disable inline HTML (for example, markdown-it with html: false).
- Apply a Content Security Policy that forbids inline scripts and restricts script-src to trusted origins.
# Configuration example
pip install --upgrade 'justhtml>=1.12.0'
pip show justhtml | grep -i version
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

