There are a number of security attacks for JSON, especially XSRF.
The vulnerability is caused when a web service uses cookies for authentication and responds with a JSON array containing sensitive data in response to a GET request.
If an attacker can trick a user who is registered in the service, naive-webapp.com, to visit his site (or any site that has a managed IFRAME installed, for example, via in-line ads), then they can paste <script> from SRC to naive -webapp.com and potentially steal user data. It depends on javascript quirk with a JavaScript Array constructor as follows:
<script> </script> <script src="//naive-webapp.com/..."></script> <script> </script>
EcmaScript 5 fixed the confusing behavior that caused [] Array search for a global object, and many modern browsers are no longer prone to this attack.
By the way, Oil is wrong about unpredictable URLs. Cryptographically secure random identifiers in URLs are a great way to protect resources. Identity-based security is not a panacea, as Oil suggests. See http://waterken.sourceforge.net/ for an example of a secure distributed application scheme based on cryptographically secure identifiers in URLs that does not require the concept of identity.
EDIT:
When considering JSON vs XML, you should also be aware of attack-specific XML vectors.
XXE , XML Attacks of external objects, use processed XML to access the file system and network resources through a firewall.
<!DOCTYPE root [ <!ENTITY foo SYSTEM "file:///c:/winnt/win.ini"> ]> ... <in>&foo;</in>
The application inserts the input (the "in" parameter containing the win.ini file) into the web service response.
Mike Samuel Jan 09 '09 at 23:56 2009-01-09 23:56
source share