Packing Techniques

•December 2, 2009 • Leave a Comment

My friend asked me how viruses can be spread from cracked game exes since he plays DOTA on a pirated Warcraft install on a private network. After I explained it to him, he ask me how come I never blogged about it, what a good question! So today I will blog about some basic methods to packing. I will describe 4 different ways to pack files.

The first is packing using Resource Files, one of the easier ways to do so. In VC++ u can create/import resource files to your VC++ project. That is the easy part. The next part is slightly trickier, u need to extract the resource into a file on the system then somehow execute it. To do that you run the following calls:

hRes = FindResource(…);
hResLoad = LoadResource(…, hRes);
hFile = CreateFile(…);
WriteFile (hFile, …);

With the file created you just do WinExec or something else =)

The 2nd method is similar, but not using Resource Files which can be easy to detect. It requires more work on your part. Basically you need a 2nd program to convert binary data into a string format which you can copy and paste into your VC++ code as a array or string variable. I don’t post code on this cuz there are many ways, eg read 1024 bytes, B64 it, print to output file, or convert to binary-coded string, then B64 it, etc. Bottom line is, convert the binary data to the string. Then your code just reverse it. One note, make sure to strip any trailing padding that some convertor code might add eg B64 likes to add “==” at the end of strings that are too short. Shell code makes use of this technique to hide assembly calls in code.

The 3rd and 4th way are just using existing tools. One way is to use InstallShield. Yes, InstallShield. It gives you a very nice GUI to add files, even to execute which file after unpacking. What you need tho is a original package that used InstallShield, then rebuild the package yourself, except you add in your own files. Simple right?

The 4th way is like the 3rd way, but you might not have InstallShield, cuz later version of VC++ dun have InstallShield free. But you have WinZip, 7-Zip, WinRAR rite? All of them have the ability to create self-extracting archives or SFX. What this SFX is is that it embed the unarchiver program to the SFX then treats the SFX exe as a archive file eg ZIP. A SFX exe you can still open using the archiver tool so it’s not ideal, eg if you created the SFX using WinZip you can open the SFX exe in WinZip and see the contents. Which is still not too bad if you had the original SFX and just re-SFXed it.

You can combine the 1st/2nd techniques with the 3rd/4th techniques, but you need to know how to use ResHacker or a similar tool. The neat thing about 3rd/4th techniques is that with social engineering it might work better since your victim might think since it came from InstallShield or WinZip it is safe =)

There are more advanced techniques eg unpack direct to memory, or using eggdrop instead of unpacking, but I won’t discuss them today =)

False Alarm

•November 17, 2009 • Leave a Comment

So nothing happened lol… as of this post, the apec site is still up and running. I guess as they say in security… actually I dunno wat they say in security, but better safe then sorry! Would be curious to know if any attacks did happen, eg ddos, spam, spoof attacks, etc.

indonesiancoder.org

•November 11, 2009 • 1 Comment

While researching the cyberwar between Indonesian and Malaysian hackers I bookmarked an Indonesian hacker site for the group Killer-9. Since then I forgot all about it until today. In a short time of 2-3 weeks until 23rd Oct, they released SIX Joomla 0-day exploits! So I got curious, is the APEC site vulnerable?

Naturally I tried out a POC code (Joomla password reset exploit), let’s call it pen-testing =) it didn’t work that means the site isn’t running Joomla 1.5.5 or older. The JoomScan app also caught my attention, a Nessus type tool for Joomla and the skids out there. Like Nessus it scans for known exploits and warns u.

Of cuz for the 6 exploits posted, all of them are supposed to be 0-day. Are we worried yet? =)

Windows 7 and …

•November 6, 2009 • Leave a Comment

So… everyone crazy about Windows 7 now, even queue up at Challenger to buy. Of cuz la, cheaper price sure queue LOL!

So what’s new about Windows 7? I finally tried it, and guess what, other than the nice GUI, NOTHING MUCH HAS CHANGED!

I tried my self-written trojan on Windows 7, yep, it works. This means the Win2K to XP to Vista to Windows 7 base API and DLL strucuture remains nearly the same if not identical.

Welcome to Windows 7! +)

SG Hackers

•October 27, 2009 • 1 Comment

A new portal for Singaporean Hackers has been formed! www.sghackers.org aims to be the defacto portal for all Singaporean Hackers to come together and work together. Ho Say Lah!

Team Terminators #5!

•October 8, 2009 • Leave a Comment

Team Terminators came in #5 place in the HITB 2009 CTF competition! Well done Rubern and company!

HiTB 2009

•October 5, 2009 • Leave a Comment

HiTB CTF

Team Terminators gogogo!

Mobile Secrets

•September 29, 2009 • 1 Comment

I recently stumble on Mobile Secrets, a encryption software to allow exchanging encrypted SMS, developed by jihadis! Pro sia din noe they can program this kinda thing!

So they developed it in Java MIDP, so what do you do? Run decompiler on it hahaha thanks bytecodes! What thing I discover?

It has AES symmetric encryption, prolly using javax.crypto, but the decompiler I used (FernFlower) isn’t that good so all I could uncover was:

throw new IllegalArgumentException(“invalid parameter passed to AES init – ” + var2.getClass().getName());

So I guess is AES… I doubt they write their own AES engine. Another interesting thing I found was text strings in english, some unicode think is arabic, and french! Why french? Cuz the developers are french or speak french? The plot thickens hahaha!

I really need to pass this thru DJ Decompiler. Sending encrypted messages thru SMS on ur phone is cool.

Wubi

•July 30, 2009 • Leave a Comment

Recently discovered Wubi, a new and fantastic way to install Ubuntu on their Wintel. It is a way to install Ubuntu onto your Windows (XP, Vista, etc) OS like an app where an entry is added to your Installed Applications in Windows! How awesome is that? Once it is installed, Wubi actually modifies the Windows bootloader instead of installing its own like Grub to add an entry to the Windows bootloader!

Well, in theory anyway, cuz when I tried to run Wubi, the dialog didn’t give me the option to install it like that, even though all the FAQ and walkthrus show that option. Mine doesn’t show that option. I am on Vista and did run it as Admin but still cannot. WTF? Surfing the Ubuntu forums it seems like there needs to be some hackfu to get it working on Vista but it seems the latest version 9.04 can work on Vista but it doesn’t work for me!

If anyone knows why, please let me know?

Wubi can be found at http://www.wubi-installer.org

Scared

•June 29, 2009 • Leave a Comment

Recently talking to this website owner who setup website but the look and feel and maintenance of it IMHO was quite badly done. As some of u know I help run and maintain sites for free as my hobby and schoolwork purposes (yes Trin). Most of the time people are nice enough to reply thanks but no thanks, or just ignore my email (maybe spambin LOL) or accept my help.

Those who accept my help give their help willingly, no one is pointing guns at each other.

But seems like not everyone is created equal. It’s understandable to be cautious with your NRIC or stuff but if your website is just telling stories or blogging, I fail to see the need to be very very cautious, unless you have something to hide.

Some of you know I indeed have a … black mark in my past and it is still in play so I have reason to be cautious. What about you?