📚 OpenRCE is preserved as a read-only archive. Launched at RECon Montreal in 2005. Registration and posting are disabled.








Flag: Tornado! Hurricane!

 Forums >>  Brainstorms - General  >>  More Advanced Unpacking - Part II

Topic created on: February 14, 2008 13:08 CST by frankboldewin .

With "More advanced unpacking - Part II" i show you how to decrypt an infamous reallife malware called WSNPOEM aka Infostealer.Banker.C The binaries are usually created with a tool called ZEUS Builder and there exist  lots of different versions in the wild. I found samples with and without rootkit functionality, as well as ontop packed binaries, meaning they are additionally protected/packed with tools like Aspack, ACProtect, Polycrypt and so forth. We will discuss all 3 types and how to deal with them in 3 different ways.

1. Manual unpacking + import fixing
2. Manual unpacking + Auto import fixing
3. Auto unpacking/import fixing

Stage 2 introduces a nice tool called "Universal Import Fixer" and Stage 3 shows how to automate unpacking/import fixing with OllyDbgScript.

http://www.reconstructer.org/papers/More%20advanced%20unpacking%20-%20Part%20II.zip

  NeOXQuiCk     February 14, 2008 18:03.58 CST
i must say nice job i hope there will be part 3 :P


will malware  fuck up my pc.. or i need to use VM ;)


keep a good work

  frankboldewin     February 15, 2008 02:38.24 CST
> will malware  fuck up my pc.. or i need to use VM ;)

i strongly suggest you to run this malware in a vm. i tries to steal lots of sensitive information, like accounts/passwords, including banking information from your box.

after infection you can clean the machine using the internal filebrowser from gmer 1.0.14
just browse to c:\winnt\system32 and delete ntos.exe and reboot. after reboot just delete the old registry entry wsnpoem made here:

HKLM/Software/Microsoft/Windows/Currentversion/Winlogon/Userinit ntos.exe

and delete the directory c:\winnt\system32\wsnpoem as well.

the files video.dll + audio.dll are crypted and contain configuration infos + stolen account data

  j00ru     February 15, 2008 04:54.54 CST
Haha nice one ;-) Thanks for your work ;>

  frankboldewin     February 15, 2008 06:16.49 CST
ollydbgscript enhanced

just added some lines to the script on line 91:

  find eip, #6a61# // find push 61
  cmp $RESULT, 0 // 0 = unsuccessful
  je find_importer_func // import marker not found, proceed with finding importer_func
  asm $RESULT, "push -1" // fix to 0xff to import everything
find_importer_func:

changing push 61 to push -1 causes to import all functions.
i have overlooked that before.
thanx to andreas greulich for the hint.

just re-download the zipfile package.

cheers,
frank

  nico     February 17, 2008 19:30.28 CST
Good work frank.

The idea to use imprec to create an import table when there is no real one because of a dynamic import creation AFTER the OEP was presented in a blog post on websense blog.

In your case, what you call junk is actually the ImageBase of the dlls that were dynamically loaded and used to resolve API functions. At least in most cases. This is because of the way they coded the dynamic handling.

It's not a real IAT, but an array of API functions created by the programmer. That was the trick shown on NTOS blog post.

On the other hand, sometimes you don't have junks, you just have everything glued together (all api from different dll together with no seperation), and in this case, you have to cut thunks on real entries, so you try to select functions that shouldn't be very interesting in the sample you are analysing, eg in my blog post in June 2007:

http://www.websense.com/securitylabs/blog/blog.php?BlogID=134

I am going to try this generic fixer and see how it handles this sort of case, but i doubt it will do any good, since this is not a REAL IAT as i said earlier.. We are just abusing imprec to make our job easier.

On the other hand, when there are junk entries, it's pretty quick and handy.. I never used this tool, even though, i had  heard of it. Thanks for the introduction :)

Also thanks for posting an olly script fully documented, on a real world example of malware encryption and import reconstruction.

Looking forward your part III if any! :)

Note: Registration is required to post to the forums.

There are 31,328 total registered users.


Recently Created Topics
[help] Unpacking VMP...
Mar/12
Reverse Engineering ...
Jul/06
let 'IDAPython' impo...
Sep/24
set 'IDAPython' as t...
Sep/24
GuessType return une...
Sep/20
About retrieving the...
Sep/07
How to find specific...
Aug/15
How to get data depe...
Jul/07
Identify RVA data in...
May/06
Question about memor...
Dec/12


Recent Forum Posts
Finding the procedur...
rolEYder
Question about debbu...
rolEYder
Identify RVA data in...
sohlow
let 'IDAPython' impo...
sohlow
How to find specific...
hackgreti
Problem with ollydbg
sh3dow
How can I write olly...
sh3dow
New LoadMAP plugin v...
mefisto...
Intel pin in loaded ...
djnemo
OOP_RE tool available?
Bl4ckm4n


Recent Blog Entries
halsten
Mar/14
Breaking IonCUBE VM

oleavr
Oct/24
Anatomy of a code tracer

hasherezade
Sep/24
IAT Patcher - new tool for ...

oleavr
Aug/27
CryptoShark: code tracer ba...

oleavr
Jun/25
Build a debugger in 5 minutes

More ...


Recent Blog Comments
nieo on:
Mar/22
IAT Patcher - new tool for ...

djnemo on:
Nov/17
Kernel debugger vs user mod...

acel on:
Nov/14
Kernel debugger vs user mod...

pedram on:
Dec/21
frida.github.io: scriptable...

capadleman on:
Jun/19
Using NtCreateThreadEx for ...

More ...


Imagery
SoySauce Blueprint
Jun 6, 2008

[+] expand

View Gallery (11) / Submit