CVE-2026-31898

jsPDF has a PDF Object Injection via FreeText color

State
Published
Severity
8.1 High
Published
Mar 18, 2026
Updated
Sep 7, 2026
Reserved
Mar 9, 2026

Read the record on cve.org

Description

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.

Scores

CVSSScoreVectorSource
3.18.1 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:NGitHub_M
3.18.1 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:Nredhat-SADP

Weaknesses

  • CWE-116 Improper Encoding or Escaping of Output
  • CWE-94 Improper Control of Generation of Code ('Code Injection')

Affected Products

ProductVersions
jsPDFparallax
  • < 4.2.1Affected

References

Every record here comes from the CVE Program’s CVE List. © 1999–2026 The MITRE Corporation. CVE is a registered trademark of The MITRE Corporation. The records are reproduced under the CVE Program terms of use.