r/programming • u/alcuadrado • Aug 10 '12
Write any javascript code with just these characters: ()[]{}+!
http://patriciopalladino.com/blog/2012/08/09/non-alphanumeric-javascript.html
1.3k
Upvotes
r/programming • u/alcuadrado • Aug 10 '12
0
u/__j_random_hacker Aug 12 '12
But is it correct that to actually execute the script, you need to include the text
evalorFunctionnear the start? That's what I want to know.It seems to me that using your approach, you can produce any abitrary string, which of course may contain a legal Javascript program and so may produce arbitrary behaviour if it is evaled, but the only code you can directly run this way is a single expression that evaluates to a single data structure (like a boolean, a number, a string, or a possibly multilevel array or hash of such). If that's the case, then there's no security risk here (unless the website being targeted evals user input twice).