Issue Details (XML | Word | Printable)

Key: MBS-1169
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Normal Normal
Assignee: Unassigned
Reporter: Calvin Walton
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
MusicBrainz Server

Musicbrainz website is missing HTML escaping on user entered data

Created: 23/Dec/10 05:42 AM   Updated: 29/Dec/11 01:59 PM   Resolved: 29/Dec/11 01:59 PM
Component/s: Data display
Affects Version/s: NGS - Release Candidate 1
Fix Version/s: NGS - Release Candidate 2, Hot fixes, 2011-05-26, Bug fixes, 2011-07-18, Bug fixes, 2011-11-14, Bug fixes, 2011-12-22

Issue Links:
Duplicate
 
Relates
 


 Description  « Hide

I submit for your attention exhibit A:
http://test.musicbrainz.org/artist/c7a5823a-5f9f-48ec-b034-e4ac261d5b6e
(set up in edit http://test.musicbrainz.org/edit/13577941 )

And I haven't even tried anything other than an artist yet...



Sort Order: Ascending order - Click to sort in descending order
Calvin Walton added a comment - 23/Dec/10 05:52 AM

For full effect, please view source on that page and search for the text "<script>". Any place where that appears is a place where HTML sanitization is missing. Note that a few of locations are actually embedded in bodies of other scripts; some of those may be exploitable as well if the ' quote is not escaped properly. I did not test this.


Oliver Charles added a comment - 23/Dec/10 01:09 PM

Thanks for finding these. Note we do try to actually run everything through "| html", but it's easy to miss bits...


Oliver Charles added a comment - 12/Jan/11 04:23 PM

I have fixed some of the most critical places, but I honestly don't have the energy to sift through all our templates in order to determine other possible exploitable areas. Please reopen this ticket if you find any! I created/edited all major entities in my testing and they don't seem to be injectable.


Calvin Walton added a comment - 13/Jan/11 06:28 PM - edited

Alright, I managed to find a few more holes. It looks like you've gotten most of the places where code could be injected into HTML, but there's still escaping lacking when embedding HTML into javascript (JSON).
An example is (with syntax highlighting):
http://pastebin.com/XP0uFwTG
Taken from the page http://test.musicbrainz.org/artist/c7a5823a-5f9f-48ec-b034-e4ac261d5b6e

Note how the unescaped single quote causes a syntax error.

One example of where this causes a worse problem is in the release group editor:
http://test.musicbrainz.org/release-group/bbb7d580-e30a-455f-987c-5ad42ea75891/edit
(click on the Artist to open the editor, check "Use direct search", then trigger a search by selecting the "Artist in MusicBrainz" field and pressing an arrow key.
(tbh, I'm not sure if this is because of missing an escaped ' or not escaping HTML code, it could be either or both)


Oliver Charles added a comment - 14/Jan/11 12:49 PM

OK, I fixed the tag editor issue, but I think all the JS is better for warp to fix, so I'm bouncing this issue over to him.


Kuno Woudt added a comment - 20/Jan/11 10:15 AM

I fixed a bunch of escaping issues in the release editor (which lazy loads tracklists and recordings through json) and checked autocomplete (again, json) for most of these.

(Just realized I didn't check label entities with nasty names, I'll do that now



Oliver Charles added a comment - 08/Feb/11 06:30 PM

Addressed those ones that cropped up


Calvin Walton added a comment - 23/May/11 05:42 AM

Found another place:
http://musicbrainz.org/edit/14496414
View source for details.

Tracks 2-5 should all have the text <MUSIC VIDEO> at the end of the track name.


nikki added a comment - 11/Jun/11 03:25 AM

http://musicbrainz.org/edit/14612028 there should be <GOLD MIX> after SUPER EUROBEAT


nikki added a comment - 23/Oct/11 02:45 PM

http://musicbrainz.org/edit/15419615 should have "<Dance ver.>" as part of track 4


Oliver Charles added a comment - 14/Nov/11 11:34 AM

Fixed with 5d90ada


Oliver Charles added a comment - 28/Dec/11 11:12 PM

nikki added a comment - 29/Dec/11 12:47 AM

Also reported in MBS-4004. MBS-4082 also appears to be related.


Oliver Charles added a comment - 29/Dec/11 01:48 PM

Edit/15482740 fixed with commit 6502943.


Oliver Charles added a comment - 29/Dec/11 01:59 PM

Fixed artist credit HTML escaping in b6a5ca4