CVE-2025-53626: @pdfme/common Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-54xv-94qv-2gfg
CVSS 6.1
CWE-1321 CWE-79
Published
Advisory Summary

CVE-2025-53626 is a MODERATE (CVSS 6.1) cross-site scripting vulnerability (CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')) affecting @pdfme/common libraries in the npm ecosystem. The issue involves @pdfme/common vulnerable to to xss and prototype pollution through its expression evaluation. Remediation is available by upgrading affected packages to version 5.4.1.

CVE-2025-53626 at a Glance

CVE Identifier CVE-2025-53626
GHSA Identifier GHSA-54xv-94qv-2gfg
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
Affected Product @pdfme/common
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.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:C/C:L/I:L/A:N).

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

How to Fix CVE-2025-53626

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

@pdfme/common fixed: 5.4.1
npm install @pdfme/common@5.4.1
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 @pdfme/common

How to Check if You Are Affected

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

npm ls @pdfme/common

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

Note: The npm ls @pdfme/common 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-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution'), where the product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype. In @pdfme/common, 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

## 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: ```javascript // 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)`: ```json { "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" } ```

CVE-2025-53626 Affected @pdfme/common Versions

1 component(s)
Fixed Versions:
5.4.1
Product / Package Ecosystem Affected Versions Fixed Version
@pdfme/common
npm
≥ 5.2.0
< 5.4.1
5.4.1

References

Frequently Asked Questions

What is CVE-2025-53626?
CVE-2025-53626 is a security vulnerability in @pdfme/common involving @pdfme/common vulnerable to to XSS and Prototype Pollution through its expression evaluation under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution').
Which @pdfme/common versions are affected?
Affected versions include releases prior to 5.4.1 across affected packages: @pdfme/common.
What version fixes CVE-2025-53626?
Upgrading to 5.4.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @pdfme/common affected?
Yes, @pdfme/common is affected in releases prior to 5.4.1. Upgrade your dependency to 5.4.1 or later.
What is the CVSS score of CVE-2025-53626?
CVE-2025-53626 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2025-53626?
CVE-2025-53626 is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution') (The product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype.).
How can I check npm dependencies for CVE-2025-53626?
Run the dependency tree command: 'npm ls @pdfme/common'. 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-54xv-94qv-2gfg",
  "modified" : "2025-07-10T23:23:06Z",
  "published" : "2025-07-10T17:43:52Z",
  "aliases" : [ "CVE-2025-53626" ],
  "summary" : "@pdfme/common vulnerable to to XSS and Prototype Pollution through its expression evaluation",
  "details" : "## Summary\nThe 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.\n\n## Details\n\n### 1. Sandbox Escape Leading to XSS\n\nThe expression evaluator's sandbox can be bypassed to execute arbitrary JavaScript code. Attackers can obtain the Function constructor through indirect methods:\n\n```javascript\n// Attack vector 1: Using Object.getOwnPropertyDescriptor\n{ ((f, g) => f(g(Object), \"constructor\").value)(Object.getOwnPropertyDescriptor, Object.getPrototypeOf)(\"alert(location)\")() }\n\n// Attack vector 2: Using object property access\n{ { f: Object.getOwnPropertyDescriptor }.f({ g: Object.getPrototypeOf }.g(Object), \"constructor\").value(\"alert(location)\")() }\n```\n\nBoth payloads bypass the sandbox restrictions and execute `Function(\"alert(location)\")()`.\n\n### 2. Prototype Pollution\n\nThe expression evaluator allows access to prototype accessor methods which can be exploited with Object.assign to pollute the prototype chain:\n- `__lookupGetter__`\n- `__lookupSetter__`\n- `__defineGetter__`\n- `__defineSetter__`\n\n## Impact\n\nThese vulnerabilities allow attackers to:\n- Execute arbitrary JavaScript code in the context of the application\n- Steal sensitive information including cookies and tokens\n- Modify application behavior through prototype pollution\n- Potentially perform actions on behalf of users\n\n## Proof of Concept\n\nLoading the following template in pdfme triggers `alert(location)`:\n\n```json\n{\n  \"schemas\": [[{\n    \"name\": \"field1\",\n    \"type\": \"text\",\n    \"content\": \"{ ((f, g) => f(g(Object), 'constructor').value)(Object.getOwnPropertyDescriptor, Object.getPrototypeOf)('alert(location)')() }\",\n    \"position\": { \"x\": 0, \"y\": 0 },\n    \"width\": 100,\n    \"height\": 100\n  }]],\n  \"basePdf\": { \"width\": 100, \"height\": 100 },\n  \"pdfmeVersion\": \"5.4.0\"\n}\n```",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@pdfme/common"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.2.0"
      }, {
        "fixed" : "5.4.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/pdfme/pdfme/security/advisories/GHSA-54xv-94qv-2gfg"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-53626"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pdfme/pdfme/pull/1117"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pdfme/pdfme/commit/0dd54739acff2c249ed68c001a896bee38f0fd85"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/pdfme/pdfme"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pdfme/pdfme/releases/tag/5.4.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1321", "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-07-10T17:43:52Z",
    "nvd_published_at" : "2025-07-10T19:15:27Z"
  }
}