CVE-2026-104250: unstructured Cross-Site Scripting Vulnerability
MODERATECVE-2026-104250 is a MODERATE (CVSS 6.1) cross-site scripting vulnerability (CWE-116: Improper Encoding or Escaping of Output) affecting unstructured libraries in the PyPI ecosystem. The issue involves stored xss via unescaped html generation. Remediation is available by upgrading affected packages to version 0.24.1.
CVE-2026-104250 at a Glance
Security Impact
CVSS: 6.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N).
How to Fix CVE-2026-104250
To remediate this vulnerability, upgrade all affected unstructured dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install unstructured>=0.24.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show unstructured
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2026-104250, inspect your installed packages using pip:
pip show unstructured
Analyze the terminal output to locate any version of unstructured in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.24.1), your application is affected.
Note: The pip show unstructured command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-116: Improper Encoding or Escaping of Output, where the product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. as a result, the intended structure of the message is not preserved. In unstructured, 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
CVE-2026-104250 Affected unstructured Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
unstructured
|
PyPI |
< 0.24.1
|
0.24.1
|
References
Frequently Asked Questions
What is CVE-2026-104250?
Which unstructured versions are affected?
What version fixes CVE-2026-104250?
Is unstructured affected?
What is the CVSS score of CVE-2026-104250?
What CWE is associated with CVE-2026-104250?
How can I check PyPI dependencies for CVE-2026-104250?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-v5mq-3xhg-98m9",
"modified" : "2026-10-15T20:16:18Z",
"published" : "2026-10-15T20:16:18Z",
"aliases" : [ "CVE-2026-104250" ],
"summary" : "unstructured: Stored XSS via unescaped HTML generation",
"details" : "### Summary\n\nWhen `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.\n\n### Details\n\n`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.\n\nThe 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.\n\nRelevant 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`).\n\n### PoC\n\nEnvironment: `downloads.unstructured.io/unstructured-io/unstructured:latest`, `unstructured` 0.23.3.\n\n```python\nfrom unstructured.partition.html import partition_html\nfrom unstructured.partition.html.convert import elements_to_html\n\nmalicious = ('<body class=\"Document\">'\n '<p class=\"Paragraph\" onmouseover=\"alert(1)\">hello'\n '<img src=x onerror=\"alert(document.domain)\"></p>'\n '<a class=\"Hyperlink\" href=\"javascript:alert(document.cookie)\">click me</a>'\n '</body>')\nels = partition_html(text=malicious, html_parser_version=\"v2\")\nopen(\"xss_output.html\", \"w\").write(elements_to_html(list(els), no_group_by_page=True))\n```\n\n`elements_to_html()` output body — the unescaped vectors survive:\n\n```html\n<p class=\"NarrativeText\" id=\"...\" onmouseover=\"alert(1)\">\n <p class=\"Paragraph\">hello</p>\n <img class=\"Image\" onerror=\"alert(document.domain)\" src=\"x\"/>\n</p>\n<a class=\"UncategorizedText\" href=\"javascript:alert(document.cookie)\" id=\"...\">click me</a>\n```\n\nOpening `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):\n\n| Vector | Trigger | Cause |\n|---|---|---|\n| `<img onerror>` | open file (auto) | element `text` not escaped |\n| `<svg onload>` (via `title='\"><svg ...>'`) | open file (auto) | attribute value not escaped (`\"` breakout) |\n| `<a href=javascript:>` | click | link URL scheme not filtered |\n| `onmouseover` | hover | source attribute preserved as-is |\n\n### Impact\n\nStored 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.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "unstructured"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.24.1"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 0.24.0"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/Unstructured-IO/unstructured/security/advisories/GHSA-v5mq-3xhg-98m9"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-104250"
}, {
"type" : "WEB",
"url" : "https://github.com/Unstructured-IO/unstructured/pull/4394"
}, {
"type" : "WEB",
"url" : "https://github.com/Unstructured-IO/unstructured/commit/cda16b3f2170019be9c6ea5635946fb3eaa2d66f"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/Unstructured-IO/unstructured"
}, {
"type" : "WEB",
"url" : "https://github.com/Unstructured-IO/unstructured/releases/tag/0.24.1"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-116", "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-10-15T20:16:18Z",
"nvd_published_at" : "2026-10-13T17:17:15Z"
}
}