Closed Bug 345011 Opened 15 years ago Closed 15 years ago

Bugzilla HTML attachments open to XSS attacks


(Bugzilla :: Attachments & Requests, defect)

Not set





(Reporter: jeff, Unassigned)


User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20060326 Firefox/ (Debian-1.5.dfsg+
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20060326 Firefox/ (Debian-1.5.dfsg+

HTML attachments are served with the text/html MIME type to users. Any Javascript the attachment contains will be executed. This leaves Bugzilla open to XSS attacks, if a logged-in user can be convinced to click on one's attachment.

Reproducible: Always

Steps to Reproduce:
1. Create a HTML file with evil XSS stuff, eg. <script>document.write("<img src='"+document.cookies+"'>")</script>.
2. Name file 'patch.diff', and attach to a bug with MIME type text/html
3. Ask a developer to review patch.diff, or simply wait until someone clicks on it.
4. Watch the victim's Bugzilla cookies appear in your logs.

For comparison, Mantis also serves HTML as text/html, but uses 'Content-Disposition: attachment' instead of 'Content-Disposition: inline'. The effect of this is that users are prompted as to how they wish to handle the attachment. This can be annoying, however, as patches can no longer be viewed in the browser.

Also of relevance: serving content as text/plain or application/octet-stream is not a sufficient defense against this in IE:

*** This bug has been marked as a duplicate of 38862 ***
Closed: 15 years ago
Resolution: --- → DUPLICATE
Note that bugzilla cookies are not all that interesting (they're tied to IP address), but that's not the only attack of course.
Group: webtools-security → bugzilla-security
Group: bugzilla-security → webtools-security
Group: webtools-security → bugzilla-security
This bug is being removed from the security group because the bug that it is a duplicate of is now public, since it has been fixed and a Security Advisory has been sent about it. See bug 468249 for the Security Advisory.
Group: bugzilla-security
You need to log in before you can comment on or make changes to this bug.