CVE-2026-31898
MEDIUMAttack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessPass unsanitized input to createAnnotation
-
ExploitInject malicious PDF objects via color parameter
-
ImpactExecute arbitrary JavaScript when PDF opened
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Output encoding for downstream
|
| Exploitation Conditions | Application must use jsPDF library and pass user-controlled input directly to createAnnotation method's color parameter without sanitization. Victim must open the generated PDF document. |
| Impact | Despite the high CVSS score of 8.1 indicating significant theoretical impact, the real-world risk requires careful consideration. The CVSS vector shows this is a network-accessible vulnerability (AV:N) with low complexity (AC:L) requiring no privileges (PR:N) but does require user interaction (UI:R) to trigger. The lack of KEV listing suggests no confirmed in-the-wild exploitation yet. The publicly available proof-of-concept increases exploitation likelihood, though successful attacks require an application to pass unsanitized user input to the vulnerable method and a victim to open the resulting PDF. The attack's dependency on user interaction and the specific coding pattern reduces the likelihood of widespread automated exploitation, making this a medium-priority issue for most organizations despite the high CVSS score. |
| Exploit ScenarioDerived | An attacker could exploit this vulnerability by submitting malicious input through a web form that generates PDF reports, injecting a payload like '000000) /AA <</E <</S /Launch /F (calc.exe)>>>> (' into a color field. When an employee or customer opens the generated PDF, the injected JavaScript action executes, potentially launching system commands or exfiltrating data. The publicly available proof-of-concept demonstrates this exact attack pattern, making exploitation straightforward for attackers with basic knowledge of PDF internals. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Mar 17, 2026
A code injection vulnerability in the jsPDF library allows attackers to inject arbitrary PDF objects, including malicious JavaScript actions, through unsanitized user input to the createAnnotation method. The vulnerability affects jsPDF versions prior to 4.2.1 and enables remote attackers to execute arbitrary code when a victim opens or interacts with a maliciously crafted PDF file. A proof-of-concept exploit is publicly available demonstrating how to launch system executables like calc.exe through PDF action injection.
RemediationAI
Upgrade jsPDF to version 4.2.1 or later immediately, as confirmed in the vendor's security advisory at https://github.com/parallax/jsPDF/security/advisories/GHSA-7x6v-j9x4-qf24 and release notes at https://github.com/parallax/jsPDF/releases/tag/v4.2.1. If immediate patching is not possible, implement strict input validation and sanitization for any user-supplied data passed to the createAnnotation method, particularly the color parameter, ensuring no PDF object syntax can be injected. Review all code paths that generate PDFs with user input and implement defense-in-depth measures such as content security policies for generated PDFs.
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in npm
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
jsPDF is a popular JavaScript library for generating PDF documents in web browsers and Node.js environments, identified by CPE pkg:npm/jspdf. The vulnerability stems from improper output neutralization (CWE-116) in the createAnnotation method, specifically in how the 'color' parameter is processed without adequate sanitization. When creating PDF annotations, the library fails to properly escape or validate user-supplied input, allowing injection of raw PDF object syntax that can include action dictionaries with launch commands or JavaScript code that execute when the PDF is rendered or interacted with.
Know when the next one hits your stack
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N
Primary rating from NVD.
CVSS VectorNVD
Lifecycle Timeline
4DescriptionNVD
Impact
User control of arguments of the createAnnotation method allows users to inject arbitrary PDF objects, such as JavaScript actions.
If given the possibility to pass unsanitized input to the following method, a user can inject arbitrary PDF objects, such as JavaScript actions, which might trigger when the PDF is opened or interacted with..
createAnnotation:colorparameter
Example attack vector:
import { jsPDF } from 'jspdf'
const doc = new jsPDF();
const payload = '000000) /AA <</E <</S /Launch /F (calc.exe)>>>> (';
doc.createAnnotation({
type: 'freetext',
bounds: { x: 10, y: 10, w: 120, h: 20 },
contents: 'hello',
color: payload
});
doc.save('test.pdf');Patches
The vulnerability has been fixed in jsPDF@4.2.1.
Workarounds
Sanitize user input before passing it to the vulnerable API members.
Blast Radius
ecosystem impact- 810 npm packages depend on jspdf (518 direct, 297 indirect)
Ecosystem-wide dependent count for version 4.2.1.
Executive ViewAI
A critical vulnerability in the jsPDF library (CVE-2026-31898) enables attackers to execute arbitrary code on systems that open maliciously crafted PDF files, posing a direct threat to any organization using this library in web applications or document processing workflows. With a publicly available exploit and CVSS score of 8.1, this vulnerability requires immediate patching to prevent potential data theft, system compromise, or lateral movement within the organization.
Apply vendor patch. If immediate patching is not feasible, implement compensating controls: (1) disable PDF annotation functionality if not business-critical, (2) apply input validation and sanitization to block special characters and script payloads before they reach the createAnnotation method, (3) deploy WAF rules to detect and block suspicious PDF generation requests, (4) restrict PDF file execution in endpoints through application whitelisting, and (5) segment systems that process untrusted PDFs from critical infrastructure.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Code injection occurs when an application accepts user input and passes it directly into a language interpreter or evaluator without proper sanitization.
GHSA-7x6v-j9x4-qf24
NVD
CVE.org
EPSS
VulDB
Exploit-DB