|
ARTeam Tutorial Visit:
http://cracking.accessroot.com
|
http://forum.accessroot.com Unpacking ASProtect 1.23-1.3.08.24 RC4 & Adding Section Final Tut |
| Information | Unpacking ASProtect 1.23-1.3.08.24 RC4 |
| Target | DX Atlas v2.24 |
| Available | http://grinders.withernsea.com/tools/dxatlas224.zip |
| Tools | OllyDbg 1.10, ImpRec, LordPE, Hide Debugger 1.2 |
| Protection | ASProtect 1.23-1.3.08.24 RC4 |
| level | Beginner |
| Category | Unpacking |
| Author(s) | Ferrari September 2004 |
| Requirements | Windows XP, IE 5.5 and above for best viewing |
|
1. Introduction
|
|
Hi all today's target is DX Atlas which is packed with
ASProtect.
I'll cover the Steps on unpacking ASProtect. Many detail tutorials on this protector is already available but in this tutorial I will show you how to add sections in the final unpacked exe which crashes because it tries to read from that region which doesn't exsist in the final unpacked exe. I'm composing this tutorial specially for "Aggressor and Namrahus" who asked nice :-). I will not cover all details on why I do certain steps bcoz of limited time but Feel free to ask me questions on ARTeam forums no matter if it's very n00by bcoz I was a n00b at some stage too and my masters Britedream & R@dier have answered my lame questions politely so I will do the same to my students :-P, so special thanks to them 8-) I assume that you have some basic knowledge of Assembly. I also recommend that you read the tutorials here: http://mup.anticrack.de/ I reckon that you first read my tutorial on ASprotect 1.21-1.23 for all the settings and some figures especially how to use Imprec. Download: Click Here
There are three sections in the
remaining of this tutorial: So let's finish this off quickly. And yes this is my Final Tut on ASProtect this version and older. Maybe the newer one ;-) Note: ' ** ' means ask me on AR forums for more explanation. |
|
2. Finding the
Original Entry point & Dumping our Target
|
|
Copy the Hide Debugger Plugin in the Plugins folder and edit the Ollydbg.ini file. Fire up Ollydbg and load "DxAtlas.exe". You will get and entry point alert so hit OK. You see this code:
00401000 >/$ 68
01406A00 PUSH DxAtlas.006A4001 Go into Debugging Options and under the Exceptions tab only tick 'Ignore memory violations in KERNEL32'. Now, hit Shift+F9 once and Olly will throw an Exception. Hit Ctrl+B and Enter this: 8B 17 89 02 and land below the Magic CALL:
00BF32B4 E8
47FCFFFF CALL 00BF2F00 Now continue with Shift F9 to pass all the exceptions till you break on our Break point and then stop. Right Click->Binary-> Fill with NOPS. How did you find 8B 17 89 02 and Why NOP? Hint: Try to understand the Fig. or else ** Click Image to Enlarge Nopping the Magic CALL will fix 99 % of the IAT. The remaining I will use ASPR Imprec plugin orelse **. After Nopping hit Shift F9 once and then press " - " key select the NOP's and undo changes and then Shift F9 7 times till olly breaks on the last exception. Do not hit shift F9 again orelse target will run ;-)
00BF39EC
3100 XOR DWORD PTR DS:[EAX],EAX
<----- Last
Exception Put BP on Last RETN and hit Shift F9 and we will break on BP. Press Alt M to open the Memory Map Window, right Click:
00401000
000F5000 DxAtlas
code 01001002
R RWE Freeze and Read Notes... ***************** Notes 1 ****************** Why set memory BP on code? Suppose the program was not protected/packed with ASPR and when u load the program in a debugger you will be at the Entry Point(EP) of the program. But when you ASProtect the program, ASPR hides the Original Entry point (OEP) of the program and when u open this ASPR'd program in debugger you see the Entry Point of ASPR code. You open the ASPR'd program with LordPE PE Editor and click on sections and you will see a section (.adata) which contains the ASPr code. So when you put a Memory breakpoint on the code section which contains the program code (look for address 00401000 by pressing Alt M keys) after the loader finishes the unpacking process and as soon as it reaches or to be more precise near (fake OEP) the Entry Point of the program code (due to the stolen bytes technique executed in ASPr code) it will break due to the memory BP. At this point the program is completely unpacked/decrypted in memory and then you dump with LordPE. The same idea is applicable to most other software Protectors. After u reach the entry point if you continue tracing the program will run in debugger after executing the necessay code. ***************** End Notes *************** Now "Ctrl F11" to trace and wait for few secs (depends on your processor) you land here (Press "Ctrl A" to analyse): 00407044 $- FF25 A4B24F00 JMP DWORD PTR DS:[4FB2A4] Select above in Olly -> Right click -> Follow in Dump -> Memory Address and see this in dump window. In my case I see this:
004FB2A4
64 1C BF 00
64 8A C0 00 02 B0 36 B6 E7 EB DD 77 ᱤ¿詤À뀂똶矝 Freeze and Read Notes...
*****************
Notes 2 ****************** ***************** End Notes *************** Now Continue... Hit F8 and you will be in ASPR code at address 00BF1C64 . Continue tracing after the RETN 4 you land at 40714C but look at the CALL above (scroll up) have u seen it somewhere before...Notes 2 ;-) :
00407147 . E8
F8FEFFFF CALL DxAtlas.00407044
<--familar
address Now trace till: 0040716F . 58 POP EAX and hit F7 to execute POP EAX and note the value in EAX register i.e EAX = 004F530C bcoz it is part of our stolen bytes ! Continue trace after the RETN you land at Fake OEP. You see this code. To see the proper code you have to remove analysis.
004F5750 \E4524F00
DD DxAtlas.004F52E4 Right click -> Analysis -> Remove Analysis. and see this proper code: 004F5767 33C0 XOR EAX,EAX I keep notes (included with this tutorial) of Stolen Bytes (ASPr steals bytes form (the EP) the orignal file and we have to replace it) which aren't difficult at all. This software is coded in Delphi and I count the number of "00" = 14. Now I refer my Stolen bytes notes. The stolen bytes in this case are:
004F5754 55 PUSH
EBP
After inserting stolen bytes press ' Ctrl * ' to set the new origin to Real OEP i.e 004F5754.
Now we need to get the import table and fix our
dump. |
|
3. Rebuilding our
importable and fixing our dumped.exe
|
|
4. Adding Missing
Section To Fix the Crashing
|
|
Ok now run the dumped_.exe and it crashes. Now load the crashing dumped_.exe in Olly and hit F9. You will get an Access Violation. Refer Figure.
So we will have to bring this region in our dumped_.exe and then it will run clean. Let's do it! There is a another very easy way by which we can avoid adding this region but my tut is on how to Add section to fix crashing dump :-P Close dumped_.exe in Olly and Open the packed DxAtlas.exe and follow all the earlier steps to get to the Fake OEP. When you reach the Fake OEP press ' Alt M ' to open memory map. Refer Figure. for Steps.
Right Click and Save Data to File. Save it in the programs folder
Fire up LordPE PE Editor and open dumped_.exe and Click on Sections. Load Section from disk and select the section you saved as in previous figure.
Edit section Header
Click OK -> close the Section window -> click on Save -> Ok -> Click on Rebuild PE -> select our dumped_.exe
Now run the dumped_.exe and it will run clean :-) and also the ASPR Trial Period wil be removed and it will never expire.
|
|
5. Registering The
ASProtected Program
|
|
But you see a 'Unregistered copy, 30 days Left" Text on the splash screen. To show it registered. I'll give BIG Hint:
Method 1: Easy lazy patching 2) Right click follow in dump EDX and Change 00 to 01.
Continue to Trace till here: 004F1D04 |> \A1 A87A4F00 MOV EAX,DWORD PTR DS:[4F7AA8] and follow memory address in dump and see Little Endian(reverse order) the same address 00BE3861 == 01 is moved in EAX == 1. Enter this CALL: 004F1D09 |. E8 BE7BF1FF CALL dumped_.004098CC
and trace and see the value in EAX
== 5 after you RETN.
004F1D10 |. /77 39 JA SHORT dumped_.004F1D4B Copy the changes to the executable and save and run the dumped_.exe registered. ;-) Method 2: To display your name in Registered To: ARTeam on Splash Screen Note: If you do the following steps then you don't need to add the missing section I showed you above :-P I include this extra info only for aggressor who asked me how to display his name in "Registered To:" Load dumped_.exe in olly Put BP here: 00403FE8 31C9 XOR ECX,ECX and then F9 to run and note EDX register: 00BE3861. So let's see where this address was moved in EDX. See stack window where this procedure will return:
0012FF3C 004F1CD2
RETURN to dumped_.004F1CD2
from dumped_.00403FE8
004F1CC7 |. 8B15
A87A4F00 MOV EDX,DWORD PTR DS:[4F7AA8] ;
dumped_.00BE3861 So Right click and follow memory address [4F7AA8] in dump and see little endian (reverse order) and it points to 00BE3861 when program is unregistered.The author of DxAtlas used ASProtect Trial and registration options to protect his program :-P So let's crack ASPR registration. So let's find some free space where we will write our name and then replace 00BE3861 with the address where we write our name. We will use free space here: 00400110 What you do is right click in main window of Olly and Choose View -> Executable file . Ctrl G and type 00400410 - 00400000 = 00000410 Now see figure.
Now first right click and save file. Then open the saved executable again in Olly and then change the new address in dump window in reverse order at 4F7AA8. And now right cllick and copy to executable and save. See in fig.
Change To
Now run saved dumped_.exe and it will show registered to ARTeam :-P bcoz the JA(Jump if Above) I explained in "Method 1" will jump and register the program.
|
|
6. Conclusion
|
|
Lesson Learnt Still awake?!? As usual we try to summarize what we learnt during this tutorial..hope at least one of the points were new for you :) 1. Search Ctrl B -> 8B 17 89 02 . Put BP on CALL and
Shift F9 till break and Nop it to fix 99% IAT. Thanks for
reading my 2 cents 8-) See you on ARTeam forums !!! |
|
8. Greetingz
|
|
[MAIN TEAM] [^~=~ (.) Ferrari (.)
~=~^] |