News for hackers. Stuff that matters.
Re:When GIFs serve JavaScript by exogen on Sunday November 23, 2014 @03:57PM (#8649903)
Off-topic: Hilarious how broken Blogspot seems to be. Half the time I load this URL, I get a different post on the same blog ("Static DOM XSS Scanner") but still with the intended URL. Whatever this fancy JavaScript loading thing they are doing is utter bullshit.
Re:When GIFs serve JavaScript by oneeyedpigeon on Sunday November 23, 2014 @06:17PM (#8650334)
Turning off javascript gives a blank page. Absolutely blank, not a single piece of content, not even - and this would still be terrible, just a tiny, tiny bit better than downright ridiculous - a message saying "you need javascript enabled to view this content". Say what you like about webapps requiring javascript (an argument for another day), there is no excuse for a blog requiring it.
Re:When GIFs serve JavaScript by krapp on Sunday November 23, 2014 @04:08PM (#8649931)
The same thing happened to me. It's kind of ironic that to read an article about serving javascript in GIFs, I had to turn all of my js filters off.

Blogger is seriously horrible.

Re:When GIFs serve JavaScript by gorhill on Sunday November 23, 2014 @04:49PM (#8650064)
> I had to turn all of my js filters off.

I could read the article by enabling JS only for 1st-party + www.blogblog.com + www.blogger.com.

Re:When GIFs serve JavaScript by vq on Sunday November 23, 2014 @04:19PM (#8649967)
Thanks for pointing it out, I actually thought that was the article and didn't realise my mistake until I saw your comment.
Re:When GIFs serve JavaScript by username223 on Sunday November 23, 2014 @07:11PM (#8650468)
So blogspot.com is being merged with Google+? I only rarely bother to disable my JavaScript/ad blockers to read things there.

Looking at the source, it's a big pile of minified/obfuscated javascript crap. I can't be bothered to decode it.

Re:When GIFs serve JavaScript by defen on Sunday November 23, 2014 @06:54PM (#8650419)
I'm glad you mentioned this because I initially got the Static XSS Scanner and was about to flag the article as "full of lies"
Re:When GIFs serve JavaScript by jrochkind1 on Sunday November 23, 2014 @07:23PM (#8650490)
Aha, thanks for that, I was wondering why the post had nothing to do with GIFs.
Re:When GIFs serve JavaScript by kijin on Sunday November 23, 2014 @08:46PM (#8650670)
This exploit seems to require a <script> tag.

But if you let your users insert a <script> tag into any text field, this exploit is the least of your worries. Why encode your attack into a GIF file when you can just open a <script> tag and attack away in the comfort of a WYSIWIG editor?

A more interesting attack vector is the static HTML file that the attacker used as a vehicle for his <script> tag. If your users can upload an HTML file, or any other file that the browser might display as an HTML document (IE loves to guess the content type), you are vulnerable to XSS, no matter how thoroughly you filter all the other form fields.

One of the easiest ways to mitigate this vulnerability is to force browsers to download/save all user-uploaded files instead of displaying them. Configure your file server to add a Content-Disposition: attachment; header to all user-uploaded files.

Re:When GIFs serve JavaScript by Drakim on Monday November 24, 2014 @03:02AM (#8651449)
> One of the easiest ways to mitigate this vulnerability is to force browsers to download/save all user-uploaded files instead of displaying them. Configure your file server to add a Content-Disposition: attachment; header to all user-uploaded files.

But I can imagine many scenarios were the whole purpose of letting the user upload images is so that you can inline display them on the web (such as a forum avatar picture). Requiring the manual downloading of the image wouldn't be an acceptable solution for most people there.

Re:When GIFs serve JavaScript by kijin on Monday November 24, 2014 @03:47AM (#8651523)
If you use a proper <img> tag to embed an image in a webpage, it will display correctly even if the server sets a Content-Disposition header to force download. The header only makes a difference when you explicitly navigate to the URL of the user-uploaded resource.
Re:When GIFs serve JavaScript by zyx321 on Monday November 24, 2014 @03:52AM (#8651532)
This is neither particularly new, nor particularly dangerous.

One possible attack vector would be abusing a filename/MIME mismatch to trick people into executing it locally.

If you have a website that allows image uploads and keeps the original filename, you could create an image that displays normally when displayed on the web, but executes arbitrary code when downloaded and executed locally.

This was inspired by the 2011 incident that lead to the use on CAPTCHA on 4chan. A spambot known as Cornelia would flood the boards with copies of itself that contained instructions how to execute it in the image data. Of course, that only worked because people would knowingly execute a virus just to spite the mods.

Re:When GIFs serve JavaScript by eurleif on Sunday November 23, 2014 @08:22PM (#8650612)
This post seems to be hinting that this is potential security issue, but I'm not sure how it would be. All I can imagine this buying you is the ability to serve JS from someone else's domain, but the domain JS is served from doesn't change its security privileges; that's based on the domain of the HTML file the JS is included in.
Re:When GIFs serve JavaScript by ctrlfrk on Sunday November 23, 2014 @08:02PM (#8650573)
Would this be blocked by the X-CONTENT-TYPE-OPTIONS header? (source: http://ibuildings.nl/blog/2013/03/4-http-security-headers-yo... )
Re:When GIFs serve JavaScript by draz on Sunday November 23, 2014 @11:23PM (#8651034)
I wish there was a way to run the embedded javascript when the image is loaded. I have a legitimate use case for it (imagine you send an image URL as a JSON response and wanted to track it was loaded, or send other params back to the service)
Re:When GIFs serve JavaScript by LukeB_UK on Monday November 24, 2014 @03:38AM (#8651510)
So the site has to allow script tags for this to work? If that's the case, then you could simply put the code in the script tag and not have to mess around inserting it into a gif.