List of Glory:
?xss=%20name=getElementsByTagName%20onerror=alert(1)%20
.
It worked perfectly in all browsers. Why? The answer is simple - modern browsers as well as the older ones create references for HTML
elements in the DOM in case certain criteria are met. Gareth gave the image a name
attribute. So the image is supposed to appear as a
variable in the DOM - precisely a child of document. Try it out - it works. I should have known since I published on that in 2008.
Doh. Most people know that id
attributes are dangerous -- name
is still allowed by many filters nevertheless.
<img src=whatever name=test>
result in the image being contained in document.test
.
Since the browsers don't really care if something with the same name already exists, they overwrite what's there and thus
transform document.getElementsByTagName()
into a property pointing to the image tag - rather than a function.
So my loop didn't work anymore, the sanitation broke and he successfully bypassed my filter code. Job well done :)getElementsByTagName
was frozen. Later I changed it to querySelectAll
.
image.attributes
- but finding only a single attribute property rather than an array. Overwriting attributes
by making it an attribute. Priceless.
Exception, business logic was broken, code was bypassed. Awesome work! ?xss=%0Aname=attributes%0Aonclick=alert(1)%0A
My fix was here to set the doctype for IE to force it to
render in IE9 mode -- and adding the mentioned frame headers. This specific attack is as far as I know only possible in older document modes.href
with a JavaScript URI and then - after my page had loaded allowed and the script business logic failed
due to the sandbox, enabled JavaScript for the IFrame again. Thus my code did not run -- but the JavaScript URI could be clicked again.
onpropertychange
working on IE9 and thereby effectively using the code against itself.
With injecting an onpropertychange
event handler, Gareth managed to make sure that the sanitation itself
caused the JavaScript execution. A link getting it's malicious href
removed will cause what?
A call of its propertyChange
event of course. Triple doh! Code bypassed.
onpropertychange
before the change to the other attributes happend.
Onpropertychange
does not register changes to itself. Therefore the issue was fixable at all -- which I first doubted a bit to be possible :)
type="text/javascript"
to the script tag
and wrapped the src/href
setters in try{}catch(e){}
blocks -- maybe you can find out yourself why ;)language
attribute trick that has been used successfully in XSSMe2. By injecting code that contained an image, a language
attribute set
to vbs
and an event handler executing actual VBScript, the protective script was bypassed on all tested Internet Explorer versions.
Different script engine -- different scope.
language
attribute. After that, no inline script can be executed without further trickery. Developers should be very careful when picking the attributes they
want to allow. Sometimes the harmless ones can cause more trouble than one might think.href
attributes and allowed injecting arbitrary domains. Unfortunately, passing arguments into the RegExp
object does not
esacpe the dot properly -- and still has it act as a wildcard character. The fix was to escape the dot manually - very nice find!