CVE-2026-25940: Jspdf JsPDF Has A PDF Injection Vulnerability

HIGH
Advisory Identifier: GHSA-p5xg-68wr-hm3m
CVSS 8.1
CWE-116
Published
Advisory Summary

CVE-2026-25940 is a HIGH (CVSS 8.1) jspdf has a pdf injection vulnerability (CWE-116: Improper Encoding or Escaping of Output) affecting Jspdf libraries in the npm ecosystem. The issue involves jspdf has a pdf injection in acroform module allows arbitrary javascript execution (radiobutton.createoption and "as" property). Remediation is available by upgrading affected packages to version 4.2.0.

CVE-2026-25940 at a Glance

CVE Identifier CVE-2026-25940
GHSA Identifier GHSA-p5xg-68wr-hm3m
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-116: Improper Encoding or Escaping of Output
Affected Product Jspdf
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2026-25940

To remediate this vulnerability, upgrade all affected Jspdf dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

jspdf fixed: 4.2.0
npm install jspdf@4.2.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls jspdf

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-25940, inspect your project dependencies using npm:

npm ls jspdf

Analyze the terminal output to locate any version of Jspdf in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.2.0), your application is affected.

Note: The npm ls jspdf command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-116: Improper Encoding or Escaping of Output, where the product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. as a result, the intended structure of the message is not preserved. In Jspdf, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact User control of properties and methods of the Acroform module allows users to inject arbitrary PDF objects, such as JavaScript actions. If given the possibility to pass unsanitized input to the following property, a user can inject arbitrary PDF objects, such as JavaScript actions, which are executed when the victim hovers over the radio option. * `AcroformChildClass.appearanceState` Example attack vector: ```js import { jsPDF } from "jspdf" const doc = new jsPDF(); const group = new doc.AcroFormRadioButton(); group.x = 10; group.y = 10; group.width = 20; group.height = 10; doc.addField(group); const child = group.createOption("opt1"); child.x = 10; child.y = 10; child.width = 20; child.height = 10; child.appearanceState = "Off /AA << /E << /S /JavaScript /JS (app.alert('XSS')) >> >>"; doc.save("test.pdf"); ``` ### Patches The vulnerability has been fixed in jsPDF@4.2.0. ### Workarounds Sanitize user input before passing it to the vulnerable API members.

CVE-2026-25940 Affected Jspdf Versions

1 component(s)
Fixed Versions:
4.2.0
Product / Package Ecosystem Affected Versions Fixed Version
jspdf
npm
< 4.2.0
4.2.0

References

Frequently Asked Questions

What is CVE-2026-25940?
CVE-2026-25940 is a security vulnerability in Jspdf involving jsPDF has a PDF Injection in AcroForm module allows Arbitrary JavaScript Execution (RadioButton.createOption and "AS" property) under CWE-116: Improper Encoding or Escaping of Output.
Which Jspdf versions are affected?
Affected versions include releases prior to 4.2.0 across affected packages: jspdf.
What version fixes CVE-2026-25940?
Upgrading to 4.2.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is jspdf affected?
Yes, jspdf is affected in releases prior to 4.2.0. Upgrade your dependency to 4.2.0 or later.
What is the CVSS score of CVE-2026-25940?
CVE-2026-25940 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2026-25940?
CVE-2026-25940 is classified under CWE-116: Improper Encoding or Escaping of Output (The product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. As a result, the intended structure of the message is not preserved.).
How can I check npm dependencies for CVE-2026-25940?
Run the dependency tree command: 'npm ls jspdf'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-p5xg-68wr-hm3m",
  "modified" : "2026-03-11T20:33:57Z",
  "published" : "2026-02-19T19:32:48Z",
  "aliases" : [ "CVE-2026-25940" ],
  "summary" : "jsPDF has a PDF Injection in AcroForm module allows Arbitrary JavaScript Execution (RadioButton.createOption and \"AS\" property)",
  "details" : "### Impact\n\nUser control of properties and methods of the Acroform module allows users to inject arbitrary PDF objects, such as JavaScript actions.\n\nIf given the possibility to pass unsanitized input to the following property, a user can inject arbitrary PDF objects, such as JavaScript actions, which are executed when the victim hovers over the radio option.\n\n* `AcroformChildClass.appearanceState`\n\nExample attack vector:\n\n```js\nimport { jsPDF } from \"jspdf\"\nconst doc = new jsPDF();\n\nconst group = new doc.AcroFormRadioButton();\ngroup.x = 10; group.y = 10; group.width = 20; group.height = 10;\ndoc.addField(group);\n\nconst child = group.createOption(\"opt1\");\nchild.x = 10; child.y = 10; child.width = 20; child.height = 10;\nchild.appearanceState = \"Off /AA << /E << /S /JavaScript /JS (app.alert('XSS')) >> >>\";\n\ndoc.save(\"test.pdf\");\n```\n\n### Patches\n\nThe vulnerability has been fixed in jsPDF@4.2.0.\n\n### Workarounds\nSanitize user input before passing it to the vulnerable API members.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "jspdf"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.2.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/parallax/jsPDF/security/advisories/GHSA-p5xg-68wr-hm3m"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-25940"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/parallax/jsPDF/commit/71ad2dbfa6c7c189ab42b855b782620fa8a38375"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/parallax/jsPDF"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/parallax/jsPDF/releases/tag/v4.2.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-116" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-02-19T19:32:48Z",
    "nvd_published_at" : "2026-02-19T16:27:15Z"
  }
}