📚 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  >>  Identifying a packer

Topic created on: September 4, 2011 13:05 CDT by eigma .

I'm trying to identify the packer used on a sample of malware. PEiD doesn't find anything.

The unpacking process is two-stage. First, the entry point has a large (100 bytes) obfuscated jmp to the second-stage. This involves calling some APIs and getting a specific error back, which is used as a constant for the rest of the first stage. The second stage is a few KB later in the file, and is about 15K in total.

The control flow in the second stage is obfuscated after every instruction. Each useful instruction is followed by a block of instructions that basically a short obfuscated jmp to the next instruction.

There are three types of these short obfuscated jmps, each used a few hundred times each across the second stage:

.text:00409E12 F8                     clc
.text:00409E13 F2 90                  repne nop
.text:00409E15 90                     nop
.text:00409E16 FC                     cld
.text:00409E17 0F 83 C3 15 00 00      jnb     loc_40B3E0


.text:0040B3C9 57                     push    edi
.text:0040B3CA BF FB C4 40 00         mov     edi, offset loc_40C4FB
.text:0040B3CF 87 3C 24               xchg    edi, [esp]
.text:0040B3D2 C3                     retn


.text:0040C21F 55                     push    ebp
.text:0040C220 8B EC                  mov     ebp, esp
.text:0040C222 90                     nop
.text:0040C223 C9                     leave
.text:0040C224 90                     nop
.text:0040C225 E9 FF 03 00 00         jmp     loc_40C629

Does any of this ring a bell to anyone?

  jraber     September 6, 2011 07:42.38 CDT
Can you post a link to download the binary?

  eigma     September 6, 2011 21:49.36 CDT
> jraber: Can you post a link to download the binary?
I'm not sure where is the best place to post this since it's malware.. Any suggestions?

Forgot to mention something else..

The second-stage rebuilds the original PE image from the data surrounding the unpacking code. Part of this process involves skipping certain bytes, so the packed data is larger (about 40%) than the unpacked image.

The unpacked image, though, is itself a UPX image. So overall, the packed exe does end up being smaller than the original exe. I don't know whether the packer always runs its original exe through UPX first, or if the author did this step manually.

  UnpackMe   September 7, 2011 00:15.12 CDT
Ask��Jmp Distortion How Reverse��Thank��

  jraber     September 7, 2011 07:07.10 CDT
> eigma: > jraber: Can you post a link to download the binary?
> I\'m not sure where is the best place to post this since it\'s malware.. Any suggestions?
>
> Forgot to mention something else..
Offensive Computing  http://www.offensivecomputing.net/

Also, upx use -d to decompress if you don't feel like unpacking manually

  eigma     September 7, 2011 17:47.23 CDT
Ok, here it is:
http://www.offensivecomputing.net/?q=ocsearch&ocq=3875131a366252b7c4773a13fa28f5c2

About "upx -d", yes, after peeling off the first packer, I just did upx -d and got a clean MSVC binary. But it's this first layer that wraps the UPXed binary that is interesting.

One note about the binary - it has a corrupted export directory, which confuses certain debuggers (Olly had trouble with it if I remember correctly). Just zero out the va/offset for the export directory to load it - the packer doesn't check this field so it unpacks normally.

  jraber     September 9, 2011 06:50.56 CDT
OK thanks, I will take a look at it next week and let U know what I find
>which confuses certain debuggers
I have my own debugger that I created and it should be fine.  Thanks though.

  jraber     September 14, 2011 13:41.51 CDT
After pulling it apart it is:
http://www.avira.com/en/support-threats-description/tid/6191/threat/TR.Dldr.Nirava.psd

Yeah I have not seen the first layer unpacker before.  Has some interesting anti-debugging tech. going on.  I will post more soon

Jason Raber

  charlie     October 2, 2011 11:25.45 CDT
Hi Eigma,
This isn't any standard packer , this is custom packers created by malware guys to evade AV detections. They are usually sold/used in underground forums. This seems to be related to fakeav family these guys tweak this packer quite frequently to stop Antivirus detections.

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