News for hackers. Stuff that matters.
Re:A file that’s both an acceptable HTML page and a JPEG (2012) by tomglynch on Sunday September 09, 2018 @08:35PM (#17948586)
Explanation please?
Re:A file that’s both an acceptable HTML page and a JPEG (2012) by saagarjha on Sunday September 09, 2018 @08:37PM (#17948597)
Took a look at the page source, and it's full of binary garbage. It looks to me that it's a JPEG image that has been slightly tweaked to contain just enough HTML to get a (lenient) browser to display it.
Re:A file that’s both an acceptable HTML page and a JPEG (2012) by cryptonaut on Sunday September 09, 2018 @08:50PM (#17948641)
It's a JPEG with the HTML written in the comment field:

  # exiftool -b -comment <(curl -s http://lcamtuf.coredump.cx/squirrel/)
  <html><body><style>body { visibility: hidden; } .n { visibility: visible; position: absolute; padding: 0 1ex 0 1ex; margin: 0; top: 0; left: 0; } h1 { margin-top: 0.4ex; margin-bottom: 0.8ex; }</style><div class=n><h1><i>Hello, squirrel fans!</i></h1>This is an embedded landing page for an image. You can link to this URL and get the HTML document you are viewing right now (soon to include essential squirrel facts); or embed the exact same URL as an image on your own squirrel-themed page:<p><xmp><a href="http://lcamtuf.coredump.cx/squirrel/">Click here!</a></xmp><xmp><img src="http://lcamtuf.coredump.cx/squirrel/"></xmp><p>No server-side hacks involved - the magic happens in your browser. Let's try embedding the current page as an image right now (INCEPTION!):<p><img src="#" style="border: 1px solid crimson"><p>Pretty radical, eh? Send money to: [email protected]<!--
Re:A file that’s both an acceptable HTML page and a JPEG (2012) by saagarjha on Sunday September 09, 2018 @09:02PM (#17948681)
I suspected it was something like that: the "meat" of the HTML and JPEG data being contained in each other's comment fields, since that's how many quines work. I don't quite know enough about the JPEG file format to be confident about it, though.
Re:A file that’s both an acceptable HTML page and a JPEG (2012) by mikeryan on Sunday September 09, 2018 @08:54PM (#17948653)
It also uses an (non terminated - AFAICT) HTML Comment to hide the rest of the JPEG data.
Re:A file that’s both an acceptable HTML page and a JPEG (2012) by saagarjha on Sunday September 09, 2018 @08:59PM (#17948673)
> non terminated - AFAICT

Yes, it shows up as all green in Safari. And:

    $ { curl -s http://lcamtuf.coredump.cx/squirrel/?1 | grep -- '-->' ; } || echo "Not found"
    Not found
Re:A file that’s both an acceptable HTML page and a JPEG (2012) by anonymfus on Sunday September 09, 2018 @08:56PM (#17948662)
Yes but it is not necessary because everything except absolutely positioned div is hidden anyway.
Re:A file that’s both an acceptable HTML page and a JPEG (2012) by MapleWalnut on Sunday September 09, 2018 @11:36PM (#17949223)
Here is the output from the handy `file` BSD utility which gave it away to me (see the comment field).

    JPEG image data, JFIF standard 1.01, resolution (DPI), density 300x300, segment length 16, comment: "<html><body><style>body { visibility: hidden; } .n { visibility: visible; position: absolute; ", baseline, precision 8, 1000x667, frames 3
Re:A file that’s both an acceptable HTML page and a JPEG (2012) by quickthrower2 on Sunday September 09, 2018 @10:09PM (#17948947)
Browsers are <liberal> in what they </accept>