VYPR
High severityNVD Advisory· Published Feb 19, 2026· Updated Feb 19, 2026

jsPDF's PDF Injection in AcroForm module allows Arbitrary JavaScript Execution (RadioButton.createOption and "AS" property)

CVE-2026-25940

Description

jsPDF is a library to generate PDFs in JavaScript. Prior to 4.2.0, 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 one of 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. The vulnerability has been fixed in jsPDF@4.2.0. As a workaround, sanitize user input before passing it to the vulnerable API members.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
jspdfnpm
< 4.2.04.2.0

Affected products

1

Patches

1
71ad2dbfa6c7

Merge commit from fork

https://github.com/parallax/jsPDFMacabelyFeb 19, 2026via ghsa
2 files changed · +42 3
  • src/modules/acroform.js+15 3 modified
    @@ -2143,7 +2143,11 @@ var AcroFormButton = function() {
           return _AS;
         },
         set: function(value) {
    -      _AS = value;
    +      var name = value === undefined || value === null ? "" : value.toString();
    +      if (name.substr(0, 1) === "/") {
    +        name = name.substr(1);
    +      }
    +      _AS = "/" + pdfEscapeName(name);
         }
       });
     
    @@ -2296,7 +2300,11 @@ var AcroFormChildClass = function() {
           return _AS;
         },
         set: function(value) {
    -      _AS = value;
    +      var name = value === undefined || value === null ? "" : value.toString();
    +      if (name.substr(0, 1) === "/") {
    +        name = name.substr(1);
    +      }
    +      _AS = "/" + pdfEscapeName(name);
         }
       });
     
    @@ -2313,7 +2321,11 @@ var AcroFormChildClass = function() {
           return _AS.substr(1, _AS.length - 1);
         },
         set: function(value) {
    -      _AS = "/" + value;
    +      var name = value === undefined || value === null ? "" : value.toString();
    +      if (name.substr(0, 1) === "/") {
    +        name = name.substr(1);
    +      }
    +      _AS = "/" + pdfEscapeName(name);
         }
       });
       this.caption = "l";
    
  • test/specs/acroform.spec.js+27 0 modified
    @@ -1162,5 +1162,32 @@ describe("Module: Acroform Integration Test", function() {
           expect(output).not.toContain("/AA <<");
           expect(output).toContain("#2FAA");
         });
    +    it("escapes malicious input in CheckBox AS", function() {
    +      var doc = new jsPDF();
    +      var field = new doc.AcroFormCheckBox();
    +      field.x = 10; field.y = 10; field.width = 20; field.height = 10;
    +      doc.addField(field);
    +
    +      field.AS = "/Off /AA << /E << /S /JavaScript /JS (app.alert(1)) >> >>";
    +
    +      var output = doc.output();
    +      expect(output).not.toContain("/AA << /E << /S /JavaScript");
    +      expect(field.AS).toContain("#2FAA");
    +    });
    +
    +    it("escapes malicious input in RadioButton child appearanceState", function() {
    +      var doc = new jsPDF();
    +      var group = new doc.AcroFormRadioButton();
    +      group.x = 10; group.y = 10; group.width = 20; group.height = 10;
    +      doc.addField(group);
    +
    +      var 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(1)) >> >>";
    +
    +      var output = doc.output();
    +      expect(output).not.toContain("/AA << /E << /S /JavaScript");
    +      expect(child.AS).toContain("#2FAA");
    +    });
       });
     });
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

5

News mentions

0

No linked articles in our index yet.