{"id":"CVE-2026-82868","aliases":["EUVD-2026-68403","GHSA-87v3-4cfp-cm76","GHSA-9f44-gwhq-mr2g"],"status":"published","title":"@pdfme/schemas before 5.5.9 Cross-Site Scripting via SVG","description":"@pdfme/schemas before 5.5.9 contains a cross-site scripting vulnerability in the SVG schema plugin that renders user-supplied SVG content directly to innerHTML without sanitization. Attackers can inject malicious SVG with embedded scripts, event handlers, or foreignObject elements to execute arbitrary JavaScript in users' browsers when viewing or filling templates.","severity":{"version":"4.0","score":5.3,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N","level":"medium","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-12","score":0.00263,"percentile":0.18264,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-79"],"published":"2026-03-18T16:10:26Z","modified":"2026-10-28T02:30:30Z","fixes":[{"ecosystem":"npm","package":"@pdfme/schemas","fixed_in":["5.5.9"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"npm","package":"@pdfme/schemas","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"last_affected":"5.5.8"},{"fixed":"5.5.9"}]}]},{"source":"osv","ecosystem":"npm","package":"@pdfme/schemas","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"5.5.9"}]}]}],"products":[{"vendor":"pdfme","product":"schemas"}],"references":[{"url":"https://github.com/pdfme/pdfme/security/advisories/GHSA-87v3-4cfp-cm76","tags":["vendor-advisory","exploit","advisory","web"]},{"url":"https://www.vulncheck.com/advisories/pdfme-schemas-before-5.5.9-cross-site-scripting-via-svg","tags":["third-party-advisory","advisory"]},{"url":"https://github.com/advisories/GHSA-87v3-4cfp-cm76"},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-82868","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-9f44-gwhq-mr2g"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/82xxx/CVE-2026-82868.json","tags":["advisory"]},{"url":"https://github.com/pdfme/pdfme","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2026-82868","title":"@pdfme/schemas before 5.5.9 Cross-Site Scripting via SVG","description":"@pdfme/schemas before 5.5.9 contains a cross-site scripting vulnerability in the SVG schema plugin that renders user-supplied SVG content directly to innerHTML without sanitization. Attackers can inject malicious SVG with embedded scripts, event handlers, or foreignObject elements to execute arbitrary JavaScript in users' browsers when viewing or filling templates.","status":"published","published":"2026-08-31T08:46:38.149Z","modified":"2026-10-08T15:25:41.827Z","cvss":[{"version":"4.0","score":5.3,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N","level":"medium","assessor":"cna"},{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium","assessor":"cna"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T13:40:35.004553Z"}],"euvd":[{"id":"EUVD-2026-68403","description":"@pdfme/schemas before 5.5.9 contains a cross-site scripting vulnerability in the SVG schema plugin that renders user-supplied SVG content directly to innerHTML without sanitization. Attackers can inject malicious SVG with embedded scripts, event handlers, or foreignObject elements to execute arbitrary JavaScript in users' browsers when viewing or filling templates.","status":"published","published":"2026-08-31T08:46:38Z","modified":"2026-10-08T15:25:41Z","cvss":[{"version":"4.0","score":5.3,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N","level":"medium"}],"updated_at":"2026-11-02T17:27:28.564399Z"}],"ghsa":[{"id":"GHSA-87v3-4cfp-cm76","title":"Cross-Site Scripting (XSS) via SVG Schema innerHTML Injection in @pdfme/schemas","description":"## Summary\n\nThe SVG schema plugin in `@pdfme/schemas` renders user-supplied SVG content using `container.innerHTML = value` without any sanitization, enabling arbitrary JavaScript execution in the user's browser.\n\n## Details\n\nIn `packages/schemas/src/graphics/svg.ts`, line 87, the SVG schema's `ui` renderer assigns raw SVG markup directly to `innerHTML` when in viewer mode or form mode with `readOnly: true`:\n\n```typescript\n// svg.ts, line 81-94 (non-editable rendering path)\n} else {\n  if (!value) return;\n  if (!isValidSVG(value)) {\n    rootElement.appendChild(createErrorElm());\n    return;\n  }\n  container.innerHTML = value;  // \u003c-- VULNERABLE: unsanitized SVG injected into DOM\n  const svgElement = container.childNodes[0];\n  if (svgElement instanceof SVGElement) {\n    svgElement.setAttribute('width', '100%');\n    svgElement.setAttribute('height', '100%');\n    rootElement.appendChild(container);\n  }\n}\n```\n\nThe `isValidSVG()` function (lines 11-37) only validates that the string contains `\u003csvg` and `\u003c/svg\u003e` tags and passes `DOMParser` well-formedness checks. It does NOT strip or block:\n- `\u003cscript\u003e` tags embedded in SVG\n- Event handler attributes (`onload`, `onerror`, `onclick`, etc.)\n- `\u003cforeignObject\u003e` elements containing HTML with event handlers\n- `\u003canimate\u003e` / `\u003cset\u003e` elements with `onbegin` / `onend` handlers\n- SVG `\u003cuse\u003e` elements referencing malicious external resources\n\nAll of these are valid SVG and pass `isValidSVG()`, but execute JavaScript when inserted via `innerHTML`.\n\n## Attack Vectors\n\n### 1. Malicious Template (readOnly SVG schema)\nAn attacker crafts a template JSON with a readOnly SVG schema containing a malicious `content` value. When loaded into the pdfme Form or Viewer component, the SVG executes JavaScript.\n\n### 2. Application-Supplied Inputs + Viewer\nIf an application uses the pdfme Viewer component and passes user-controlled data as inputs for a non-readOnly SVG schema, the attacker's SVG flows directly to `innerHTML`.\n\n## Proof of Concept\n\nLoading the following template into a pdfme Form or Viewer component triggers JavaScript execution:\n\n```json\n{\n  \"basePdf\": { \"width\": 210, \"height\": 297, \"padding\": [20, 20, 20, 20] },\n  \"schemas\": [[\n    {\n      \"name\": \"malicious_svg\",\n      \"type\": \"svg\",\n      \"content\": \"\u003csvg xmlns='http://www.w3.org/2000/svg' onload='alert(document.domain)'\u003e\u003crect width='100' height='100' fill='red'/\u003e\u003c/svg\u003e\",\n      \"readOnly\": true,\n      \"position\": { \"x\": 20, \"y\": 20 },\n      \"width\": 80,\n      \"height\": 40\n    }\n  ]]\n}\n```\n\nAdditional payloads that bypass `isValidSVG()` and execute JavaScript:\n\n```svg\n\u003c!-- Via foreignObject --\u003e\n\u003csvg xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003cforeignObject width=\"200\" height=\"60\"\u003e\u003cbody xmlns=\"http://www.w3.org/1999/xhtml\"\u003e\u003cimg src=\"x\" onerror=\"alert(1)\"/\u003e\u003c/body\u003e\u003c/foreignObject\u003e\u003c/svg\u003e\n\n\u003c!-- Via animate onbegin --\u003e\n\u003csvg xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003crect width=\"100\" height=\"100\"\u003e\u003canimate attributeName=\"x\" values=\"0\" dur=\"0.001s\" onbegin=\"alert(1)\"/\u003e\u003c/rect\u003e\u003c/svg\u003e\n```\n\n## Impact\n\nAn attacker who can supply a malicious template (via file upload, shared template URL, multi-tenant template storage, or `updateTemplate()` API) can execute arbitrary JavaScript in the context of any user who views or fills the template. This enables:\n- Session hijacking via cookie/token theft\n- Keylogging of form inputs (including sensitive data being entered into PDF forms)\n- Phishing attacks by modifying the rendered page\n- Data exfiltration from the application\n\nThe attack is particularly concerning for multi-tenant SaaS applications using pdfme where templates may be user-supplied.\n\n## Suggested Fix\n\nSanitize SVG content before DOM insertion using DOMPurify or a similar library:\n\n```typescript\nimport DOMPurify from 'dompurify';\n\n// Replace line 87:\ncontainer.innerHTML = DOMPurify.sanitize(value, { USE_PROFILES: { svg: true } });\n```\n\nAlternatively, parse the SVG via `DOMParser`, strip all script elements and event handler attributes, then append the sanitized DOM nodes.","status":"published","published":"2026-03-18T16:10:26Z","modified":"2026-03-18T16:10:30Z","cvss":[{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T14:39:37.554665Z"},{"id":"GHSA-9f44-gwhq-mr2g","title":"@pdfme/schemas before 5.5.9 contains a cross-site scripting vulnerability in the SVG schema...","description":"@pdfme/schemas before 5.5.9 contains a cross-site scripting vulnerability in the SVG schema plugin that renders user-supplied SVG content directly to innerHTML without sanitization. Attackers can inject malicious SVG with embedded scripts, event handlers, or foreignObject elements to execute arbitrary JavaScript in users' browsers when viewing or filling templates.","status":"published","published":"2026-08-31T09:30:32Z","modified":"2026-08-31T09:30:33Z","cvss":[{"version":"4.0","score":5.3,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","level":"medium"},{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T15:11:10.774419Z"}],"nvd":[{"id":"CVE-2026-82868","description":"@pdfme/schemas before 5.5.9 contains a cross-site scripting vulnerability in the SVG schema plugin that renders user-supplied SVG content directly to innerHTML without sanitization. Attackers can inject malicious SVG with embedded scripts, event handlers, or foreignObject elements to execute arbitrary JavaScript in users' browsers when viewing or filling templates.","status":"published","published":"2026-08-31T09:17:07.553Z","modified":"2026-10-08T16:17:54.16Z","cvss":[{"version":"4.0","score":5.3,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","level":"medium","assessor":"secondary"},{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium","assessor":"secondary"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T14:12:42.691315Z"}],"osv":[{"id":"CVE-2026-82868","title":"@pdfme/schemas before 5.5.9 Cross-Site Scripting via SVG","description":"@pdfme/schemas before 5.5.9 contains a cross-site scripting vulnerability in the SVG schema plugin that renders user-supplied SVG content directly to innerHTML without sanitization. Attackers can inject malicious SVG with embedded scripts, event handlers, or foreignObject elements to execute arbitrary JavaScript in users' browsers when viewing or filling templates.","status":"published","published":"2026-08-31T08:46:38.149Z","modified":"2026-10-28T02:30:30.551008344Z","cvss":[{"version":"4.0","score":5.3,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N","level":"medium"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T15:45:18.482949Z"},{"id":"GHSA-87v3-4cfp-cm76","title":"Cross-Site Scripting (XSS) via SVG Schema innerHTML Injection in @pdfme/schemas","description":"## Summary\n\nThe SVG schema plugin in `@pdfme/schemas` renders user-supplied SVG content using `container.innerHTML = value` without any sanitization, enabling arbitrary JavaScript execution in the user's browser.\n\n## Details\n\nIn `packages/schemas/src/graphics/svg.ts`, line 87, the SVG schema's `ui` renderer assigns raw SVG markup directly to `innerHTML` when in viewer mode or form mode with `readOnly: true`:\n\n```typescript\n// svg.ts, line 81-94 (non-editable rendering path)\n} else {\n  if (!value) return;\n  if (!isValidSVG(value)) {\n    rootElement.appendChild(createErrorElm());\n    return;\n  }\n  container.innerHTML = value;  // \u003c-- VULNERABLE: unsanitized SVG injected into DOM\n  const svgElement = container.childNodes[0];\n  if (svgElement instanceof SVGElement) {\n    svgElement.setAttribute('width', '100%');\n    svgElement.setAttribute('height', '100%');\n    rootElement.appendChild(container);\n  }\n}\n```\n\nThe `isValidSVG()` function (lines 11-37) only validates that the string contains `\u003csvg` and `\u003c/svg\u003e` tags and passes `DOMParser` well-formedness checks. It does NOT strip or block:\n- `\u003cscript\u003e` tags embedded in SVG\n- Event handler attributes (`onload`, `onerror`, `onclick`, etc.)\n- `\u003cforeignObject\u003e` elements containing HTML with event handlers\n- `\u003canimate\u003e` / `\u003cset\u003e` elements with `onbegin` / `onend` handlers\n- SVG `\u003cuse\u003e` elements referencing malicious external resources\n\nAll of these are valid SVG and pass `isValidSVG()`, but execute JavaScript when inserted via `innerHTML`.\n\n## Attack Vectors\n\n### 1. Malicious Template (readOnly SVG schema)\nAn attacker crafts a template JSON with a readOnly SVG schema containing a malicious `content` value. When loaded into the pdfme Form or Viewer component, the SVG executes JavaScript.\n\n### 2. Application-Supplied Inputs + Viewer\nIf an application uses the pdfme Viewer component and passes user-controlled data as inputs for a non-readOnly SVG schema, the attacker's SVG flows directly to `innerHTML`.\n\n## Proof of Concept\n\nLoading the following template into a pdfme Form or Viewer component triggers JavaScript execution:\n\n```json\n{\n  \"basePdf\": { \"width\": 210, \"height\": 297, \"padding\": [20, 20, 20, 20] },\n  \"schemas\": [[\n    {\n      \"name\": \"malicious_svg\",\n      \"type\": \"svg\",\n      \"content\": \"\u003csvg xmlns='http://www.w3.org/2000/svg' onload='alert(document.domain)'\u003e\u003crect width='100' height='100' fill='red'/\u003e\u003c/svg\u003e\",\n      \"readOnly\": true,\n      \"position\": { \"x\": 20, \"y\": 20 },\n      \"width\": 80,\n      \"height\": 40\n    }\n  ]]\n}\n```\n\nAdditional payloads that bypass `isValidSVG()` and execute JavaScript:\n\n```svg\n\u003c!-- Via foreignObject --\u003e\n\u003csvg xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003cforeignObject width=\"200\" height=\"60\"\u003e\u003cbody xmlns=\"http://www.w3.org/1999/xhtml\"\u003e\u003cimg src=\"x\" onerror=\"alert(1)\"/\u003e\u003c/body\u003e\u003c/foreignObject\u003e\u003c/svg\u003e\n\n\u003c!-- Via animate onbegin --\u003e\n\u003csvg xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003crect width=\"100\" height=\"100\"\u003e\u003canimate attributeName=\"x\" values=\"0\" dur=\"0.001s\" onbegin=\"alert(1)\"/\u003e\u003c/rect\u003e\u003c/svg\u003e\n```\n\n## Impact\n\nAn attacker who can supply a malicious template (via file upload, shared template URL, multi-tenant template storage, or `updateTemplate()` API) can execute arbitrary JavaScript in the context of any user who views or fills the template. This enables:\n- Session hijacking via cookie/token theft\n- Keylogging of form inputs (including sensitive data being entered into PDF forms)\n- Phishing attacks by modifying the rendered page\n- Data exfiltration from the application\n\nThe attack is particularly concerning for multi-tenant SaaS applications using pdfme where templates may be user-supplied.\n\n## Suggested Fix\n\nSanitize SVG content before DOM insertion using DOMPurify or a similar library:\n\n```typescript\nimport DOMPurify from 'dompurify';\n\n// Replace line 87:\ncontainer.innerHTML = DOMPurify.sanitize(value, { USE_PROFILES: { svg: true } });\n```\n\nAlternatively, parse the SVG via `DOMParser`, strip all script elements and event handler attributes, then append the sanitized DOM nodes.","status":"published","published":"2026-03-18T16:10:26Z","modified":"2026-09-01T03:55:41.584772853Z","cvss":[{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T15:46:42.077781Z"}]}}
