Created
November 4, 2019 20:57
-
-
Save fennifith/4b6a97bb335dc747f30872a08fc96ef9 to your computer and use it in GitHub Desktop.
JavaScript regex code injection.
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
function f() { | |
console.log("hello"); | |
console.log("steve"); | |
} | |
f = new Function(/\{([\S\s]*)\}/.exec(f.toString())[1].replace('hello', 'goodbye')); | |
f(); // "goodbye steve" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🐴