Processing of acprotect's OEP using encryption Shell
Attachment download: Shelling file and PDF
1. encryption process:
Acproctect v1.41
Analyze the theft of OEP entry point code
2. analysis process:
After loading, EIP = 00412000
00412000> 60 pushad
00412001 E8 01000000 call vcmfc database 1.00412007
00412006-7E 83 jle xvcmfc database 1.00411f8b
00412008 04 24 add Al, 0x24
0041200a 06 push es
0041200b C3 retn
0041200c 77 01 ja xvcmfc library 1.0041200f
0041200e 43 Inc EBX
0041200f FC ClD
00412010 75 01 jnz xvcmfc library 1.00412013
The entry point is in the shell section (Address: 00412000, size: 19000)
Based on Shell features, ESP is used for hr esp at 00412001 points
Here:
0041254a 56 push ESI
0041254b 8f05 a1294100 pop dword ptr ds: [0x4129a1]
00412551 60 pushad
00412552 78 03 JS xvcmfc library 1.00412557
00412554 79 01 JNS xvcmfc library 1.00412557
00412556 7b 40 JPO xvcmfc library 1.00412598
You can see pushad. After clearing the hardware breakpoint above, run hr esp under pushad.
Here:
00427753 51 push ECx
00427754 8f05 89284100 pop dword ptr ds: [0x412889]; [889] = ECx
0042775a 60 pushad
0042775b 61 popad
0042775c 51 push ECx
0042775d 8f05 cd294100 pop dword ptr ds: [0x4129cd]; [9cd] = ECx
00427763 ff35 cd294100 push dword ptr ds: [0x4129cd]
00427769 8915 e1284100 mov dword ptr ds: [0x4128e1], EDX
0042776f ff35 e1284100 push dword ptr ds: [0x4128e1]
00427775 56 push ESI
00427776 be 11294100 mov ESI, vcmfc database 1.00412911
0042777b 8bd6 mov edX, ESI
0042777d 5E pop ESI
0042777e 52 push edX
0042777f 59 pop ECx; ECx = edX = 412911
00427780 8f05 3d284100 pop dword ptr ds: [0x41283d]
00427786 8b15 3d284100 mov edX, dword ptr ds: [0x41283d]
0042778c 8929 mov dword ptr ds: [ECx], EBP; [412911] = EBP
0042778e 8f05 a12a4100 pop dword ptr ds: [0x412aa1]
00427794 56 push ESI
00427795 be a12a4100 mov ESI, vcmfc library 1.00412aa1
0042779a 8b0e mov ECx, dword ptr ds: [esi]
0042779c 5E pop ESI
0042779d ff35 11294100 push dword ptr ds: [0x412911]; this is the first stolen code pushebp.
004277a3 8925 192b4100 mov dword ptr ds: [0x412b19], ESP
004277a9 90 NOP
004277aa 90 NOP
004277ab 60 pushad
004277ac E8 01000000 call vcmfc database 1.004277b2
004277b1 ^ 77 83 ja xvcmfc database 1.00427736
Note that the NOP pushad commands appear, which means that this is the beginning of the stolen code .... Of course, the NOP here is randomly filled. There may be either one or two or more. The key is the pushad command.
Copy all the commands before NOP into binary and save them.
00427753 51 push ECx
00427754 8f05 89284100 pop dword ptr ds: [0x412889]; [889] = ECx
0042775a 60 pushad
0042775b 61 popad
0042775c 51 push ECx
0042775d 8f05 cd294100 pop dword ptr ds: [0x4129cd]; [9cd] = ECx
00427763 ff35 cd294100 push dword ptr ds: [0x4129cd]
00427769 8915 e1284100 mov dword ptr ds: [0x4128e1], EDX
0042776f ff35 e1284100 push dword ptr ds: [0x4128e1]
00427775 56 push ESI
00427776 be 11294100 mov ESI, vcmfc database 1.00412911
0042777b 8bd6 mov edX, ESI
0042777d 5E pop ESI
0042777e 52 push edX
0042777f 59 pop ECx; ECx = edX = 412911
00427780 8f05 3d284100 pop dword ptr ds: [0x41283d]
00427786 8b15 3d284100 mov edX, dword ptr ds: [0x41283d]
0042778c 8929 mov dword ptr ds: [ECx], EBP; [412911] = EBP
0042778e 8f05 a12a4100 pop dword ptr ds: [0x412aa1]
00427794 56 push ESI
00427795 be a12a4100 mov ESI, vcmfc library 1.00412aa1
0042779a 8b0e mov ECx, dword ptr ds: [esi]
0042779c 5E pop ESI
0042779d ff35 11294100 push dword ptr ds: [0x412911]; this is the first stolen code pushebp.
004277a3 8925 192b4100 mov dword ptr ds: [0x412b19], ESP
The binary data of this Code is:
51 8f 05 89 2841 00 60 61 51 8f 05 CD 29 41 00 FF 35 CD 29 41 00 89 15 E1 28 41 00 FF 35 E128 41 00 56 be 11 29 41 00 8B D6 5E 52 59 8f 05 3D 28 41 00 8B 15 3D 28 41 0089 29 8f 05 A1 2a 41 00 56 be A1 2a 41 00 8B 0e 5E FF 35 11 29 41 00 89 25 192b 41 00
Repeat the above steps until n times. How can I determine N? I will see it after the trial version NAG is popped up.
Save the binary data between N times.
00429106/EB 01 JMP xvcmfc library 1.00429109
00429108 | E8 ff254b91 call 918db70c
0042910d 42 Inc edX
00429106 is a recent hop, F7 goes in
00429109-ff25 4b914200 jmp dword ptr ds: [0x42914b]; vcmfc library 1.00405391
0042910f 60 pushad
00429110 E8 00000000 call vcmfc database 1.00429115
00429115 5E pop ESI
00429116 83ee 06 Sub ESI, 0x6
Where:
DS: [0042914b] = 00405391 (vcmfc database 1.00405391)
This is a long jump across segments,What is cross-segment?The current command is in 00429109 and it will jump to 00405391,
The module diagram shows that it is to jump from the. perplex segment to the. Text Segment for execution. This is the legendary cross-segment
Therefore, after entering the code segment, it is the legendary pseudo-OEP, which looks like this.
Next we will dump it out.
Use import REC to fix IAT. Fix the files dumped by dump.
Import rec adds. the input table is saved in the partition section of the Malk. The size is 1000. The input table cannot use such a large space. We can put the stolen code in this partition.
Use odopen repair and dump_.exe to find an empty location in the 0042b000 segment,
I am looking for 0042bba0. I will paste the binary obtained above and add a JMP 00405391 (jump to the pseudo OEP)
0042 bebf 58 pop eax
0042bec0 8908 mov dword ptr ds: [eax], ECx
0042bec2 A1 a4604000 mov eax, dword ptr ds: [0x4060a4]
0042bec7-E9 c594fdff JMP dumped _. <moduleentrypoint>
Use load PE to change the entry point to 0042bba0, OK, finished...
Save all binary data:
00427753 51 push ECx
00427754 8f05 89284100 pop DWORD ptrds: [0x412889]; [889] = ECx
0042775a 60 pushad
0042775b 61 popad
0042775c 51 push ECx
0042775d 8f05 cd294100 pop DWORD ptrds: [0x4129cd]; [9cd] = ECx
00427763 ff35 cd294100 push DWORD ptrds: [0x4129cd]
00427769 8915 e1284100 mov DWORD ptrds: [0x4128e1], EDX
0042776f ff35 e1284100 push DWORD ptrds: [0x4128e1]
00427775 56 push ESI
00427776 be 11294100 mov ESI, vcmfc database 1.00412911
0042777b 8bd6 mov edX, ESI
0042777d 5E pop ESI
0042777e 52 push edX
0042777f 59 pop ECx; ECx = edX = 412911
00427780 8f05 3d284100 pop DWORD ptrds: [0x41283d]
00427786 8b15 3d284100 mov edX, DWORD ptrds: [0x41283d]
0042778c 8929 mov DWORD ptrds: [ECx], EBP; [412911] = EBP
0042778e 8f05 a12a4100 pop DWORD ptrds: [0x412aa1]
00427794 56 push ESI
00427795 be a12a4100 mov ESI, vcmfc library 1.00412aa1
0042779a 8b0e mov ECx, DWORD ptrds: [esi]
0042779c 5E pop ESI
0042779d ff35 11294100 push DWORD ptrds: [0x412911]; this is the first stolen code pushebp.
004277a3 8925 192b4100 mov DWORD ptrds: [0x412b19], ESP
51 8f 05 89 28 41 00 60 61 51 8f 05 CD 2941 00 FF 35 CD 29 41 00 89 15 E1 28 41 00 FF 35 E1 28
41 00 56 be 11 29 41 00 8B D6 5E 52 59 8f05 3D 28 41 00 8B 15 3D 28 41 00 89 29 8f 05 A1 2a 41
00 56 be A1 2a 41 00 8B 0e 5E FF 35 11 2941 00 89 25 19 2B 41 00
FF 35 19 2B 41 00 8f 05 C1 29 41 00 56 bec1 29 41 00 8B 2E 5E 57 BF 9d 29 41 00 89 1f 5f FF 35
9d 29 41 00 89 35 31 28 41 00 FF 35 31 2841 00 68 FF 5E 89 35 99 2a 41 00 8B 1D 99 2a
41 00 8f 05 0d 2a 41 00 8B 35 0d 2a 41 0057
89 1C 24 8f 05 29 41 00 8f 05 19 28 4100 FF 35 19 28 41 00 5B FF 35 05 29 41 00 89 05 D5 2a
41 00 FF 35 D5 2a 41 00 89 3C 24 89 0C 24c7 04 24 A0 61 40 00 57 8f 05 E1 2a 41 00 FF 35 E1 2a
41 00 89 1C 24 C7 04 24 C0 54 40 00
64 A1 00 00 00 00 89 05 A5 29 41 00 FF 35a5 29 41 00 89 1C 24 89 0d 85 2a 41 00 FF 35 85 2a 41
00 57 BF 91 29 41 00 8B CF 5f 56 8B F1 8bde 5E 8B 0C 24 8f 05 B5 2a 41 00 89 03 8B 1C 24 8f 05
Ed 28 41 00 FF 35 91 29 41 00
64 89 25 00 00 00 00 83 EC 68 53 8f 05 d529 41 00 FF 35 D5 29 41 00 8f 05 99 28 41 00 FF 35 99
28 41 00 57 89 04 24 8f 05 65 29 41 00 ff35 65 29 41 00 89 34 24 52 8f 05 F1 28 41 00 FF 35 F1
28 41 00 89 3D C9 2a 41 00 FF 35c9 2a 4100
56 8f 05 31 2a 41 00 60 61 68 E5 2a 41 005f 51 8B CF 8B D1 59 8f 05 B9 28 41 00 8B 3D B9 28 41
00 89 3A 8f 05 D1 28 41 00 53 BB D1 28 4100 8B 13 5B FF 35 E5 2a 41 00 89 65 E8 33 dB 89 5d FC
89 15 85 29 41 00 FF 35 85 29 41 00 89 3424 53 89 14 24 50 B8 02 00 00 60
8b D0 58 52 5E 8f 05 01 2a 41 00 8B 15 012a 41 00 56 89 14 24 50 B8 25 29 41 00 8B D0 58 89 32
8f 05 ad 29 41 00 8B 15 ad 29 41 00 8B 3424 8f 05 B9 2a 41 00 FF 35 25 29 41 00 FF 15 98 60 40
00 8f 05 01 29 41 00 50 B8 5d 2a 41 00 8938 58
FF 35 5d 2a 41 00 51 C7 04 24 01 29 41 008f 05 85 28 41 00 8B 3D 85 28 41 00 8B 0f 8B 3C 24 8f
05 61 29 41 00 83 0d B4 F1 40 00 FF 83 0db8 F1 40 00 FF 15 9C 60 40 00 89 05 C1 28 41 00 FF
35 C1 28 41 00 57 BF 35 28 41 00 8B C7 5f89 30
8b 04 24 8f 05 41 28 41 00 FF 35 28 28 4100 50 8f 05 6D 2a 41 00 FF 35 6D 2a 41 00 89 3D 39 28
41 00 FF 35 39 28 41 00 51 B9 7C 71 40 008b F9 59 57 58 5f 50 5E 8f 05 2D 2a 41 00 8B 05 2D 2a
41 00 8B 0e 8f 05 11 2B 41 00 FF 35 11 2b41 00
55 8f 05 25 2B 41 00 60 61 5E 89 08 FF 15a0 60 40 00 52 8f 05 55 2a 41 00 FF 35 55 2a 41 00 C7
05 29 29 41 00 78 71 40 00 FF 35 29 4100 8f 05 35 2a 41 00 8B 15 35 2a 41 00 8B 0a 8f 05 C9
28 41 00 50 B8 C9 28 41 00 8B 10 58 89 08a1 A4 60 40 00