GHSA-m9hw-7xfv-wqg7 Prototype Pollution in json-logic-js
Prototype pollution in json-logic-js allows attackers to inject code via malicious rules, leading to remote code execution.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is GHSA-m9hw-7xfv-wqg7?
GHSA-m9hw-7xfv-wqg7 is a code injection vulnerability in json-logic-js, published on 12 Nov 2020. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
Versions of json-logic-js prior to 2.0.0 are vulnerable to Prototype Pollution. The method operation allows a malicious user to modify the prototype of Object through the method property name. This causes modification of any existing property that will exist on all objects and leads to Remote Code Execution.
The following rule creates a popup when run from a browser:
{
"method": [
{
"method": [
{
"var": "__proto__.constructor.is.__proto__"
},
"constructor",
[
"var x = 'SECURITY!'; console.log(x, window.fetch); alert(x)"
]
]
},
"call"
]
}
Which versions are affected by GHSA-m9hw-7xfv-wqg7?
2 open source packages ship an affected version, including json-logic-js.
| Package | Affected | Fixed in |
|---|---|---|
json-logic-js npm | All versions | 2.0.0 |
json-logic-js npm | All versions | 2.0.0 |
How do I fix GHSA-m9hw-7xfv-wqg7?
Upgrade json-logic-js to 2.0.0 or later.
Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.
Is GHSA-m9hw-7xfv-wqg7 being exploited?
There is no known exploitation of GHSA-m9hw-7xfv-wqg7 in the wild and no public exploit code.