XSS from JSON outputs

In the book “XSS Attacks – Exploits and Defense” Jeremiah Grossman writes:

The exploit found in Google’s reader was due to the developers thinking that JSON was only going to be viewed by the calling script.The developers never realized that attackers could send users directly to the JSON output. While AJAX and JSON do not generally introduce new holes per se, they definitely can increase the attacker’s surface area.

I thing there is no way for the attacker to force victim’s browser to run javascript from JSON directly. Is there any example that shows the authors intended purpose?

Continue reading XSS from JSON outputs

Does appending data from a form to a URL with encodeURIComponent safely sanitize user input?

In my web app, I want to send a cross-domain AJAX request to another site. I want to take the text that the user enters in a form and append that text to the query string in the URL I send the request to, so I escape the user… Continue reading Does appending data from a form to a URL with encodeURIComponent safely sanitize user input?

Does appending data from a form to a URL with encodeURIComponent safely sanitize user input?

In my web app, I want to send a cross-domain AJAX request to another site. I want to take the text that the user enters in a form and append that text to the query string in the URL I send the request to, so I escape the user’s text using … Continue reading Does appending data from a form to a URL with encodeURIComponent safely sanitize user input?