CVE-2025-53626:
@pdfme/common vulnerable to to XSS and Prototype Pollution through its expression evaluation
6.1
Basic Information
Technical Details
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
@pdfme/common | npm | >= 5.2.0, < 5.4.1 | 5.4.1 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability exists in the expression evaluation functionality of the @pdfme/common
package. The root cause is insufficient sandboxing and validation of user-provided expressions, which allows for sandbox escape leading to Cross-Site Scripting (XSS) and Prototype Pollution.
The analysis of the provided patch 0dd54739acff2c249ed68c001a896bee38f0fd85
reveals that the core of the vulnerability lies within the replacePlaceholders
function and the AST evaluation functions it calls, namely evaluateAST
and validateAST
.
The patch introduces several security enhancements:
- Safe Object: It replaces the global
Object
with asafeObject
that omits dangerous methods likegetOwnPropertyDescriptor
,getPrototypeOf
, anddefineProperty
. - Prototype Pollution Prevention: It explicitly blocks access to properties like
__proto__
,constructor
, and methods like__defineGetter__
,__lookupGetter__
within thevalidateAST
andevaluateAST
functions. - Safe Object.assign: It introduces a
safeAssign
function to prevent prototype pollution when usingObject.assign
.
The replacePlaceholders
function is the primary entry point for this vulnerability, as it orchestrates the parsing and evaluation of potentially malicious expressions. The evaluateAST
and validateAST
functions are the core components that failed to prevent the exploitation. Therefore, any runtime profile during an exploit would likely show these functions in the stack trace.
Vulnerable functions
replacePlaceholders
packages/common/src/expression.ts
evaluateAST
packages/common/src/expression.ts
validateAST
packages/common/src/expression.ts