Sunday, September 13, 2026

jsPDF Flaw Exposes Millions of Developers to Object Injection

A serious security flaw in jsPDF, a widely used JavaScript library for generating PDFs in web browsers, puts millions of developers and their users at risk.

CVE-2026-25755 allows attackers to perform PDF Object Injection through the library’s addJS method. This vulnerability affects countless web applications that rely on jsPDF to create dynamic PDF documents from user data.

It carries a CVSS score of 8.8, rated High severity. Attackers can craft malicious inputs that escape the intended JavaScript context and inject harmful PDF structures directly into generated files.

jsPDF powers features like invoice generation, report exports, and form submissions across e-commerce sites, dashboards, and enterprise tools.

jsPDF Flaw Exposes Millions of Developers

With over 1.5 million weekly downloads on npm, its popularity amplifies the threat. An attacker supplying tainted input, such as user comments or form fields, can trigger the flaw, producing PDFs that execute arbitrary actions when opened in any viewer.

The core issue lies in jsPDF’s javascript.js file. The addJS method directly concatenates user input into a PDF stream without proper sanitization. The vulnerable code reads: this.internal.out("/JS (" + text + ")");.

By including a closing parenthesis ) in the input, attackers prematurely end the JavaScript string. They then append PDF syntax  >> /AA << /O << /S /JavaScript /JS (app.alert('Hacked!')) >> >> to inject an “Additional Action” dictionary.

Unlike typical XSS attacks, this manipulates the PDF’s object hierarchy, bypassing JavaScript sandboxes in viewers like Adobe Acrobat.

JavaScript-Independent Execution: Malicious actions /OpenAction can still be triggered even when JavaScript is disabled in the victim’s PDF viewer.

Document Structure Tampering: Attackers can inject objects like /Encrypt, /Signatures, or /Annots to manipulate document metadata, alter security properties, or enable UI redressing and phishing attacks.

Cross-Viewer Payload Reliability: The injected objects are parsed and executed by lightweight or embedded PDF viewers that may not support JavaScript but strictly adhere to the PDF object hierarchy, allowing consistent payload execution across platforms.

CVE IDCVSS ScoreDescription
CVE-2026-257558.8 (High)PDF Object Injection in jsPDF’s addJS method due to unsanitized input allowing escape of JS context and arbitrary PDF dictionary injection.

A proof-of-concept demonstrates the danger. Developers import jsPDF, create a document, and pass a payload like "console.log('test');) >> /AA << /O << /S /JavaScript /JS (app.alert('Hacked!')) >> >>" to addJS.

According to this advisory, saving the PDF triggers an alert on open, proving remote code-like behavior via PDF actions.

Affected VersionsPatched Versions
< 4.1.0>= 4.1.0

To fix this, upgrade jsPDF to version 4.1.0 or later immediately. The patch escapes parentheses () and backslashes \ per PDF specs in addJS and related methods.

Developers should rigorously validate all inputs to prevent untrusted data from being used in PDF generation. Scan dependencies with tools like npm audit or Snyk.

Test generated PDFs in multiple viewers for anomalies. Enterprises using jsPDF in production workflows must prioritize patches, as unpatched apps risk supply-chain-style attacks.

Follow us on Google NewsLinkedIn, and X to Get Instant Updates and Set GBH as a Preferred Source in Google.

Divya
Divya
Divya is a Senior Journalist at GBhackers covering Cyber Attacks, Threats, Breaches, Vulnerabilities and other happenings in the cyber world.

Hot this week

How To Access Dark Web Anonymously and know its Secretive and Mysterious Activities

What is Deep Web The deep web, invisible web, or...

How to Build and Run a Security Operations Center (SOC Guide) – 2023

Today’s Cyber security operations center (CSOC) should have everything...

Russian Hackers Bypass EDR to Deliver a Weaponized TeamViewer Component

TeamViewer's popularity and remote access capabilities make it an...

Web Server Penetration Testing Checklist – 2026

Web server pentesting is performed under three significant categories: identity,...

ATM Penetration Testing – Advanced Testing Methods to Find The Vulnerabilities

ATM Penetration testing, Hackers have found different approaches to...

Threat Actors Use Claude AI Agents to Automate Cyberattacks and Steal Sensitive Data

Threat actors are increasingly using Claude-based AI workflows to...

China-Linked Hackers Chain Chrome Zero-Day With Windows Kernel Flaw in Attacks

China-linked threat actors UTA0560 and JungleBamboo chained a Google...

New Phishing Campaign Abuses Windows Mshta.exe to Steal Credentials and Secrets

A newly identified phishing campaign is abusing the legitimate...

CISA Warns of Critical GitLab Vulnerability Exploited in Attacks

The U.S. Cybersecurity and Infrastructure Security Agency (CISA) has...

Researchers Uncover 10,000+ Malware Loaders Behind YouTube and SEO Poisoning Campaign

A long-running pay-per-install (PPI) operation that used YouTube gaming...

VLC Media Player Flaws Let Attackers Corrupt Memory and Leak Sensitive Data

Two security vulnerabilities in VLC media player versions 3.0.0...

CISA Adds Exploited MikroTik RouterOS Flaws to Security Alert

The U.S. Cybersecurity and Infrastructure Security Agency (CISA) has...

Related Articles

Recent News