[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[WEB SECURITY] attribute based XSS
- From: "Brian Eaton" <eaton.lists@xxxxxxxxx>
- Subject: [WEB SECURITY] attribute based XSS
- Date: Fri, 27 Jul 2007 22:07:18 -0700
I've been trying to get involved in a discussion about "attribute
based cross-site-scripting" on Jeremiah's blog, but for some reason
convincing blogger to let me post a decent XSS example has been kind
of tricky.
Here's Jeremiah's original post:
http://jeremiahgrossman.blogspot.com/2007/07/attribute-based-cross-site-scripting.html
The point I tried (and completely failed) to make on the blog is that
using HTML entities as an anti-XSS measure does not work if the
attacker controlled data lands in an HTML attribute that the browser
interprets as a URI.
For example, consider an application that puts attacker controlled
data in an href tag:
<a href="ATTACKERCONTROLLED">blah</a>
The attacker could achieve XSS with this by creating code like this:
<a href="javascript:alert('xss')">blah</a>
The normal anti-XSS measure of entity encoding does not work to stop
the XSS. For example, firefox 2.0.0.5 (and probably other browsers,
I'm too lazy to check right now) will execute the javascript even if
every single character is HTML entity encoded:
<a href="javascript:alert('xss')">foo</a>
I think a more appropriate mitigation here is URI encoding, but that
has to be done carefully to avoid changing the semantics of any good
URIs you're trying to embed.
(BTW, I claim no novelty in this, I picked up this vector from
http://ha.ckers.org/xss.html. I'm not sure who sent it to RSnake
originally.)
Cheers,
Brian
----------------------------------------------------------------------------
Join us on IRC: irc.freenode.net #webappsec
Have a question? Search The Web Security Mailing List Archives:
http://www.webappsec.org/lists/websecurity/
Subscribe via RSS:
http://www.webappsec.org/rss/websecurity.rss [RSS Feed]
Brought to you by http://www.webappsec.org
Search this site
|