|
ARTeam Tutorial Visit:
http://cracking.accessroot.com
|
http://forum.accessroot.com ASProtect
1.31 manual unpacking |
| Information | ASProtect manual unpacking |
| Target | Unpackme7.exe |
| Available | www.freewebs.com/d3ux/Unpackme7sol.rar |
| Tools | OllyDbg 1.10 ImportREConstructor |
| Protection | none |
| Level | Beginner |
| Category | Unpacking |
| Author(s) | ThunderPwr October 2004 |
| Requirements | Windows 2K, XP, IE 5.5 and above for best viewing |
|
1. Introduction
|
|
|
| 2.
What we can do |
|
Manual unpack the target (dumping process memory and IAT rebuilding). |
|
STEP
1 – Executable file analysis after installation
|
|
In order to have some idea about OEP (Original Entry Point) you can use the generic OEP finder feature, with this you have:
This
can't be the real OEP, but is only for our main idea about this. |
|
STEP 2 – Manual unpacking
|
|
Press
the Cool...! button to close the program.
As
usual with ASProtect, in order to find the real OEP you must disable
exeception handling from the debugger, to do this go to the Options
menu and then select Debugging options (or
simply press Alt+O):
Now look if your settings match this one (if not change it accordling to the figure 6):
In order to reach the OEP you must use the exception method, you have to skip all the exception with SHIFT+F9 until you reach the last exception before the program start, below is reported the exact procedure which you have to do: 1.
Set IsDebuggerPresent plugin Now
I will drive you in step by step process to better understand it;
when you've load the target into OllyDbg the code showed must be the
same below figure 4, set IsDebuggerPresent plugin and press F9 to
run the program. OllyDbg stop on the first exception:
at
the bottom of the OllyDbg code window you can see the type of exception:
Now
you must count for all other exception and skip with SHIFT+F9 untl
the program is able to run and yopu can show the dialog of figure
3, when this appear I've counted 40 exceptions, then is time to restart
OllyDbg and skip only 39 exeception, after you've do it there are
this code:
Because
the program can start, the EIP must reside on the section CODE of
the program (which is on 00401000 area), our purpose is stop the program
exactly into the first instruction executed into this memory area,
in this mode you're able to reach the real OEP. To do this we can
place a breakpoint on memory access into the section CODE; well press
ALT+M in order to show the memory window and then right click to place
the breakpoint:
Now
you can skip the last exception with SHIFT+F7 and SHIFT+F9, OllyDbg
break on section CODE into the 00401029 address:
at the first look this code appear without sense, but you must remind which this is a new code rebuilded from ASProtect and then can't be analyzed from OllyDbg when you've loaded the executable, to show the right code you must perform a code analysis, then press CTRL+A or make right click and choose Analysis and then Analysis code:
now
the code appear in much more familiar mode:
Scroll
up a bit into the code:
now you can dump the program with 00401000 as OEP and check if this
work, but this can't work because you've to rebuild the import table
(IAT) which is destroyed from ASProtect. More precisely ASPRotect
make a redirection of the original API call into the ASProtect section,
only in this place execution is addressed to the right API, then our
work now is find the right API call and rebuild the original import
table.
then
a new window arise, write FF 25 into the
HEX box:
when
you press the OK button you land in this
code:
there is many indirect jump, only the first is about a valid entry,
other is still invalid then you have to find the right one in order
to rebuild the IAT:
one
interesting point to note is that indirect jump is all outside the
executable process memory, if you look at the memory map executable
have one image which start on 00401000 and size 1000, all IAT indirect
jump is about 008CXXXX memory address which is in a different section,
outside the executable area, then to make the dumped file working
you've to rebuild the IAT inside the program image.
well
this is our first API address and is writed on into 008C0378. Now
step through the code with F8 until you reach this section:
In
00401116 you've a new entry about GetModuleHandleA
API.
In
00401122 you've a new entry about DialogBoxParamA
API.
restart
the program and place a memory breakpoint in this table in order to
stop execution when ASProtect write the new API, first break is about
ExitProcess API, next is about GetModuleHandleA:
stepping
trough the code bring our analysis into on 008A551A address, press
F9 and OllyDbg stop on the next API:
press
F9 there are a new breakpoint in 008A369A:
step
again with F7 until you reach the RETN instruction then press F9:
press
F9, there are a new break on 008A5755:
press
F9, there are a new break on 008A5755:
press
F9, there are a new break on 008A5755:
press
F9, there are a new break on 008A5755:
press
F9, there are a new break on 008A5755:
press
F9, there are a new break on 008A5755:
press
F9, there are a new break on 008A5755:
press
F9, there are a new break on 008A5755:
press
F9, there are a new break but now this is a break due to an access
violation when writing:
press
SHIFT+F7 to skip this exception and press F9, there are a new breakpoint
on 008ADC5D again this is about exception on 008ADC5D, now you've
to skip all other exception until you reach the last exception before
program starting which is on 008A46E9 (see figure 9), now if you press
again SHIFT+F9 program can be executed.
Fig.
36 Entry table.
Next step is dump the program, then start OllyDump plugin, be careful
to set all option as reported below:
press
the Dump button and choose a dumped.exe
filename for the dumped process.
all
API entry con be retrieved from our previous analysis, be careful
to set also the Chunk separation (00 00 00 00). OEP = ImageBase - RealAddress = 00400000 - 00401000 = 00001000 RVA = ImageBase - API table start address = 00400000 - 00401160 = 00001160 Size
= TableWidth = 0040119C - 00401160 = 3C
press
GetImports button:
all
entry is valid then now you've to fix the dumped file, then press
the Fix Dump button and choose the file
dumped.exe:
close
ImportREC and check if the fixed program work, ImportREC save the
fixed file with a _ character then you've to launch the dumped_.exe
executable:
Well
done, fixed file run right then manual unpacking is finished succesfully! |
|
3. Conclusion
|
|
|
|
4. Greetingz
|
|
[MAIN TEAM]
|