Sceawere
Vulnerability Detail
CVE-2026-5389UPDATED Verified Sceawere Triage Sources: NVD / CISA KEV
justhtml to_markdown Cross-Site Scripting
Vulnerability Metadata
- Severity
- Medium
- Score / CVSS
- 6.1
- Creation Date
- 3h ago
- Vendor
- EmilStenstrom
- Product
- justhtml
- Attack Type
- Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS)
- Vector String
- CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
- Attack Complexity
- LOW
Narrative and Response
Description
justhtml versions before 1.13.0 contain a cross-site scripting vulnerability in the to_markdown() function when serializing attacker-controlled pre content. Attackers can place backticks inside sanitized pre elements to break out of fixed-length code fences, allowing raw HTML to execute when the generated Markdown is rendered by CommonMark or GFM-style renderers.
Executive Summary
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Technical Details
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Mitigations
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
References
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Additional Metadata
{
"score": "6.1",
"pubDate": "2026-08-23T14:16:53.647Z",
"pubdate": "2026-08-23T14:16:53.647Z",
"executiveSummary": "A cross-site scripting (XSS) vulnerability exists in justhtml versions prior to 1.13.0 within the to_markdown() function. The flaw allows attackers to achieve arbitrary script execution when serializing attacker-controlled pre content. By placing backticks inside sanitized pre elements, malicious actors can break out of fixed-length code fences generated during the serialization process. When the resulting output is processed and rendered by CommonMark or GitHub Flavored Markdown (GFM) style renderers, the raw HTML escapes the intended containment and executes in the context of the victim's session. This presents significant risk implications for web applications that ingest untrusted HTML, convert it to Markdown, and subsequently render it for end users. Attackers require the capability to supply malicious input containing crafted HTML structures processed by the vulnerable serialization routine. Remediation requires upgrading justhtml to version 1.13.0 or later, where proper escaping and handling of backticks within pre elements are enforced to prevent markdown breakout.",
"technicalDetails": "The vulnerability resides in the to_markdown() function of the justhtml library, specifically affecting versions prior to 1.13.0. The vulnerable component is responsible for serializing HTML structures into Markdown representations, including pre elements. The root cause stems from insufficient sanitization and handling of backtick characters enclosed within pre tags during the conversion process. In Markdown specifications, code blocks and code spans utilize backticks as delimiters. When the serialization logic constructs fixed-length code fences to represent pre content, it fails to properly neutralize or escape backticks supplied within the attacker-controlled input.\nThe exploitation method relies on breaking out of the generated Markdown code fence. The step-by-step attack flow proceeds as follows: First, an attacker supplies malicious HTML input containing a pre element embedded with strategically placed backticks. Second, the vulnerable to_markdown() function processes this input, generating a Markdown representation where the attacker-controlled backticks prematurely terminate the fixed-length code fence. Third, the raw HTML payload that follows the broken code fence is exposed as unescaped markup rather than literal code text within the Markdown structure. Finally, when this generated Markdown is ingested and rendered by downstream CommonMark or GFM-style renderers, the exposed raw HTML is interpreted by the browser, leading to arbitrary JavaScript execution in the victim's browser context.\nThe vulnerability affects network-exposed applications that utilize justhtml to convert untrusted user-submitted HTML into Markdown. Authentication and privilege requirements depend on the host application's implementation, but exploitation is generally achievable wherever an unauthenticated or authenticated user can supply arbitrary HTML content that is subsequently processed by the vulnerable to_markdown() function. Post-exploitation impact includes session hijacking, credential theft, and manipulation of the DOM within the victimized user's session."
}