GHSA-3rcm-vjrc-p45j: Justhtml JustHTML Has A Sanitizer Bypass Vulnerability

MODERATE
CWE-79
Published
Advisory Summary

GHSA-3rcm-vjrc-p45j is a MODERATE justhtml has a sanitizer bypass vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Justhtml libraries in the PyPI ecosystem. The issue involves justhtml has a sanitizer bypass (in markdown). Remediation is available by upgrading affected packages to version 1.12.0.

GHSA-3rcm-vjrc-p45j at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-3rcm-vjrc-p45j
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Justhtml
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix GHSA-3rcm-vjrc-p45j

To remediate this vulnerability, upgrade all affected Justhtml dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

justhtml fixed: 1.12.0
pip install justhtml>=1.12.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show justhtml

How to Check if You Are Affected

To determine whether your Python environment is affected by GHSA-3rcm-vjrc-p45j, inspect your installed packages using pip:

pip show justhtml

Analyze the terminal output to locate any version of Justhtml in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.12.0), your application is affected.

Note: The pip show justhtml command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product 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. In Justhtml, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary `to_markdown()` does not sufficiently escape text content that looks like HTML. As a result, untrusted input that is safe in `to_html()` can become raw HTML in Markdown output. This is not specific to tokenizer raw-text states like `<title>`, `<noscript>`, or `<plaintext>`, although those states can trigger the behavior. The root cause is broader: Markdown text serialization leaves angle brackets unescaped in text nodes. ## Details When converting a parsed document to Markdown, text nodes are escaped for a small set of Markdown metacharacters, but HTML-significant characters such as `<` and `>` are preserved. That means content parsed as text, including entity-decoded text or text produced by RCDATA/RAWTEXT-style parsing, can be emitted into Markdown as raw HTML. Examples of affected input include: - Text produced from entity-decoded input such as `&lt;script&gt;...&lt;/script&gt;` - Text inside elements like `<title>`, `<textarea>`, `<noscript>` (when parsed as raw text), and `<plaintext>` This is distinct from actual `<script>` or `<style>` elements in the DOM. Those are already dropped by default in `to_markdown()` unless `html_passthrough=True`. ## Proof of Concept ### General case ```python from justhtml import JustHTML doc = JustHTML("<p>&lt;img src=x onerror=alert(1)&gt;</p>", fragment=True) print(doc.to_html()) print() print(doc.to_markdown())

GHSA-3rcm-vjrc-p45j Affected Justhtml Versions

1 component(s)
Fixed Versions:
1.12.0
Product / Package Ecosystem Affected Versions Fixed Version
justhtml
PyPI
< 1.12.0
1.12.0

References

Frequently Asked Questions

What is GHSA-3rcm-vjrc-p45j?
GHSA-3rcm-vjrc-p45j is a security vulnerability in Justhtml involving JustHTML has a Sanitizer Bypass (in Markdown) under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Justhtml versions are affected?
Affected versions include releases prior to 1.12.0 across affected packages: justhtml.
What version fixes GHSA-3rcm-vjrc-p45j?
Upgrading to 1.12.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is justhtml affected?
Yes, justhtml is affected in releases prior to 1.12.0. Upgrade your dependency to 1.12.0 or later.
What CWE is associated with GHSA-3rcm-vjrc-p45j?
GHSA-3rcm-vjrc-p45j is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product 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.).
How can I check PyPI dependencies for GHSA-3rcm-vjrc-p45j?
Run the dependency tree command: 'pip show justhtml'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-3rcm-vjrc-p45j",
  "modified" : "2026-03-18T20:19:56Z",
  "published" : "2026-03-18T20:19:56Z",
  "aliases" : [ ],
  "summary" : "JustHTML has a Sanitizer Bypass (in Markdown)",
  "details" : "## Summary\n\n`to_markdown()` does not sufficiently escape text content that looks like HTML. As a result, untrusted input that is safe in `to_html()` can become raw HTML in Markdown output.\n\nThis is not specific to tokenizer raw-text states like `<title>`, `<noscript>`, or `<plaintext>`, although those states can trigger the behavior. The root cause is broader: Markdown text serialization leaves angle brackets unescaped in text nodes.\n\n## Details\n\nWhen converting a parsed document to Markdown, text nodes are escaped for a small set of Markdown metacharacters, but HTML-significant characters such as `<` and `>` are preserved. That means content parsed as text, including entity-decoded text or text produced by RCDATA/RAWTEXT-style parsing, can be emitted into Markdown as raw HTML.\n\nExamples of affected input include:\n\n- Text produced from entity-decoded input such as `&lt;script&gt;...&lt;/script&gt;`\n- Text inside elements like `<title>`, `<textarea>`, `<noscript>` (when parsed as raw text), and `<plaintext>`\n\nThis is distinct from actual `<script>` or `<style>` elements in the DOM. Those are already dropped by default in `to_markdown()` unless `html_passthrough=True`.\n\n## Proof of Concept\n\n### General case\n\n```python\nfrom justhtml import JustHTML\n\ndoc = JustHTML(\"<p>&lt;img src=x onerror=alert(1)&gt;</p>\", fragment=True)\n\nprint(doc.to_html())\nprint()\nprint(doc.to_markdown())",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "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" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "justhtml"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.12.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.11.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/EmilStenstrom/justhtml/security/advisories/GHSA-3rcm-vjrc-p45j"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/EmilStenstrom/justhtml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-18T20:19:56Z",
    "nvd_published_at" : null
  }
}