New issue
Advanced search Search tips

Issue 753307 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

XSS Auditor bypass with newline and -->

Reported by sirdarck...@gmail.com, Aug 8 2017

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36

Example URL:
http://evilwebsite.com/xss.php?html_xss=%3Cscript%3Ealert(1)%0a--%3E&attr_xss=1&js_xss=1

Steps to reproduce the problem:
http://evilwebsite.com/xss.php?html_xss=%3Cscript%3Ealert(1)%0a--%3E&attr_xss=1&js_xss=1

What is the expected behavior?
it shouldn't alert

What went wrong?
it alerts

Does it occur on multiple sites: Yes

Is it a problem with a plugin? No 

Did this work before? N/A 

Does this work in other browsers? No
 n/a

Chrome version: 60.0.3112.90  Channel: stable
OS Version: 
Flash Version:
 

Comment 1 by evn@google.com, Aug 8 2017

Cc: tsepez@chromium.org
Components: -Blink Blink>SecurityFeature
Labels: -OS-Linux OS-All
Labels: Needs-Feedback
I'd need to see the view-source of the reflected page to be sure about what's going on.  thanks.
Owner: tsepez@chromium.org
Status: Assigned (was: Unconfirmed)
--> is a comment in JavaScript.

if you need to see the PHP code of the page, there's a "source" link in the page, although I don't think you need it :)
in case there's too much code.. the attack is:

<script>alert(1)
--><a href="1">click</a><script>var m="1";
document.title=m;</script>

where

alert(1)
-->

is the injection
Thanks, C#5 is exactly what I need.  XSSAuditor has to cope with various server-side transformations, (e.g. urldecodes) and having the specific output is critical to ensure there isn't any additional funny stuff going on.
Weird, I would have thought that --> would parse as two tokens -- and >

d8> x = 3
3
d8> x-- > 3
false
d8> x-->3
false
d8> x
1

yet at the start of the line it does appear to be introducing a comment. A quick web search didn't give me any hits for such syntax. Did you find this documented somewhere (curious)?
e.g.
d8> -->blah!@#$%^&*()(*&^%$!#%&*((&*^%blah
undefined
Summary: XSS Auditor bypass with newline and --> (was: XSS Auditor bypass)
Still, the %0a--> is only good for a single line so you've got to have naturally occurring valid JS from the next line until the block closes, so its kind of a corner case.
https://tc39.github.io/ecma262/#sec-html-like-comments shows this was introduced in ecma 2018.  

Comment 13 by neis@chromium.org, Aug 9 2017

Cc: neis@chromium.org
It's the SingleLineHTMLCloseComment production in the linked grammar, which was already present in ES2015 (http://www.ecma-international.org/ecma-262/6.0/#sec-html-like-comments).  V8 has a few bugs in this area:

https://bugs.chromium.org/p/v8/issues/detail?id=6356

Status: Fixed (was: Assigned)

Sign in to add a comment