Flag: Tornado! Hurricane!

OpenRCE Packer Database >> PECompact 2.x

Packer Name Packer Author Classification Analysis By Last Updated
PECompact 2.x Jeremy Collake Compressor quig June 15 2005
Allocation Anti-Debug Anti-Disassembly Section Name Sample
VirtualAlloc() + PE Header yes yes .text, .rsrc N/A
Notes
adds own err handler
throws error
patchs code
passes exception unhandled
next block is top level fx, allocates buffer
decodes next function block to low mem buffer
have to dump this block seperate, contains all loadlibrary stuff
frees buffer
jumps back to original entrypoint which was same as EP in PE header

Easy wat to get to the OEP:
Set a hardware breakpoint on the EP and wait to get back there after all the tricks.

Transfer Command
jmp eax  ;Back to original entry point defined in PE header  
Entry Point Signature
.text:00401219 start:
.text:00401219                 mov     eax, 426B64h         ;err handler address
.text:0040121E                 push    eax                  ;place on stack 
.text:0040121F                 push    large dword ptr fs:0 ;prev err handler
.text:00401226                 mov     large fs:0, esp      ;active err handler = struc to stack
.text:0040122D                 xor     eax, eax
.text:0040122F                 mov     [eax], ecx           ;throw error


.rsrc:00426B64 start           proc near
.rsrc:00426B64
.rsrc:00426B64 arg_0           = dword ptr  4
.rsrc:00426B64
.rsrc:00426B64                 mov     eax, 0FFBA5B0Dh
.rsrc:00426B69                 lea     ecx, [eax+88107Ah]
.rsrc:00426B6F                 mov     [ecx+1], eax        ; ecx = 426B87
.rsrc:00426B72                 mov     edx, [esp+arg_0]    ; patchs inst below ret
.rsrc:00426B76                 mov     edx, [edx+0Ch]
.rsrc:00426B79                 mov     byte ptr [edx], 0E9h
.rsrc:00426B7C                 add     edx, 5
.rsrc:00426B7F                 sub     ecx, edx
.rsrc:00426B81                 mov     [edx-4], ecx
.rsrc:00426B84                 xor     eax, eax
.rsrc:00426B86                 retn                    ; returns to ntdll.77f92538
.rsrc:00426B86 start           endp                    ;   did not process error passes
.rsrc:00426B86                                         ;   to next handler which was changed
.rsrc:00426B86                                         ;   now i think
.rsrc:00426B87 ; ---------------------------------------------------------------------------
.rsrc:00426B87                 mov     eax, 12345678h  ; patched above to mov eax, FFBA5B0D
.rsrc:00426B87                                         ; zwcontinue then searchs for next error
.rsrc:00426B87                                         ; handler and ends up here. (after int 2e)
.rsrc:00426B8C                 pop     large dword ptr fs:0
.rsrc:00426B93                 add     esp, 4
.rsrc:00426B96                 push    ebp
.rsrc:00426B97                 push    ebx
.rsrc:00426B98                 push    ecx
.rsrc:00426B99                 push    edi
.rsrc:00426B9A                 push    esi
.rsrc:00426B9B                 push    edx
              ....Some Stuff....
.rsrc:00426BBB                 call    eax             ; VirtualAlloc
.rsrc:00426BBD                 pop     edx
.rsrc:00426BBE                 mov     edi, eax
              ....Some Stuff....
.rsrc:00426BE5                 call    ecx             ; ecx = 426A92
              ....Some Stuff....
.rsrc:00426C09                 call    edi             ; edi = 2F01D0 (see region dump idb)
.rsrc:00426C09                                         ;   (loads all libraries and pointer table)
              ....Some Stuff....
rsrc:00426C1F                 call    dword ptr [ecx] ; Virtual Free
.rsrc:00426C21                 mov     eax, esi
.rsrc:00426C23                 pop     edx
.rsrc:00426C24                 pop     esi
.rsrc:00426C25                 pop     edi
.rsrc:00426C26                 pop     ecx
.rsrc:00426C27                 pop     ebx
.rsrc:00426C28                 pop     ebp
.rsrc:00426C29                 jmp     eax   ; OEP (same EP as in PE header but now to real exe)

Known Unpackers
// Script for OllyScript plugin by SHaG - http://ollyscript.apsvans.com
;--------------
/* 
//////////////////////////////////////////////////////////////
// PECompact 2.xx (Support all ver) OEP finder 
// Author: hacnho/VCT2k4 
// Email : [email protected] 
// Website: http://nhandan.info/hacnho 
// OS : WinXP Pro, OllyDbg 1.10 Final, OllyScript v0.85
// Date ReLeAsE: 14 July 2004
/////////////////////////////////////////////////////////////
*/

var CS
var CB
var Temp

sto 
findop eax, #C3# 
bp $RESULT 
esto 
esto

gmi eip, CODEBASE
mov CB, $RESULT 
log CB

gmi eip, CODESIZE 
mov CS, $RESULT 
log CS

bpwm CB, CS 
esto 
sto 
bpmc 
findop eip, #FFE0# 
mov Temp, $RESULT 
bp $RESULT 
esto 
jmp exit


Return: 
esto 
jmp exit

exit: 
cmp eip, Temp 
jne Return 
sto
log eip 
cmt eip, "This is the OEP! Found by hacnho/VCT2k4"
MSG "Dumped and fix IAT now! Thanx for using my Script...!"
ret

;---
 

There are 31,320 total registered users.


Recently Created Topics
[help] Unpacking VMP...
Mar/12
Reverse Engineering ...
Jul/06
hi!
Jul/01
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


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