Mittel

unstructured: Stored XSS via unescaped HTML generation

  • Veröffentlicht: 15.10.2026
  • Aktualisiert: 22.10.2026 18:07

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.

python
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:

html
<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.

Betroffene Software

Klicken Sie auf eine Technologie, um alle zugehörigen Schwachstellen anzuzeigen.

PlattformPaketAnfällige VersionenBehoben in
Python (PyPI) unstructured < 0.24.1 0.24.1

Verweise

CVSS-Wert 6.1/10
CVSS-Vektor
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Schwäche (CWE)
CWE-116, CWE-79
Plattform
Python (PyPI)
Paket
unstructured
Veröffentlicht
15.10.2026
Aktualisiert
22.10.2026 18:07

Quellen und Lizenzen

OSV / GitHub Advisory Database - GHSA-v5mq-3xhg-98m9 - CC BY 4.0

Schwachstellenhistorie: unstructured

Alle veröffentlichten Schwachstellen dieses Pakets (Python (PyPI)), neueste zuerst. Zeigt, ob es ein einmaliger Ausrutscher ist oder ein Paket, das man im Auge behalten muss.

Einträge insgesamt
4
Erste → letzte
12.2024 10.2026
Ohne Fix
0
In Angriffen ausgenutzt
0

Verteilung nach Schweregrad

  • Kritisch 2
  • Mittel 2

Veröffentlichungen pro Jahr

  1. 2024: 1
  2. 2025: 0
  3. 2026: 3
  1. unstructured: Stored XSS via unescaped HTML generation dieser Eintrag
    Mittel · 6.1 CVE-2026-104250 < 0.24.1 0.24.1
  2. Kritisch · 9.3 CVE-2026-71428 >= 0.4.7, < 0.24.0 0.24.0
  3. Mittel CVE-2024-46455 < 0.14.3 0.14.3

Erkennen Sie Schwachstellen in Ihrer Anwendung

Mit der DockRay-Integration und aktivierter Softwareinventarisierung prüft DockRay gemeldete Komponentenversionen auf bekannte Schwachstellen und benachrichtigt Sie über bestätigte Treffer. Die Abdeckung hängt von der unterstützten Technologie und den verfügbaren Meldungen ab.

Anwendung verbinden
DockRay Newsletter

Anwendungssicherheit in Ihrem Postfach

Wichtige Schwachstellen, konkrete Empfehlungen und praktische Tipps für Ihre Anwendungen. Wählen Sie Ihre Technologien und verfolgen Sie, was für Ihr Projekt relevant ist.

  • Eine tägliche Zusammenfassung neuer Schwachstellen, auch kritischer.
  • Benachrichtigungen über wichtige Updates.
  • Praktische Tipps zur Sicherheit und Überwachung von Anwendungen.

Leer lassen, um Meldungen zu allen Technologien zu erhalten.

Kostenlos anmelden. In jeder E-Mail mit einem Klick abmelden.