Can someone explain what is going on here?
The file has been created in such a way that the web browser is ignoring the non-html parts of the document, while the image renderer is ignoring the parts that make up the html page. The first part probably isn't too hard, since most web browsers go to great lengths to render non-standard html in a sensible way, I'm not too sure about the second part. I'm guessing the jpeg spec has some variable length space in some…
A file that's both an acceptable HTML page and a JPEG (view source on it)
41–50 of 133 posts
Re: A file that's both an acceptable HTML page and a JPEG (view source on it)
#42Step 1: upload the "image" to the site. Let the site do whatever it does to ensure it has received a valid image. Nine validators out of ten will happily accept the file; the case that is likeliest to shoot you down is if the site modifies the image by cropping, resizing, or watermarking it.
Step 2: point your victim back to the uploaded "image" as though it's actually a page, and presto!, it's a page -- a page with malicious javascript in it.
Step 3: profit!
Re: A file that's both an acceptable HTML page and a JPEG (view source on it)
#43http://www.reddit.com/comments/arc79/reddit_i_got_the_best_p...
Re: A file that's both an acceptable HTML page and a JPEG (view source on it)
#44Re: A file that's both an acceptable HTML page and a JPEG (view source on it)
#45Looks more like a chipmunk to me.
Re: A file that's both an acceptable HTML page and a JPEG (view source on it)
#46If you think that's cool, look at Daeken's Magister: http://demoseen.com/windowpane/magister.png.html A PNG that's interpreted as HTML and loads itself as compressed JavaScript!
Re: A file that's both an acceptable HTML page and a JPEG (view source on it)
#47You can also use this trick to launch cross-site script attacks against sites that allow you to upload images. Step 1: upload the "image" to the site. Let the site do whatever it does to ensure it has received a valid image. Nine validators out of ten will happily accept the file; the case that is likeliest to shoot you down is if the site modifies the image by cropping, resizing, or watermarking it. Step 2: point yo…
Re: A file that's both an acceptable HTML page and a JPEG (view source on it)
#48Any practical use for this or just for fun?
Re: A file that's both an acceptable HTML page and a JPEG (view source on it)
#49You can also use this trick to launch cross-site script attacks against sites that allow you to upload images. Step 1: upload the "image" to the site. Let the site do whatever it does to ensure it has received a valid image. Nine validators out of ten will happily accept the file; the case that is likeliest to shoot you down is if the site modifies the image by cropping, resizing, or watermarking it. Step 2: point yo…
But almost any site will be sending the image along with a Content-type header, so your browser would still open it up as an image, not an HTML page with JavaScript? Or no?
Re: A file that's both an acceptable HTML page and a JPEG (view source on it)
#50You can also use this trick to launch cross-site script attacks against sites that allow you to upload images. Step 1: upload the "image" to the site. Let the site do whatever it does to ensure it has received a valid image. Nine validators out of ten will happily accept the file; the case that is likeliest to shoot you down is if the site modifies the image by cropping, resizing, or watermarking it. Step 2: point yo…