Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prototype pollution in function consolidate.teacup.render #349

Open
lelecolacola123 opened this issue Dec 9, 2022 · 3 comments
Open

Prototype pollution in function consolidate.teacup.render #349

lelecolacola123 opened this issue Dec 9, 2022 · 3 comments

Comments

@lelecolacola123
Copy link

Affected versions of this package are vulnerable to Prototype Pollution which can allow an attacker to add/modify properties of the Object.prototype.Consolidate runs the risk of Prototype Pollution when using the function teacup.render. The function use vm and coffee.compile lead an attacker to modify properties of the Object.prototype.
the risk locate is in here

vm.runInNewContext(coffee.compile(str), sandbox);

and the POC is as follow:
var consolidate = require("consolidate")
console.log({}.test)
consolidate.teacup.render("proto.test=123")
console.log({}.test) //123

the function teacup.render in the file consolidate/lib/consolidate.js in the line L1756, by using the vm,change the Object.prototype.you didn't have the protection or identify whether the object maybe polluted,so if an attacker manipulates these attributes to overwrite, or pollute, a JavaScript application object prototype of the base object by injecting other values.

@titanism
Copy link

titanism commented Jun 8, 2023

We have forked this repository for maintenance and released it under @ladjs/consolidate, see https://github.com/ladjs/consolidate.js. We have merged PR's and updated it for email-templates. Please click the "Watch" button to get notified of all releases at https://github.com/ladjs/consolidate.js. Thank you 🙏

Screen Shot 2023-06-08 at 3 05 12 PM

@justinvforvendetta
Copy link

@titanism where can we find the sha512 for the new releases like 1.1.3? thanks!

@harryzcy
Copy link

harryzcy commented Mar 9, 2024

@titanism Can you enable issues on your fork? thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants