I found a markup processor that allows users to include arbitrary links, as long as they contain a "netloc" (//
after the first :
). Due to the myriad of exploitable protocol handlers, this is certainly a bad idea. But does it allow XSS on a system without vulnerable protocol handlers?
All browsers I tested (Chrome 22, FF 18, IE 9, Opera 12) do not show anything when pointed to javascript://alert('XSS')
, but that could certainly just be because I'm not creative enough. Similarily, javascript://alert('XSS')
(which would make the first double slashes a comment, and the alert
a new line) doesn't work either.

) and didn't realize that although that does not work, simply urlencoding does. – phihag Feb 05 '13 at 18:37href
is URL parsed, that's why you'd also have to put injavascript:
to notify the parser of its format. And why%0
would work and
(that is HTML encoded code) wouldn't. – TildalWave Feb 06 '13 at 01:44%0A
is a URL encoded line feedLF
escape character. When entered in the address bar directly, it will stop parsing the URL provided (left to right), as it should.javascript:
however will mark it for the browser to process it as JS code, up until the end of quote terminated URL string. – TildalWave Feb 06 '13 at 02:02javascript://%0A%61%6C%65%72%74%28%27%4F%4B%27%29%3B
would return an alert with 'OK' as the URL parser sees this code as valid JavaScript after URL decode. Writing your URLs this way shouldn't be considered as a possible security threat either, as they would be properly decoded through the URL parser before being evaluated. If your program doesn't see my last example asalert('OK');
then it's broken and could use a good URL library. – TildalWave Feb 06 '13 at 02:19