Re:JSON is not as safe as people think it is
by jcampbell1 on Wednesday March 27, 2013 @11:18AM
(#5449886)
This has nothing to do with executing foreign code with eval.
Here is how the the attack was performed. On my site, I rewrite the Array constructor. I then add
<script src="http://gmail.com/mycontacts.json"></script>
Now you visit my site, and I now have stolen all your Google contacts, which are protected by your google password.You see this has nothing to do with "eval".
Re:JSON is not as safe as people think it is
by sluu99 on Wednesday March 27, 2013 @11:28AM
(#5449952)
That's why google starts their json with while(1); (or something like that) so any effort attempting to evaluate the json itself as javascript code will be stuck in an infinite loop.
Re:JSON is not as safe as people think it is
by tocomment on Wednesday March 27, 2013 @12:35PM
(#5450407)
I don't understand. Aren't there cross site scripting restrictions?
Re:JSON is not as safe as people think it is
by Zarel on Wednesday March 27, 2013 @12:56PM
(#5450537)
XSS restrictions generally apply to things such as making XmlHttpRequests from other sites. Loading scripts from other sites generally isn't restricted, since it's used for a variety of legitimate things such as loading jQuery from a CDN.
Executing foreign code with eval is bad. Parsing foreign text is not. It was a problem when people misused browsers to conflate them.