iHack 2013 Forensic track #3 & 4 - Your eyes are bleeding and you need to split something.


That one was damn fun to realize.  The idea came when I was analyzing some malware binary that was executed under Linux and had to be reverse engineered.  By accident, I happened to open it on Windows with 7zip and it contained more than one file!  How can a file be executed and contain many files?  I had to explore that...

I mentioned it to a fellow CTFer and he told me he’d ask the perfect resource about that.  He came back to me with examples of file combinations such as ZIP + ZIP, EXE + RAR or EXE + ZIP.  It all depends on how the file works, does it depends on its boundaries in the header and the footer?  Does it have garbage space?  Well, that’s interesting, gotta experiment with that in order to reproduce the behavior and it worked.

A few months later, I had to build challenges for the iHack 2013 and I wanted people to discover that too and learn about it.  I then thought about that previous experience, but also had to find out how to reverse the whole process.  After ragequitting on tests with an executable self-extractable passworded/encrypted ZIP file and a RAR file because I couldn’t build a ZIP file that is encrypted AND self-extractable (I’ve been told once that it was due to MS-DOS compatibility.....who cares in 2013!?), I moved on and finally went for a passworded ZIP and a RAR file and it worked flawlessly using a rather simple carving process mentioned here that was based on header identification to give the tip telling you where to “cut” the file.

I needed contents, that isn’t much challenge.  Then I had a flash about a forensic challenge I attempted at PHDays quals 2012 and its writeup (see here, in german) that had 2 ways of being solved :


That challenge offered us a brown square named square.GIF.  Looked like a pretty well used square...  Well I went the wrong way on that challenge and understood everything when I stumbled on a writeup.

I def’ had to include something similar...but not exactly similar, because if someone found that writeup, that’d be too easy.  Can’t hide much stuff inline without finding it when using hexedit...and no straight descriptors I could fill and hide easily.  The second factor of the challenge had to be in the file itself.  Why not voluntarily corrupt it?

Here are the steps :