环境:win98
工具:od,upx1.9
目的:乐趣所在,如果无意间伤了谁,请原谅!
开工:
先脱壳。
用od加载。
F9,注册:asanawen,9999999999999
对getwindowtexta下断。
断在这里:
00445A93 |. FF15 44954600 CALL DWORD PTR DS:[<&USER32.GetWindowTex>; \GetWindowTextA
00445A99 |. 8B4C24 08 MOV ECX,DWORD PTR SS:[ESP+8]
00445A9D |. 6A FF PUSH -1
00445A9F |. E8 61340000 CALL MAILGHOS.00448F05
00445AA4 |. EB 0C JMP SHORT MAILGHOS.00445AB2
00445AA6 |> 8B01 MOV EAX,DWORD PTR DS:[ECX]
00445AA8 |. FF7424 08 PUSH DWORD PTR SS:[ESP+8]
00445AAC |. FF90 88000000 CALL DWORD PTR DS:[EAX+88]
00445AB2 |> 5E POP ESI
00445AB3 \. C2 0400 RETN 4
F8慢慢跟。
直到这里:
004144D8 . 8B4424 0C MOV EAX,DWORD PTR SS:[ESP+C]
004144DC . 8B3D 70704800 MOV EDI,DWORD PTR DS:[487070]
004144E2 . 50 PUSH EAX
004144E3 . 51 PUSH ECX
004144E4 . 8D5424 18 LEA EDX,DWORD PTR SS:[ESP+18]
004144E8 . 8BCC MOV ECX,ESP
004144EA . 896424 28 MOV DWORD PTR SS:[ESP+28],ESP
004144EE . 52 PUSH EDX
004144EF . 891D 70704800 MOV DWORD PTR DS:[487070],EBX
004144F5 . E8 01430300 CALL MAILGHOS.004487FB
004144FA . 51 PUSH ECX
004144FB . 8D4424 20 LEA EAX,DWORD PTR SS:[ESP+20]
004144FF . 8BCC MOV ECX,ESP
00414501 . 896424 28 MOV DWORD PTR SS:[ESP+28],ESP
00414505 . 50 PUSH EAX
00414506 . C64424 4C 03 MOV BYTE PTR SS:[ESP+4C],3
0041450B . E8 EB420300 CALL MAILGHOS.004487FB
00414510 . C64424 48 02 MOV BYTE PTR SS:[ESP+48],2
00414515 . E8 C6E5FEFF CALL MAILGHOS.00402AE0***********这里,关键call,跟进
0041451A . 83C4 0C ADD ESP,0C
0041451D . 3AC3 CMP AL,BL
0041451F . 0F84 01010000 JE MAILGHOS.00414626
00414525 . 8B4C24 14 MOV ECX,DWORD PTR SS:[ESP+14]
00414529 . 68 FF000000 PUSH 0FF
0041452E . 51 PUSH ECX
0041452F . 68 906B4800 PUSH MAILGHOS.00486B90
00414534 . E8 67CB0100 CALL MAILGHOS.004310A0
00414539 . 8B5424 18 MOV EDX,DWORD PTR SS:[ESP+18]
******************call 402ae0************
00402AE0 /$ 64:A1 00000000 MOV EAX,DWORD PTR FS:[0]
00402AE6 |. 6A FF PUSH -1
00402AE8 |. 68 F02D4600 PUSH MAILGHOS.00462DF0
00402AED |. 50 PUSH EAX
00402AEE |. 64:8925 000000>MOV DWORD PTR FS:[0],ESP
00402AF5 |. 53 PUSH EBX
00402AF6 |. 56 PUSH ESI
00402AF7 |. 8B4424 18 MOV EAX,DWORD PTR SS:[ESP+18]
00402AFB |. 68 08644800 PUSH MAILGHOS.00486408 ; /Arg2 = 00486408
00402B00 |. 50 PUSH EAX ; |Arg1
00402B01 |. C74424 18 0100>MOV DWORD PTR SS:[ESP+18],1 ; |
00402B09 |. E8 0EE80200 CALL MAILGHOS.0043131C ; \MAILGHOS.0043131C
00402B0E |. 83C4 08 ADD ESP,8
00402B11 |. 85C0 TEST EAX,EAX
00402B13 |. 0F84 C8000000 JE MAILGHOS.00402BE1
00402B19 |. 8B4C24 1C MOV ECX,DWORD PTR SS:[ESP+1C]
00402B1D |. 68 08644800 PUSH MAILGHOS.00486408 ; /Arg2 = 00486408
00402B22 |. 51 PUSH ECX ; |Arg1
00402B23 |. E8 F4E70200 CALL MAILGHOS.0043131C ; \MAILGHOS.0043131C
00402B28 |. 83C4 08 ADD ESP,8
00402B2B |. 85C0 TEST EAX,EAX
00402B2D |. 0F84 AE000000 JE MAILGHOS.00402BE1
00402B33 |. 8B7424 20 MOV ESI,DWORD PTR SS:[ESP+20]
00402B37 |. 81FE 08644800 CMP ESI,MAILGHOS.00486408
00402B3D |. 0F84 9E000000 JE MAILGHOS.00402BE1
00402B43 |. 56 PUSH ESI
00402B44 |. 51 PUSH ECX
00402B45 |. 8D5424 20 LEA EDX,DWORD PTR SS:[ESP+20]
00402B49 |. 8BCC MOV ECX,ESP
00402B4B |. 896424 28 MOV DWORD PTR SS:[ESP+28],ESP
00402B4F |. 52 PUSH EDX
00402B50 |. E8 A65C0400 CALL MAILGHOS.004487FB
00402B55 |. E8 E6020000 CALL MAILGHOS.00402E40
00402B5A |. 32DB XOR BL,BL
00402B5C |. 83C4 08 ADD ESP,8
00402B5F |. 3AC3 CMP AL,BL
00402B61 |. 75 06 JNZ SHORT MAILGHOS.00402B69*********第一个爆破点,改成jmp
00402B63 |. 885C24 10 MOV BYTE PTR SS:[ESP+10],BL
00402B67 |. EB 7D JMP SHORT MAILGHOS.00402BE6
00402B69 |> 8D46 14 LEA EAX,DWORD PTR DS:[ESI+14]
00402B6C |. 8D5424 1C LEA EDX,DWORD PTR SS:[ESP+1C]
00402B70 |. 50 PUSH EAX
00402B71 |. 51 PUSH ECX
00402B72 |. 8BCC MOV ECX,ESP
00402B74 |. 896424 28 MOV DWORD PTR SS:[ESP+28],ESP
00402B78 |. 52 PUSH EDX
00402B79 |. E8 7D5C0400 CALL MAILGHOS.004487FB
00402B7E |. E8 BD020000 CALL MAILGHOS.00402E40
00402B83 |. 83C4 08 ADD ESP,8
00402B86 |. 3AC3 CMP AL,BL
00402B88 |. 75 06 JNZ SHORT MAILGHOS.00402B90*********第二个,同上
00402B8A |. 885C24 10 MOV BYTE PTR SS:[ESP+10],BL
00402B8E |. EB 56 JMP SHORT MAILGHOS.00402BE6
00402B90 |> 56 PUSH ESI
00402B91 |. E8 4A020000 CALL MAILGHOS.00402DE0
00402B96 |. 83C4 04 ADD ESP,4
00402B99 |. 84C0 TEST AL,AL
00402B9B |. 75 06 JNZ SHORT MAILGHOS.00402BA3
00402B9D |. 885C24 10 MOV BYTE PTR SS:[ESP+10],BL
00402BA1 |. EB 43 JMP SHORT MAILGHOS.00402BE6
00402BA3 |> 56 PUSH ESI
00402BA4 |. E8 A7010000 CALL MAILGHOS.00402D50
00402BA9 |. 83C4 04 ADD ESP,4
00402BAC |. 885C24 10 MOV BYTE PTR SS:[ESP+10],BL
00402BB0 |. 84C0 TEST AL,AL
00402BB2 |. 8D4C24 18 LEA ECX,DWORD PTR SS:[ESP+18]
00402BB6 |. 74 32 JE SHORT MAILGHOS.00402BEA
00402BB8 |. E8 C95E0400 CALL MAILGHOS.00448A86
00402BBD |. 8D4C24 1C LEA ECX,DWORD PTR SS:[ESP+1C]
00402BC1 |. C74424 10 FFFF>MOV DWORD PTR SS:[ESP+10],-1
00402BC9 |. E8 B85E0400 CALL MAILGHOS.00448A86
00402BCE |. B0 01 MOV AL,1
00402BD0 |. 8B4C24 08 MOV ECX,DWORD PTR SS:[ESP+8]
00402BD4 |. 64:890D 000000>MOV DWORD PTR FS:[0],ECX
00402BDB |. 5E POP ESI
00402BDC |. 5B POP EBX
00402BDD |. 83C4 0C ADD ESP,0C
00402BE0 |. C3 RETN
00402BE1 |> C64424 10 00 MOV BYTE PTR SS:[ESP+10],0
00402BE6 |> 8D4C24 18 LEA ECX,DWORD PTR SS:[ESP+18]
00402BEA |> E8 975E0400 CALL MAILGHOS.00448A86
00402BEF |. 8D4C24 1C LEA ECX,DWORD PTR SS:[ESP+1C]
00402BF3 |. C74424 10 FFFF>MOV DWORD PTR SS:[ESP+10],-1
00402BFB |. E8 865E0400 CALL MAILGHOS.00448A86
00402C00 |. 8B4C24 08 MOV ECX,DWORD PTR SS:[ESP+8]
00402C04 |. 5E POP ESI
00402C05 |. 32C0 XOR AL,AL
00402C07 |. 64:890D 000000>MOV DWORD PTR FS:[0],ECX
00402C0E |. 5B POP EBX
00402C0F |. 83C4 0C ADD ESP,0C
00402C12 \. C3 RETN************从这里返回
0041451A . 83C4 0C ADD ESP,0C******到这里
0041451D . 3AC3 CMP AL,BL
0041451F . 0F84 01010000 JE MAILGHOS.00414626*********第三个,改成jnz
00414525 . 8B4C24 14 MOV ECX,DWORD PTR SS:[ESP+14]
00414529 . 68 FF000000 PUSH 0FF
0041452E . 51 PUSH ECX
0041452F . 68 906B4800 PUSH MAILGHOS.00486B90
00414534 . E8 67CB0100 CALL MAILGHOS.004310A0
00414539 . 8B5424 18 MOV EDX,DWORD PTR SS:[ESP+18]
保存修改后的程序。F9
,退出程序。加载修改后的程序。清除启动时的绊脚石:
对readfile下断,断在这里:
004492BE |. FF15 54934600 CALL DWORD PTR DS:[<&KERNEL32.ReadFile>] ; \ReadFile
004492C4 |. 85C0 TEST EAX,EAX
004492C6 |. 75 0D JNZ SHORT MAILGHOS.004492D5
004492C8 |. 50 PUSH EAX
004492C9 |. FF15 5C934600 CALL DWORD PTR DS:[<&KERNEL32.GetLastErr>; [GetLastError
004492CF |. 50 PUSH EAX
004492D0 |. E8 1D210000 CALL MAILGHOS.0044B3F2
004492D5 |> 8B45 0C MOV EAX,DWORD PTR SS:[EBP+C]
004492D8 |> 5D POP EBP
004492D9 \. C2 0800 RETN 8
F8一步。
堆栈中出现:
006FFCE8 /006FFE38
006FFCEC |0040A6E8 返回到 MAILGHOS.0040A6E8 来自 MAILGHOS.004492A2
006FFCF0 |00486A90 ASCII "999999999999999"
006FFCF4 |00000518
006FFCF8 |00486FA8 MAILGHOS.00486FA8
006FFCFC |00486FA8 MAILGHOS.00486FA8
006FFD00 |006FFE38
006FFD04 |FFFFFFFF
006FFD08 |01454480 ASCII "E:\PROGRAM FILES\TKEYSOFT\MAILGHOST\Log"
006FFD0C |01454430 ASCII "E:\PROGRAM FILES\TKEYSOFT\MAILGHOST\"
006FFD10 |00000000
006FFD14 |816ED6A8
006FFD18 |0046DB94 MAILGHOS.0046DB94
006FFD1C |0000002C
已经读取文件到内存了。在内存中搜索:9999999999
下内存访问断点,F9,断在这里:
0040AD3E |. A0 906A4800 MOV AL,BYTE PTR DS:[486A90]
0040AD43 |. 64:8925 000000>MOV DWORD PTR FS:[0],ESP
0040AD4A |. 83EC 08 SUB ESP,8
0040AD4D |. 84C0 TEST AL,AL
0040AD4F |. 56 PUSH ESI
0040AD50 |. 0F84 92000000 JE MAILGHOS.0040ADE8
0040AD56 |. A0 906B4800 MOV AL,BYTE PTR DS:[486B90]
0040AD5B |. 84C0 TEST AL,AL
0040AD5D |. 0F84 85000000 JE MAILGHOS.0040ADE8
0040AD63 |. A0 906C4800 MOV AL,BYTE PTR DS:[486C90]
0040AD68 |. 84C0 TEST AL,AL
0040AD6A |. 74 7C JE SHORT MAILGHOS.0040ADE8
0040AD6C |. 68 906B4800 PUSH MAILGHOS.00486B90 ; ASCII "3HSD9NBL"
0040AD71 |. E8 2AD5FFFF CALL MAILGHOS.004082A0
0040AD76 |. 83C4 04 ADD ESP,4
0040AD79 |. 84C0 TEST AL,AL
0040AD7B |. 74 6B JE SHORT MAILGHOS.0040ADE8
0040AD7D |. 8B35 70704800 MOV ESI,DWORD PTR DS:[487070]
0040AD83 |. 68 906A4800 PUSH MAILGHOS.00486A90 ; ASCII "999999999999999"
0040AD88 |. 51 PUSH ECX
F8往下,到这里:
0040ADA3 |. 51 PUSH ECX
0040ADA4 |. C74424 20 0000>MOV DWORD PTR SS:[ESP+20],0
0040ADAC |. 8BCC MOV ECX,ESP
0040ADAE |. 896424 14 MOV DWORD PTR SS:[ESP+14],ESP
0040ADB2 |. 68 906B4800 PUSH MAILGHOS.00486B90 ; ASCII "3HSD9NBL"
0040ADB7 |. E8 38DD0300 CALL MAILGHOS.00448AF4
0040ADBC |. C74424 20 FFFF>MOV DWORD PTR SS:[ESP+20],-1
0040ADC4 |. E8 177DFFFF CALL MAILGHOS.00402AE0
0040ADC9 |. 83C4 0C ADD ESP,0C
0040ADCC |. 84C0 TEST AL,AL
0040ADCE |. 74 12 JE SHORT MAILGHOS.0040ADE2
0040ADD0 |. 32C0 XOR AL,AL
0040ADD2 |. 8B4C24 0C MOV ECX,DWORD PTR SS:[ESP+C]
0040ADD6 |. 64:890D 000000>MOV DWORD PTR FS:[0],ECX
0040ADDD |. 5E POP ESI
0040ADDE |. 83C4 14 ADD ESP,14
0040ADE1 |. C3 RETN
0040ADE2 |> 8935 70704800 MOV DWORD PTR DS:[487070],ESI*******这里,将esi改为407f,(为什么?程序运行时,[487070]处是407f,当然这也是注册成功的标志,)
0040ADE8 |> 8B4C24 0C MOV ECX,DWORD PTR SS:[ESP+C]*******这行代码没了。这一行将ecx放入0,不是什么好东西,我讨厌0
0040ADEC |. B0 01 MOV AL,1**********1改成0
0040ADEE |. 64:890D 000000>MOV DWORD PTR FS:[0],ECX
0040ADF5 |. 5E POP ESI
0040ADF6 |. 83C4 14 ADD ESP,14
0040ADF9 \. C3 RETN
保存修改。
基本上完活了。发个邮件试一试,呵呵,很爽。
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)