CVE-2026-31898: jsPDF has a PDF Object Injection via FreeText color
jsPDF is a library to generate PDFs in JavaScript. Prior to version 4.2.1, 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 the `createAnnotation`: `color` parameter. The vulnerability has been fixed in jsPDF@4.2.1. As a workaround, sanitize user input before passing it to the vulnerable API members.
Security readout for executives and security teams
Plain-English summary
Applications using vulnerable jsPDF versions may let an attacker turn an unsanitized annotation color into malicious PDF content, including JavaScript actions. The action might run when a recipient opens or interacts with the generated PDF. This creates serious confidentiality and integrity risk, but requires a vulnerable application flow and user interaction.
Executive priority
Treat as a prompt remediation item for systems generating PDFs from external input. Prioritize confirmation of reachable createAnnotation flows, then upgrade to 4.2.1 or later. Urgency is high because potential impacts are severe, although the available sources do not establish active exploitation or universal exposure.
Technical view
Before jsPDF 4.2.1, createAnnotation does not safely neutralize attacker-controlled color input, permitting arbitrary PDF object injection. The advisory identifies JavaScript actions as one possible injected object. CVSS 3.1 scores it 8.1: network-reachable, low complexity, no privileges required, user interaction required, with high confidentiality and integrity impact.
Likely exposure
Exposure exists where jsPDF earlier than 4.2.1 is deployed and untrusted data can reach createAnnotation's color parameter without effective sanitization. Internet-facing PDF-generation workflows and applications producing PDFs later opened by employees, customers, or partners deserve priority. Merely having jsPDF installed does not establish an exploitable path.
Exploitation context
The supplied record does not identify known active exploitation, and the CVE is not listed as KEV. Exploitation requires attacker control over the relevant input and a recipient opening or interacting with the resulting PDF. Whether an injected action triggers may depend on the PDF viewer and its security settings.
Researcher notes
The issue maps to CWE-116 and CWE-94 and concerns PDF syntax/object injection through the FreeText annotation color value. Review the linked vulnerable code and fixing commit when assessing custom forks or backports. Validate data flow and output structure without assuming every jsPDF installation calls the affected API or every viewer executes injected actions.
Mitigation direction
Upgrade jsPDF to version 4.2.1 or later.
Sanitize untrusted values before passing them to createAnnotation.
Restrict annotation color inputs to an explicit, validated format.
Prioritize services that generate PDFs from unauthenticated or externally supplied data.
Consult the jsPDF advisory and release notes before deploying the update.
Validation and detection
Inventory direct and transitive jsPDF versions across build and deployment artifacts.
Search application code for createAnnotation calls and trace the color argument's origin.
Confirm untrusted input cannot reach the color parameter without strict validation.
Verify production artifacts resolve jsPDF 4.2.1 or later.
Run regression tests confirming rejected inputs cannot alter generated PDF object structure.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · medium confidence lookup
CWE-116: User-session and phishing behavior lookup
Client-side and session-facing weaknesses should be reviewed alongside initial-access and user-execution behaviors. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
Code execution and unsafe deserialization weaknesses often justify reviewing execution behavior and process telemetry. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
2CVSS vectors
5Timeline events
2ADP providers
10Source links
SSVC decision data
CISA-ADPCISA Coordinator
Timestamp
Version
2.0.3
Exploitation: noneAutomatable: noTechnical Impact: total
CVSS vector scores
2 official scores
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-116 · source CWE mapping
Improper Encoding or Escaping of Output
Improper Encoding or Escaping of Output represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.
Improper Control of Generation of Code ('Code Injection')
Improper Control of Generation of Code ('Code Injection') represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.