Closed Bug 788269 Opened 14 years ago Closed 14 years ago

CSRF via java applet in builder.addons.mozilla.org

Categories

(addons.mozilla.org Graveyard :: Add-on Builder, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: albinowax, Assigned: zalun)

Details

(Keywords: reporter-external, wsec-csrf)

Attachments

(1 file, 1 obsolete file)

Users can attach any kind of file to their addons, and they are served from the builder.addons.mozilla.org domain eg https://builder.addons.mozilla.org/attachment/259514 They are served with the 'content-disposition: attachment' header so it isn't possible to upload HTML to XSS any browsers except Opera. However, java applets inherit permissions from the domain they originate from. The attached poc loads the java applet linked above, which fetches https://builder.addons.mozilla.org/package/150977/latest/ and prints out the full source, including CSRF tokens. From there, I think one could use CSRF to backdoor the user's addons (and the user themselves next time they clicked 'test').
Attachment #658215 - Attachment is obsolete: true
Attachment #658217 - Attachment mime type: text/plain → text/html
we see _something_ happen, but your applet seems to just hang Firefox for us. Although I realize all 3 of use who tried it are using Mac so maybe it's windows specific. Clearly Java is reading the archive though so I'm confirming the bug on that basis -- Java ought to be able to do the things you say given it's not respecting the content-disposition header. It's conceivably legitimate to have java hosted in your add-on, though it might be rare enough that we can try to keep it out of builder-based add-ons. The real solution, though, is probably to host the generated packages on a completely different domain. builder.AMO can be the site, but the packages could be on builder.mozilla.net or something. That would solve this and some of the previous issues with malicious package content.
Assignee: nobody → zaloon
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: wsec-csrf
I tested it on windows XP since it frequently hangs the browser in Fedora. Agreed that serving attachments from a separate domain is the solution, though it will make access control on attachments to private extensions slightly harder. The alternative of blocking Java would have to be done by inspection of the binary content to see if it parses as a jar/.class, and I think there might be similar issues related to Flash, too.
Piotr, do you know if java appletes will/should be allowed to be part of new style addons put together by builder, or who could answer that question? if they aren't this seems like a variant of the bug to limit the kinds of files that can be uploaded. If they are this would probably qualify for a bounty.
I've asked on #jetpack, but I think that for the security we shouldn't allow them.
Piotr, do you want to write a patch to turn off Java applets as an option here? We've approved this for a $1,000 bounty.
Sure I will
Severity: major → critical
Priority: -- → P1
everywhere I was discussing the issue it seems like this is a trvial issue as running add-ons created by users is mallicious enough... anyway - preventing jar (and by occasion zip) files in review: https://github.com/mozilla/FlightDeck/pull/171
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You probably already know this but it may be exploitable using pdfs as well as jars: http://xs-sniper.com/blog/2012/10/11/content-smuggling/
I didn't ... so - should we deny pdf attachments?
I guess so, though moving the files off-domain is the only future-proof fix.
Flags: sec-bounty+
Product: addons.mozilla.org → addons.mozilla.org Graveyard
Group: client-services-security
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: