CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-3RCM-VJRC-P45J

GHSA-3rcm-vjrc-p45j: JustHTML Sanitizer Bypass in Markdown Serialization

Amit Schendel
Amit Schendel
Senior Security Researcher

Mar 19, 2026·5 min read·38 visits

Executive Summary (TL;DR)

JustHTML versions prior to 1.12.0 fail to escape angle brackets during Markdown serialization. Entity-encoded HTML inputs safely parsed by the DOM are emitted as raw HTML in the Markdown output, leading to XSS if rendered downstream.

A sanitizer bypass vulnerability in the JustHTML Python library allows for Cross-Site Scripting (XSS) when safe, entity-encoded HTML input is improperly serialized into raw HTML tags during Markdown generation.

Vulnerability Overview

The JustHTML package for Python contains a sanitizer bypass vulnerability affecting the to_markdown() serialization method. This function is responsible for converting parsed HTML document structures into Markdown formatted text. In versions prior to 1.12.0, this conversion process fails to apply necessary character escaping to text nodes.

When JustHTML parses an input document, it safely decodes HTML entities into literal text nodes within the Document Object Model (DOM). For example, an encoded string like &lt;script&gt; is stored internally as a text node containing the literal characters <script>. This behavior is standard and safe within the context of the DOM.

The vulnerability manifests during the serialization phase. While the to_html() method correctly re-encodes these characters into safe entities, the to_markdown() method omits this step. It explicitly preserves angle brackets (< and >), resulting in the emission of raw HTML tags into the output Markdown. If a downstream processor renders this Markdown back into HTML without secondary sanitization, the application is vulnerable to Cross-Site Scripting (XSS).

Root Cause Analysis

The root cause of this vulnerability is an incomplete escaping routine in the Markdown serialization logic. The to_markdown() method is designed to escape Markdown-specific metacharacters to prevent layout disruption, but it lacks specific handling for HTML-significant characters within text nodes.

During document parsing, JustHTML handles entities and literal text elements appropriately. Content within tags such as <title>, <textarea>, <noscript>, and <plaintext> is processed as raw text states. The parser decodes entity references found in standard text blocks, correctly treating them as benign data rather than structural markup.

However, the to_markdown() function iterates over these text nodes and serializes their literal contents directly into the output stream. Because the serialization logic intentionally or accidentally skips the escaping of < and >, the text node <script> is written exactly as <script>. This effectively unwraps the initial sanitization, generating a malicious payload from an originally benign input.

Serialization Mechanics & Impact

The JustHTML library filters actual HTML elements like <script> or <style> by default, provided html_passthrough=True is not set. This protection mechanism creates a false sense of security, as developers assume the resulting Markdown is entirely stripped of active HTML content.

The flaw targets the precise boundary between DOM representation and string serialization. When text nodes are derived from entity-decoded input or extracted from literal text elements, their content bypasses the structural element filters. The to_markdown() routine processes these nodes strictly as text, applying only Markdown-specific escaping rules.

The concrete security impact occurs when the generated Markdown is consumed by a downstream Markdown-to-HTML renderer. Many standard Markdown renderers permit inline raw HTML by default. When the unsanitized JustHTML output is fed into such a renderer, the injected tags are executed by the victim's browser, leading to unauthenticated remote code execution within the context of the application front-end.

Exploitation and Proof of Concept

Exploiting this vulnerability requires the attacker to supply input containing specific HTML entities. The application must process this input using JustHTML and subsequently export it using the to_markdown() method.

The following Python proof-of-concept demonstrates the injection technique. The input begins as safe HTML containing encoded entities. The entities are successfully decoded into the DOM, but the to_markdown() serialization fails to re-encode them, outputting a raw image tag.

from justhtml import JustHTML
 
# Input with encoded entities that is safe for HTML output
input_html = "<p>&lt;img src=x onerror=alert(1)&gt;</p>"
doc = JustHTML(input_html, fragment=True)
 
print("Safe HTML Output (Escaped):")
print(doc.to_html())
# Output: <p>&lt;img src=x onerror=alert(1)&gt;</p>
 
print("\nUnsafe Markdown Output (Tag Injection):")
print(doc.to_markdown())
# Output: <img src=x onerror=alert(1)>

This demonstration highlights the sanitizer bypass. The angle brackets are preserved in the Markdown string, creating a valid HTML element. When rendered by a web browser, the onerror event handler triggers, executing the payload.

Mitigation & Remediation

To remediate this vulnerability, administrators and developers must upgrade the justhtml package to version 1.12.0 or later. This update modifies the to_markdown() method to properly encode HTML-significant characters within text nodes during the serialization process.

In environments where immediate patching is not feasible, developers must implement secondary defense mechanisms. Any Markdown produced by vulnerable versions of to_markdown() should be processed by a robust, security-conscious Markdown-to-HTML renderer. This renderer must be explicitly configured to strip or encode raw HTML tags by default.

Additionally, development teams should audit the application's input handling pipeline. Identifying all sources that feed into the JustHTML parser and mapping where the serialized Markdown is consumed will ensure that the entire data flow is protected against XSS. Strict input validation rejecting unnecessary entity-encoded payloads provides an additional layer of defense.

Official Patches

EmilStenstromGitHub Security Advisory

Technical Appendix

CVSS Score
5.1/ 10
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N

Affected Systems

JustHTML (PyPI Package)

Affected Versions Detail

Product
Affected Versions
Fixed Version
justhtml
EmilStenstrom
< 1.12.01.12.0
AttributeDetail
Vulnerability ClassSanitizer Bypass / Cross-Site Scripting (XSS)
CWE IDCWE-79
Attack VectorNetwork
Authentication RequiredNone
CVSS v4.0 Score5.1 (Moderate)
Exploit MaturityProof-of-Concept
Affected ComponentJustHTML.to_markdown()

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1059.007Command and Scripting Interpreter: JavaScript
Execution
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.

Vulnerability Timeline

Advisory published via GitHub Security Advisory (GHSA)
2026-03-18
Version 1.12.0 released on PyPI to address the vulnerability
2026-03-18

References & Sources

  • [1]GitHub Security Advisory: JustHTML Sanitizer Bypass
  • [2]JustHTML Repository
  • [3]OSV Vulnerability Entry

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•29 minutes ago•CVE-2026-16729
4.8

CVE-2026-16729: Cookie Attribute Injection in Undici via Unsanitized Domain and Unparsed Fields

CVE-2026-16729 (GHSA-v3r7-h72x-cjcm) is a medium-severity cookie attribute injection vulnerability in Undici's web-compliant cookie utility module. Due to insufficient validation of domain parameters and raw attributes in the unparsed options array, arbitrary attributes like SameSite, HttpOnly, and Secure can be injected. This allows attackers to bypass CSRF protections, strip security flags, or override intended cookie behaviors when applications pass user-controlled values to these properties.

Amit Schendel
Amit Schendel
0 views•7 min read
•about 1 hour ago•CVE-2026-14643
5.9

CVE-2026-14643: Shared Cache Pollution and Information Disclosure via Whitespace Parsing Discrepancies in Undici

An interpretation conflict (CWE-436) in the cache interceptor of the undici HTTP client for Node.js causes whitespace-padded Cache-Control directives to be parsed incorrectly, leading to shared cache pollution and the unauthorized disclosure of sensitive, private, or authenticated user information (CWE-524).

Amit Schendel
Amit Schendel
1 views•6 min read
•about 2 hours ago•CVE-2026-15157
4.2

CVE-2026-15157: CRLF Injection in undici HTTP/1.1 Dispatcher

CVE-2026-15157 details an improper neutralization of CRLF sequences ('CRLF Injection') within undici, a widely used Node.js HTTP/1.1 client. The vulnerability is triggered when processing request bodies that exhibit a duck-typed blob-like interface. When an application accepts untrusted data and assigns it to the .type property of such an object without setting an explicit Content-Type on the request, undici appends the value directly to the outgoing headers array without validating it against control characters. This allows remote attackers to inject carriage return and line feed sequences, culminating in arbitrary header injection, HTTP response splitting, or HTTP request smuggling.

Alon Barad
Alon Barad
3 views•6 min read
•about 3 hours ago•CVE-2026-54272
6.9

CVE-2026-54272: SSRF and Trust-Boundary Bypass via Input Misclassification in ip-address Library

A trust-boundary bypass and Server-Side Request Forgery (SSRF) vulnerability exists in the ip-address library versions 10.1.1 through 10.2.0 due to structural input misclassification. The library fails to resolve and normalize transition IP notations, such as IPv4-mapped IPv6 (::ffff:0:0/96) and NAT64 (64:ff9b::/96) addresses, to their embedded IPv4 representations prior to evaluation. Consequently, standard security validation checks (e.g., isLoopback, isLinkLocal, isULA) return false for these addresses. This allows remote attackers to bypass application-level IP address filters, gaining unauthorized access to internal resources, cloud metadata interfaces, and local services on dual-stack hosts or environments utilizing NAT64 gateways.

Amit Schendel
Amit Schendel
2 views•7 min read
•about 4 hours ago•CVE-2026-18574
9.3

CVE-2026-18574: Authentication Bypass via Alternate Path in Check Point Security Management Server

A critical authentication bypass vulnerability (CVE-2026-18574) in Check Point Security Management and Multi-Domain Security Management (MDS) Servers allows unauthenticated remote attackers to execute arbitrary system commands with administrative privileges. The flaw stems from an alternate path authentication bypass (CWE-288) in the management interface daemons.

Amit Schendel
Amit Schendel
8 views•6 min read
•about 4 hours ago•CVE-2026-69198
6.9

CVE-2026-69198: Server-Side Request Forgery Bypass via CIDR Suffix in ip-address Library

An input validation vulnerability in the npm package `ip-address` allows unauthenticated remote attackers to bypass Server-Side Request Forgery (SSRF) protections by appending a `/0` CIDR suffix to IP address strings. This causes the library's classification helper functions to incorrectly identify internal addresses as public, external addresses, while normalization helpers resolve the address back to its internal form during network connection establishment.

Amit Schendel
Amit Schendel
3 views•6 min read