News for hackers. Stuff that matters.
Re:JPEG image of Shakespeare which is also a zip file contai... by BeefySwain on Tuesday October 30, 2018 @08:19PM (#18342385)
Just tried it out and it does indeed work.

  curl 'https://pbs.twimg.com/media/DqteCf6WsAAhqwV.jpg' > shakespeare.zip
  unzip shakespeare.zip
  unrar e shakespeare.part001.rar
I'm excited for the inevitable curl | unzip | bash method of installing software directly from twitter that is sure to follow.
Re:JPEG image of Shakespeare which is also a zip file contai... by tyingq on Wednesday October 31, 2018 @02:09PM (#18347985)
"I'm excited for the inevitable curl | unzip | bash method of installing software directly from twitter that is sure to follow."

Here you go...

  $ curl -s https://pbs.twimg.com/media/Dq2sPGNU0AEKyyC.jpg | dd status=none bs=1 skip=599 count=40| sh
Re:JPEG image of Shakespeare which is also a zip file contai... by BeefySwain on Wednesday October 31, 2018 @03:01PM (#18348369)
Very impressive!
Re:JPEG image of Shakespeare which is also a zip file contai... by pmontra on Wednesday October 31, 2018 @05:53AM (#18344384)
unrar didn't work on Ubuntu 16.04, but rar did:

    $ unrar e shakespeare.part001.rar
    unknown archive type, only plain RAR 2.0 supported(normal and solid archives), SFX and Volumes are NOT supported!
    All OK
    $ sudo apt install rar
    $ rar x shakespeare.part001.rar
    ...         shakespeare.html                                          OK 
    All OK
Re:JPEG image of Shakespeare which is also a zip file contai... by cwt on Wednesday October 31, 2018 @08:59AM (#18345270)
it worked for me on ubuntu 16.04

    $ unrar e shakespeare.part001.rar 

    UNRAR 5.30 beta 2 freeware      Copyright (c) 1993-2015     Alexander Roshal


    Extracting from shakespeare.part001.rar
Re:JPEG image of Shakespeare which is also a zip file contai... by pmontra on Wednesday October 31, 2018 @10:23AM (#18345914)
I discovered that there are two versions of unrar:

    $ dpkg -l "*unrar*"
    Architecture       Description
    un  unrar                       <none>             <none>             (no description available)
    ii  unrar-free                  1:0.0.1+cvs2014070 amd64              Unarchiver for .rar files
    un  unrar-nonfree               <none>             <none>             (no description available)
You probably have the nonfree package. I have no idea about what's the difference between them.
Re:JPEG image of Shakespeare which is also a zip file contai... by excalibur on Wednesday October 31, 2018 @02:56PM (#18348336)
Looks like the original "unrar" has some licensing restrictions (for compression purposes, not decompression). The "unrar-free" version was created as pure FOSS in response, but the performance isn't quite up to par. If there are any compatibility issues, it's likely the latter version that's having them. No idea what "unrar-nonfree" is, I'm guessing it's just another name for the first "unrar".

https://ubuntuforums.org/showthread.php?t=2012979

Re:JPEG image of Shakespeare which is also a zip file contai... by fireattack on Tuesday October 30, 2018 @09:29PM (#18342677)
Interesting that Winrar seems to have trouble to uncompress the first layer of it (zip to rars).

(7-zip works fine.)

Re:JPEG image of Shakespeare which is also a zip file contai... by jethro_tell on Tuesday October 30, 2018 @09:50PM (#18342759)
Well, if someone out there had paid for winrar, perhaps the support would be better XD
Re:JPEG image of Shakespeare which is also a zip file contai... by tobyhinloopen on Wednesday October 31, 2018 @07:58AM (#18344914)
“I paid for Winrar, AMA”
Re:JPEG image of Shakespeare which is also a zip file contai... by rzzzt on Wednesday October 31, 2018 @10:43AM (#18346075)
Re:JPEG image of Shakespeare which is also a zip file contai... by charonn0 on Wednesday October 31, 2018 @01:26PM (#18347618)
There's more than one way to read a zip.

7-zip reads the zip file by scanning from the beginning of the file for the first entry signature (which need not be at the start of the file, which is why this trick works at all.)

WinRAR reads the central directory located at the end of the file, which is technically how you're supposed to do it, but entry offsets given in the central directory are messed up by the existence of the JPG data at the beginning of the file. There also appears to be ~61KB of garbage data at the end of the file, which will trip up some zip readers that use the central directory.

tl;dr: The zip file technically malformed, whether or not a given archive reader will choke on it depends on which technique they use and how forgiving their implementation is.

Re:JPEG image of Shakespeare which is also a zip file contai... by fireattack on Wednesday October 31, 2018 @03:03PM (#18348392)
Thanks for the detailed explanation.
Re:JPEG image of Shakespeare which is also a zip file contai... by theoctopus on Wednesday October 31, 2018 @03:53AM (#18343972)
I've been unable to extract the inner rars with 7-zip. Each shakespeare.html just gives a "Data error"
Re:JPEG image of Shakespeare which is also a zip file contai... by 0-_-0 on Wednesday October 31, 2018 @10:55AM (#18346182)
7-zip 16.04 x64 on win10 works
Re:JPEG image of Shakespeare which is also a zip file contai... by dddddaviddddd on Tuesday October 30, 2018 @10:41PM (#18342956)
Since the server is probably gzipping the response there's no need for an intermediate unzip step in curl | bash
Re:JPEG image of Shakespeare which is also a zip file contai... by palunon on Wednesday October 31, 2018 @06:24AM (#18344499)
Unless the server only accept images upload and serves you the original file.

This is (or at least used to be) popular to share arbitrary files on imageboards.

Re:JPEG image of Shakespeare which is also a zip file contai... by tolnaiz on Wednesday October 31, 2018 @01:49PM (#18347803)
Only if you send 'Accept-Encoding: gzip' or similar header with curl. Which curl doesn't do by default.
Re:JPEG image of Shakespeare which is also a zip file contai... by detaro on Wednesday October 31, 2018 @01:51PM (#18347816)
Images are generally excluded from gzip transfer server-side, since it's a needless waste of CPU cycles.
Re:JPEG image of Shakespeare which is also a zip file contai... by ZKL0ot on Thursday November 01, 2018 @05:56AM (#18352412)
We throw ourselves on Termux and in fact it works. This vuln in Tw allows exfiltration methods and we can even try steganography...

$curl 'https://pbs.twimg.com/media/DqteCf6WsAAhqwV?format=jpg' > output $ file output output: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16 $ strings output.jpg | grep PK $./binwalk output.jpg $7z x shakespeare.part001.rar $ file shakespeare.html shakespeare.html: XML 1.0 document, UTF-8 Unicode (with BOM) text, with CRLF line terminators