Closed
Bug 898769
Opened 13 years ago
Closed 13 years ago
XSS in support.mozilla.org
Categories
(support.mozilla.org :: Code Quality, task, P1)
support.mozilla.org
Code Quality
Tracking
(Not tracked)
RESOLVED
FIXED
2013Q3
People
(Reporter: subedimahadev, Assigned: rrosario)
References
()
Details
(Keywords: reporter-external, Whiteboard: u=user c=general p=2 s=2013.15)
Attachments
(1 file)
|
280.46 KB,
image/png
|
Details |
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36
Steps to reproduce:
Hello, There is a xss vulnerability on support.mozilla.org , as i reported previously , i was able to render empty iframe , but was not able to inject any atribitary code and was ticked as low critcal bug .
So , here is how i got xss in same page :
USE INTERNET EXPLORER FOR THIS ::
Go to: https://support.mozilla.org/en-US/forums/contributors/new?fpa=1#post-preview
And, in title of support page type any word you like but in body paste the following code :
CODE :
<iframe/src \/\/onload = prompt(1)
<iframe/onreadystatechange=alert(/@blinkms/)
<svg/onload=alert(1)
And, now either click on preview to see xss triggering that popups my twitter name @blinkms [SELF XSS in this case ] or directly save the post to attack victim and trigger xss in their browser .
Actual results:
Properly sanitization of Support wiki page is not done
Expected results:
Empty iframes or xss must be supressed , It is because of your python code you are having , while i looked it .
| Reporter | ||
Comment 1•13 years ago
|
||
Harmful XSS in mozilla support page that could attack , anyone viewing the post thats made in a click but mozilla support team is smart enough to remove such posts faster . Amazed .. !!
| Reporter | ||
Updated•13 years ago
|
Severity: normal → critical
Comment 2•13 years ago
|
||
(In reply to Mahadev Subedi from comment #0)
>
> USE INTERNET EXPLORER FOR THIS ::
Which Internet Explorer version? Which operating system and version?
Comment 3•13 years ago
|
||
Ricky: I haven't confirmed it, yet, but cc:ing you so you know this bug exists.
| Assignee | ||
Comment 4•13 years ago
|
||
Please use our staging site for doing these kinds of tests:
https://support.allizom.org
I can't reproduce this. We are bleaching the html properly, you only get an empty iframe:
https://support.allizom.org/en-US/forums/contributors/709305
This *shouldn't* be browser dependent.
| Reporter | ||
Comment 5•13 years ago
|
||
Use Internet explorer 8 or any latest version
| Reporter | ||
Comment 6•13 years ago
|
||
https://support.allizom.org/en-US/forums/contributors/709305
Working fine on me , javascript confirm popup @blinkms
| Assignee | ||
Comment 7•13 years ago
|
||
I looked at the page source and see this:
<div class="content">
<p><iframe><p><iframe/onreadystatechange=alert(/@blinkms/)
</p><p><svg/onload=alert(1)
</p></iframe></p>
</div>
That's interesting. Those tags aren't complete but IE doesn't seem to care. hmm
| Assignee | ||
Updated•13 years ago
|
Summary: XSS in mozilla.org → XSS in support.mozilla.org
| Assignee | ||
Comment 8•13 years ago
|
||
Our wiki parser, does the following:
In [38]: wiki_to_html('''<iframe/src \/\/onload = prompt(1)
....:
....: <iframe/onreadystatechange=alert(/@blinkms/)
....:
....: <svg/onload=alert(1)''')
Out[38]: u'<p><iframe><p><iframe/onreadystatechange=alert(/@blinkms/)\n</p><p><svg/onload=alert(1)\n</p></iframe></p>'
That confirms what we are seeing. If I go straight to bleach with the settings we use, I see:
In [33]: from kitsune.sumo.parser import ALLOWED_TAGS, ALLOWED_ATTRIBUTES
In [34]: import bleach
In [35]: bleach.clean(tags=ALLOWED_TAGS, attributes=ALLOWED_ATTRIBUTES, text='''<iframe/src \/\/onload = prompt(1)
....:
....: <iframe/onreadystatechange=alert(/@blinkms/)
....:
....: <svg/onload=alert(1)''')
Out[35]: u'<iframe></iframe>'
That's what we really want to happen. So something with our wiki parser (maybe in combination with bleach), is causing this behavior.
| Reporter | ||
Comment 9•13 years ago
|
||
Yes, I think; the parser is not escaping encoding with the bleach .
| Assignee | ||
Comment 10•13 years ago
|
||
I did some more digging and the issue seems to be with the HTML5 tokenizer:
https://github.com/html5lib/html5lib-python/blob/master/html5lib/tokenizer.py#L24
It treats the contents inside of an `<iframe>contents</iframe>` as raw text and doesn't parse it at all. Therefore, you can put any HTML inside an iframe like this:
In [3]: import bleach
In [4]: from kitsune.sumo.parser import ALLOWED_TAGS, ALLOWED_ATTRIBUTES
In [13]: t1 = '<iframe><img onload="alert(1);"/><iframe/onreadystatechange=alert(/@blinkms/)</iframe>'
In [14]: bleach.clean(t1, tags=ALLOWED_TAGS, attributes=ALLOWED_ATTRIBUTES)
Out[14]: u'<iframe><img onload="alert(1);"/><iframe/onreadystatechange=alert(/@blinkms/)</iframe>'
I am guessing that browsers aren't supposed to parse that innercontent into HTML, but IE is IE.
| Assignee | ||
Comment 11•13 years ago
|
||
In a pull request:
https://github.com/mozilla/kitsune/pull/1541
Assignee: nobody → rrosario
Priority: -- → P1
Whiteboard: u=user c=general p=2 s=2013.15
Target Milestone: --- → 2013Q3
| Assignee | ||
Updated•13 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
| Assignee | ||
Comment 12•13 years ago
|
||
Landed on master:
https://github.com/mozilla/kitsune/commit/5ab0e691f4040d7e3c0b85f419f5f765d7fb7240
We went back to disallowing iframes in our markup. In order to insert youtube iframes now, we put a PLACEHOLDER where it goes, then do all the parsing and sanitizing and at the end replace the PLACEHOLDER with the iframe for the video.
| Assignee | ||
Comment 13•13 years ago
|
||
Deployed to prod now.
If you go back to the URL from comment 4, you will see iframes are properly escaped now:
https://support.allizom.org/en-US/forums/contributors/709305
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
| Reporter | ||
Comment 14•13 years ago
|
||
Both html injection (iframe) & xss are fixed . Thanks
| Reporter | ||
Comment 15•13 years ago
|
||
? about bounty ..? Previously your team nominated empty iframe bug but why not this one .
Updated•13 years ago
|
Flags: sec-bounty?
| Reporter | ||
Comment 16•13 years ago
|
||
Sec bounty - ?
Comment 17•13 years ago
|
||
(In reply to Mahadev Subedi from comment #15)
> Previously your team nominated empty iframe bug but why
> not this one .
Please mail the security team when you have a bug you would like considered for the security bug bounty.
http://www.mozilla.org/security/bug-bounty-faq-webapp.html#what-next
Flags: sec-bounty? → sec-bounty+
Updated•2 years ago
|
Keywords: reporter-external
You need to log in
before you can comment on or make changes to this bug.
Description
•