Created
June 9, 2017 09:59
-
-
Save kochmaxence/4dc3415899d0273463ffd37fdc783dea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
})(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi