{"id":"CVE-2026-24040","aliases":["CVE-2026-24040","GHSA-cjw8-79x6-5cj4"],"related":[],"kind":"vulnerability","state":"published","title":"jsPDF has a Shared State Race Condition in addJS Plugin","summary":"jsPDF is a library to generate PDFs in JavaScript. Prior to 4.1.0, the addJS method in the jspdf Node.js build utilizes a shared module-scoped variable (text) to store JavaScript content. When used in a concurrent environment (e.g., a Node.js web server), this variable is shared across all requests. If multiple requests generate PDFs simultaneously, the JavaScript content intended for one user may be overwritten by a subsequent request before the document is generated. This results in Cross-User Data Leakage, where the PDF generated for User A contains the JavaScript payload (and any embedded sensitive data) intended for User B. Typically, this only affects server-side environments, although the same race conditions might occur if jsPDF runs client-side. The vulnerability has been fixed in jsPDF@4.1.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"jsPDF is a library to generate PDFs in JavaScript. Prior to 4.1.0, the addJS method in the jspdf Node.js build utilizes a shared module-scoped variable (text) to store JavaScript content. When used in a concurrent environment (e.g., a Node.js web server), this variable is shared across all requests. If multiple requests generate PDFs simultaneously, the JavaScript content intended for one user may be overwritten by a subsequent request before the document is generated. This results in Cross-User Data Leakage, where the PDF generated for User A contains the JavaScript payload (and any embedded sensitive data) intended for User B. Typically, this only affects server-side environments, although the same race conditions might occur if jsPDF runs client-side. The vulnerability has been fixed in jsPDF@4.1.0.","source":"cvelist"},{"lang":"en","text":"### Impact\n\nThe addJS method in the jspdf Node.js build utilizes a shared module-scoped variable (text) to store JavaScript content. When used in a concurrent environment (e.g., a Node.js web server), this variable is shared across all requests.\n\nIf multiple requests generate PDFs simultaneously, the JavaScript content intended for one user may be overwritten by a subsequent request before the document is generated. This results in Cross-User Data Leakage, where the PDF generated for User A contains the JavaScript payload (and any embedded sensitive data) intended for User B.\n\nTypically, this only affects server-side environments, although the same race conditions might occur if jsPDF runs client-side.\n\n```js\nimport { jsPDF } from \"jspdf\";\n\nconst docA = new jsPDF();\nconst docB = new jsPDF();\n\n// 1. User A sets their script (stored in shared 'text' variable)\ndocA.addJS('console.log(\"Secret A\");');\n\n// 2. User B sets their script (overwrites shared 'text' variable)\ndocB.addJS('console.log(\"Secret B\");');\n\n// 3. User A saves their PDF (reads current 'text' variable)\ndocA.save(\"userA.pdf\");\n\n// Result: userA.pdf contains \"Secret B\" instead of \"Secret A\"\n```\n\n### Patches\nThe vulnerability has been fixed in jspdf@4.0.1. The fix moves the shared variable into the function scope, ensuring isolation between instances.\n\n### Workarounds\nAvoid using the addJS method in concurrent server-side environments. If usage is required, ensure requests are processed sequentially (e.g., using a queue) rather than in parallel.","format":"markdown","source":"ghsa"},{"lang":"es","text":"jsPDF es una biblioteca para generar PDFs en JavaScript. Antes de la versión 4.1.0, el método addJS en la compilación de Node.js de jspdf utiliza una variable compartida con ámbito de módulo (text) para almacenar contenido JavaScript. Cuando se utiliza en un entorno concurrente (por ejemplo, un servidor web Node.js), esta variable se comparte entre todas las solicitudes. Si múltiples solicitudes generan PDFs simultáneamente, el contenido JavaScript destinado a un usuario puede ser sobrescrito por una solicitud subsiguiente antes de que se genere el documento. Esto resulta en una Fuga de Datos entre Usuarios (Cross-User Data Leakage), donde el PDF generado para el Usuario A contiene la carga útil de JavaScript (y cualquier dato sensible incrustado) destinada al Usuario B. Típicamente, esto solo afecta a entornos del lado del servidor, aunque las mismas condiciones de carrera podrían ocurrir si jsPDF se ejecuta del lado del cliente. La vulnerabilidad ha sido corregida en jsPDF@4.1.0.","source":"nvd"}],"published":"2026-02-02T18:20:02.000Z","modified":"2026-09-10T03:50:59.422Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N","score":6.3,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N","score":6.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N","rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N","score":4.8,"rating":"MEDIUM"}],"cwes":["CWE-200","CWE-362"],"affected":[{"ranges":[{"version":"< 4.1.0","status":"affected"}],"vendor":"parallax","product":"jsPDF","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"4.1.0"}],"ecosystem":"npm","package":"jspdf","purl":"pkg:npm/jspdf","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"4.1.0"}],"vendor":"parall","product":"jspdf","cpe":"cpe:2.3:a:parall:jspdf:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/parallax/jsPDF/security/advisories/GHSA-cjw8-79x6-5cj4","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/parallax/jsPDF/commit/2863e5c26afef211a545e8c174ab4d5fce3b8c0e","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/parallax/jsPDF/releases/tag/v4.1.0","tags":["release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-24040","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/parallax/jsPDF","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-02-03T15:29:49.991Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-24040","url":"https://www.cve.org/CVERecord?id=CVE-2026-24040","licence":"CVE Terms of Use","modified":"2026-02-03T15:30:05.465Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-cjw8-79x6-5cj4","url":"https://github.com/advisories/GHSA-cjw8-79x6-5cj4","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:59.422Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-24040","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-24040","licence":"Public domain","modified":"2026-06-17T10:22:30.403Z"}],"updatedAt":"2026-11-25T22:59:13.374Z","epss":{"score":0.00278,"percentile":0.21661,"date":"2026-12-01T12:00:22.000Z"}}