Skip to content
Threat Feed
critical advisory

Multiple Sanitization Bypass Vulnerabilities in justhtml Library

The justhtml library before version 1.15.0 contains multiple vulnerabilities in URL sanitization, HTML serialization, and Markdown passthrough that allow attackers to inject malicious HTML and JavaScript.

CVE search metadata

CVE search record: CVE-2026-5388. Severity: critical. CVSS: 9.8. KEV: no. Product: justhtml (1.15.0), justhtml (<= 1.11.0). Brief: Multiple Sanitization Bypass Vulnerabilities in justhtml Library. Brief link: https://feed.craftedsignal.io/briefs/2026-08-justhtml-xss/

What's new

  • 1. added coverage for justhtml (<= 1.11.0) Aug 23, 15:37 via nvd

The justhtml library, specifically versions prior to 1.15.0, contains critical security flaws within its URL sanitization helpers (clean_url_value and clean_url_in_js_string), HTML serialization logic, and Markdown passthrough functionality. These vulnerabilities enable attackers to bypass sanitization filters and inject active HTML and JavaScript content.

The attack surface is primarily driven by misconfigurations or the use of helper APIs and custom policy pipelines. Attackers can leverage these flaws through techniques such as encoded javascript: pseudo-protocols, malformed relative URLs resolved as remote hosts, and the injection of prohibited elements like <style>, <meta http-equiv=refresh>, and <base href> tags. While default configurations are safer, users relying on custom sanitization policies, programmatic DOM construction, or the html_passthrough=True parameter are at the highest risk. These flaws effectively undermine the security boundary of the library, potentially leading to Stored or Reflected Cross-Site Scripting (XSS) depending on the integration within downstream applications.

Impact

Successful exploitation of these vulnerabilities allows for the execution of arbitrary JavaScript within the context of a victim's browser session. Depending on the target application's sensitivity, this can lead to session hijacking, unauthorized actions performed on behalf of the user, or the exfiltration of sensitive data. Because this is a library-level flaw, the impact is highly dependent on how the library is utilized within specific web applications and CMS frameworks. Organizations utilizing justhtml for content sanitization or Markdown processing should assess whether their specific implementation utilizes the affected helper APIs or custom policies.

Recommendation

  • Upgrade the justhtml library to version 1.15.0 or later to patch these sanitization flaws.
  • Audit applications using the justhtml library, specifically searching for the use of html_passthrough=True or custom sanitization-policy configurations.
  • Implement secondary Content Security Policy (CSP) headers to mitigate the impact of potential XSS vulnerabilities in the event of a bypass.
  • Review existing integration code to ensure that clean_url_value and clean_url_in_js_string are not being misused in contexts where user input can influence the URL scheme or hostname.

Immediate actions

Upgrade justhtml library to version 1.15.0 or later

IT Operations 72h

Mitigations

Review application code for html_passthrough=True and custom sanitization policies

immediate Detection Engineering

CVE-2026-5388