Skip to content

Instantly share code, notes, and snippets.

@kochmaxence
Created June 9, 2017 09:59
Show Gist options
  • Save kochmaxence/4dc3415899d0273463ffd37fdc783dea to your computer and use it in GitHub Desktop.
Save kochmaxence/4dc3415899d0273463ffd37fdc783dea to your computer and use it in GitHub Desktop.
new (function() {
const someObject = {
config: {
key: {
hello: 'world',
hola: 'friend'
}
}
};
const inputFromSomewhere = `hello="friend"
;;; // malicious input starts here
var oFn = Math.random;
Math.random = (...args) => console.log(process.env) || oFn(...args);` // this could be even way worse if Proxy is used.
eval(`someObject.config.key.${inputFromSomewhere}`); // dev thought it'd be awesome to do a dynamic assignment. Meh. No.
console.log(Math.random());
console.log(someObject.config.key.hello);
})();
@johnniemyk
Copy link

Hi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment