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








Flag: Tornado! Hurricane!

 Forums >>  Target Specific - General  >>  Aspack unpacking code

Topic created on: April 22, 2009 12:39 CDT by charlie .

Hey guys,
i was trying to understand the aspack unpacking .
i was able to spot decompression routine , decoding using e8 and e9 etc but i was not clear what this bit was doing.
Can any unpacking gurus gimme some hint.
Thx in advance.

pls find the ida extract below.


loc_1013209: ; CODE XREF: .aspack:01013253j
.aspack:01013209 mov bx, [esi] ; i think esi is pointing to decompressed code
.aspack:0101320C shr ebx, 0Ch ; keep only most significant nibble
.aspack:0101320F cmp ebx, 1 ; not sure why he's comparing and what he's trying to achieve
.aspack:01013212 jz short loc_1013220
.aspack:01013214 cmp ebx, 2 ; ?
.aspack:01013217 jz short loc_101322F
.aspack:01013219 cmp ebx, 3 ; ?
.aspack:0101321C jz short loc_101323E
.aspack:0101321E jmp short loc_101324C
.aspack:01013220 ; ---------------------------------------------------------------------------
.aspack:01013220
.aspack:01013220 loc_1013220: ; CODE XREF: .aspack:01013212j
.aspack:01013220 mov bx, [esi] ;move lower byte into bx
.aspack:01013223 and ebx, 0FFFh ; zero out the most significant nibble
.aspack:01013229 add [edi+ebx], ax ; i think edi is pointing to Imagebas at this point, pls correct me if i'm wrong
.aspack:0101322D jmp short loc_101324C
.aspack:0101322F ; ---------------------------------------------------------------------------
.aspack:0101322F
.aspack:0101322F loc_101322F: ; CODE XREF: .aspack:01013217j
.aspack:0101322F mov bx, [esi] ;same as previous
.aspack:01013232 and ebx, 0FFFh
.aspack:01013238 add [edi+ebx], dx ; why move only a word ?
.aspack:0101323C jmp short loc_101324C
.aspack:0101323E ; ---------------------------------------------------------------------------
.aspack:0101323E
.aspack:0101323E loc_101323E: ; CODE XREF: .aspack:0101321Cj
.aspack:0101323E mov bx, [esi]
.aspack:01013241 and ebx, 0FFFh
.aspack:01013247 add [edi+ebx], edx ; mov dword ?
.aspack:0101324A jmp short $+2
.aspack:0101324C

Charlie

  simpleuser   April 23, 2009 02:54.34 CDT
relocations.
check relocate_image, line 3779, of http://code.google.com/p/pefile/source/browse/trunk/pefile.py

just before that code, it's comparing the actual ImageBase with the header value. that was a hint for 'is relocation needed?'

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