ABE Anonymize action not applied to JavaScript cookie access
Posted: Mon Jul 13, 2015 5:46 pm
JavaScript is able to read and write cookies despite ABE applying the Anonymize action 
NoScripters and WebSec nerds of all lands, unite!
https://forums.informaction.com/
I don't understand this claim. A CSRF attack doesn't involve any JavaScript loaded from the target (eg your bank). It's a blind request, with the attacker forbidden to read the response because it's cross-site. The whole attack is in the request (eg a request to transfer money to the attacker's account). Stripping your authentication from the request defeats the attack.RobertDrew wrote:An attacker's request can be used to achieve the same results if the target site uses JavaScript to interact with authentication cookies.
It can if the JavaScript happens to be involved in processing the cookies. Just like it can if PHP is used to do all of the cookie processing prior to page load.A CSRF attack doesn't involve any JavaScript loaded from the target (eg your bank).
The attacker does not need to see the response to exploit the issue in the scenario I have outlined.It's a blind request, with the attacker forbidden to read the response because it's cross-site.
The attack remains in the request, but the exploit is in the handling of the request in either case, whether that handling takes place before page load or after page load.The whole attack is in the request (eg a request to transfer money to the attacker's account).
Not if authentication cookies are processed with JavaScript. For example, an AJAX site might have JavaScript which takes authentication data from document.cookie, then transmits that data along with the specific request (e.g. transfer money) back to the server via XHR and waits for dynamic page content to load as result of that request. You and I may question the merits of that approach, but the reality is that a) we cannot rule out the possibility of a use case where something along those lines makes sense, and b) even if it isn't the best way to do things it doesn't mean it won't be done -- ultimately, NoScript is designed specifically to address the security failings of the developers behind our banks' (for example) sites. CSRF wouldn't be possible if Web application developers did everything right, but they don't, which is one of the reasons NoScript exists.Stripping your authentication from the request defeats the attack.
It would be protected if access to cookies were suppressed....Thrawn wrote:Any site that allows state-changing operations via GET is basically broken and can't be protected via the usual mechanisms. If you really want to protect it, you'll need to use Deny rather than Anonymize.
But that is a much more complex business than it might sound like.RobertDrew wrote:It would be protected if access to cookies were suppressed....Thrawn wrote:Any site that allows state-changing operations via GET is basically broken and can't be protected via the usual mechanisms.
Exactly my point when I say, "the site is basically broken and can't be protected via the usual mechanisms." If you can't trust links and redirects to be read-only, then you have to break the web to protect the site.Using Deny is not an appealing option ... with a blacklist approach, you would have to remember to add every site you have credentials for to your rulesets; with a whitelist approach, you would have to make exceptions for lots and lots of websites which would become broken as a result. Anonymize is a much more appealing option because it allows a blanket rule to be applied to protect all sites, and requires much fewer exceptions to be added to restore broken functionality along the way.
That is an interesting idea, but if you're going to fix it with user scripts, then you probably don't need to set such a flag at all. You could use a surrogate script to put a framebuster on the site to be protected, for example.If the developer doesn't wish to add cookie suppression for JavaScript, perhaps he would be willing to add a way for JavaScript to be able to detect that NoScript applied the Anonymize action (by setting a variable, say NoScriptABEAnonymized, to true)? This would allow a user to set up a GreaseMonkey script which suppresses cookie access in the relevant cases.
RobertDrew wrote:If the developer doesn't wish to add cookie suppression for JavaScript, perhaps he would be willing to add a way for JavaScript to be able to detect that NoScript applied the Anonymize action (by setting a variable, say NoScriptABEAnonymized, to true)?