Extract compressed blobs from binaries
Jeremy Rauch | December 12th, 2005 | Filed Under: Matasano
A few months ago, Tom made a post about having to extract gzip’d content out of a binary glob.
At that time, I gave him a tool I had quickly written to extract zlib contents from binaries — very common in firmware for routers, switches and the like. Its come in very handy when we’ve done product evaluation work. Have firmware you want strings from? Use this tool, and cat the contents of the files it produces to strings. You could use the output to check for hidden passwords or SNMP communities. Have a weird kernel dump that seems unreadable? Maybe it has zlib compressed components.
I cleaned up the code, added support for extracting gzip components, and added the little “user friendly” features (like actually not crashing if you don’t pass in a filename. Oops).
Its been extremely useful, in spite of how simple it is. Maybe it can be of use for you too. I call it deezee, because thats what it does — it de-zlibs or de-gzips sections out of whatever you send its way.
Download it here.
Using it is easy. Simply supply the name of a file to extract compressed components from. Every decompressed component will be placed in an individual file with the same name as the file you’re extracting from, with the addition of a numerically increasing extension.
$ ls -l firmware.bin -rwx------ 1 jrauch other 731336 Dec 13 00:27 firmware.bin* $ ./deezee firmware.bin Scanning file firmware.bin for compressed components Compressed size: 731336 bytes Compressed segment found. Expanded to 2407948 bytes $ ls -l firmware.bin.0 -rw------- 1 jrauch other 2407948 Dec 13 00:28 firmware.bin.0


Mark Abene
December 13th, 2005 2:16 pmDude, this is so obviously useful, that I’m left wondering why I didn’t think of it. Maybe it’s because I’m too distracted doing insanely boring consulting work? Keep the ideas coming.
Jeremy
December 13th, 2005 2:35 pmThanks!
Anyone who tries to use this tool on a little endian platform would have discovered that I, in fact, only use it on a big endian one. I added a change to automagically detect a little endian platform, and swap the compare values appropriately.
In other words, if you’re running on x86, and it doesn’t seem to work, grab it again.
ol
November 28th, 2007 6:46 amwhere is deezee now?
mahmoodreza
July 3rd, 2008 8:45 amI want to download deezee, but I cant find it
please help me…
Leave a reply