Full Disclosure mailing list archives
Re: Pros and cons of 'Access-Control-Allow-Origin' header?
From: Michele Orru <antisnatchor () gmail com>
Date: Thu, 23 Feb 2012 00:25:04 +0100
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Michal Zalewski wrote:
Does 'Access-Control-Allow-Origin' header provide any benefits in defending against cross site scripting attacks?No. It's a mechanism to control cross-origin XMLHttpRequests (and some other peripheral things), and adding it does not reduce the likelihood or exploitability of XSS bugs. If you use it incorrectly, you may end up removing most of the security assurances provided by the same-origin policy, but that's a separate topic.Doesn't 'Access-Control-Allow-Origin' header make any XSS flaw trivially exploitable? For example, if an attacker finds an XSS flaw in a web application, he can now inject a JavaScript with XMLHttpRequest that sends a request to attacker's web server which serves resources with the HTTP header "Access-Control-Allow-Origin: *". The browser would see this header and fetch the resource from the attacker's web server.If you have an XSS vulnerability, there are many simpler ways to relay data to an attacker-controlled site without the need to use CORS.
@DavidBlanc what Michal said is what I meant before, and what we're actually doing in BeEF :-) If you have an XSS of whatever of the 3 types, you are already pwned, meaning that whoever exploits the XSS loading an external JS is controlling your browser across the whole domain of the vulnerable webapp (SOP restrictions applied, unless you don't have a 0day, use CORS, etc..) Specifically in BeEF we use Access-Control-Allow-Origin with a wildcard just because we cannot know in advance all the browsers that will be hooked. BTW, not to re-quote mz, but his latest book is a great resource to clarify your questions :D Cheers antisnatchor
/mz _______________________________________________ Full-Disclosure - We believe in it. Charter: http://lists.grok.org.uk/full-disclosure-charter.html Hosted and sponsored by Secunia - http://secunia.com/
-----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJPRXlQAAoJEBgl8Z+oSxe4uxQH/04wZ4Rl1GLiLs+CrV19KqKF 9Ymjs2Rn5gvR5vSjTpIDEcfuw/NX52lxHBkempaXau/i021N4TTUgv2LX3BRo4YT oUyK3QzN1JuPfGclL+xRalV+3Kl67Kvdngm72Prm5V1Om4zcF4aCGXpCF/iMpp+4 nNRlFK3XKPCT6dZFeV2Skwy9EDVGwGNrEXmFT6xYfUjzAxDxBKr92dGs3icQiWDK BahWu2Zi70F+wszUPEMDzkw16savz1ra+STVx6uge7797cspvY8HP090CVkPrT4u PVDfiWSAKPE9xt5u52en98p43Gw+nBeJNThTwdSw/f9gAgPKYtf8WjkvceR+LXU= =0N+e -----END PGP SIGNATURE----- _______________________________________________ Full-Disclosure - We believe in it. Charter: http://lists.grok.org.uk/full-disclosure-charter.html Hosted and sponsored by Secunia - http://secunia.com/
Current thread:
- Pros and cons of 'Access-Control-Allow-Origin' header? David Blanc (Feb 22)
- Re: Pros and cons of 'Access-Control-Allow-Origin' header? Michele Orru (Feb 22)
- Re: Pros and cons of 'Access-Control-Allow-Origin' header? David Blanc (Feb 22)
- Re: Pros and cons of 'Access-Control-Allow-Origin' header? Michal Zalewski (Feb 22)
- Re: Pros and cons of 'Access-Control-Allow-Origin' header? Michele Orru (Feb 22)
- Re: Pros and cons of 'Access-Control-Allow-Origin' header? Michele Orru (Feb 22)