vc6如何修改正在执行的文件内容原理跟踪
首先是想到vc6应该会CreateFileA,和WriteFile,Windbg->vc6后发现VC首先以只读方式打开正在执行的test.exe
然后CreateFileA了一个tmp文件将修改后的数据WriteFile,然后就改好了囧!!!估计vc6后台干了文件替换的活
bl
0 e 7c801a28 0001 (0001) 0:**** kernel32!CreateFileA
1 e 7c810e17 0001 (0001) 0:**** kernel32!WriteFile
2 e 7c85f20f 0001 (0001) 0:**** kernel32!ReplaceFileA
3 e 7c836c54 0001 (0001) 0:**** kernel32!ReplaceFileW
4 e 7c835ea7 0001 (0001) 0:**** kernel32!MoveFileA
5 e 7c821249 0001 (0001) 0:**** kernel32!MoveFileW
6 e 7c835673 0001 (0001) 0:**** kernel32!MoveFileExW
7 e 7c85e3cb 0001 (0001) 0:**** kernel32!MoveFileExA
kernel32!CreateFileA:
7c801a28 8bff mov edi,edi
0:000> dd esp
0013f000 73d40e73 00e50268 40000000 00000000
0013f010 0013f02c 00000002 00000080 00000000
0:000> db 00e50268
00e50268 44 3a 5c 64 6f 63 75 6d-65 6e 74 73 5c 56 69 73 D:\documents\Vis
00e50278 75 61 6c 20 53 74 75 64-69 6f 20 50 72 6f 6a 65 ual Studio Proje
00e50288 63 74 73 5c 70 65 5f 69-6e 6a 65 63 74 5c 52 65 cts\pe_inject\Re
00e50298 6c 65 61 73 65 5c 7e 56-43 32 35 2e 74 6d 70 00 lease\~VC25.tmp.
0:000> gu
eax=00000728 。。。
kernel32!WriteFile:
7c810e17 6a18 push 18h
0:000> dd esp
0013f0f8 73d8c527 00000728 089b0048 0001c000
0013f108 0013f124 00000000 00ee459c 0001c000
0:000> db 089b0048
089b0048 5a 4d 90 00 03 00 00 00-04 00 00 00 ff ff 00 00 ZM..............
089b0058 b8 00 00 00 00 00 00 00-40 00 00 00 00 00 00 00 ........@.......
089b0068 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
089b0078 00 00 00 00 00 00 00 00-00 00 00 00 f0 00 00 00 ................
089b0088 0e 1f ba 0e 00 b4 09 cd-21 b8 01 4c cd 21 54 68 ........!..L.!Th
089b0098 69 73 20 70 72 6f 67 72-61 6d 20 63 61 6e 6e 6f is program canno
089b00a8 74 20 62 65 20 72 75 6e-20 69 6e 20 44 4f 53 20 t be run in DOS
089b00b8 6d 6f 64 65 2e 0d 0d 0a-24 00 00 00 00 00 00 00 mode....$.......
(vc6准备将修改后的数据写入00000728句柄~VC25.tmp)
kernel32!MoveFileA:
7c835ea7 8bff mov edi,edi
0:000> dd esp
0013f100 73d8c63f 00ebede8 00e50688 50027e1f
0013f110 00ebede8 00e50688 0013f290 0013f28c
0:000> db 00ebede8
00ebede8 44 3a 5c 64 6f 63 75 6d-65 6e 74 73 5c 56 69 73 D:\documents\Vis
00ebedf8 75 61 6c 20 53 74 75 64-69 6f 20 50 72 6f 6a 65 ual Studio Proje
00ebee08 63 74 73 5c 70 65 5f 69-6e 6a 65 63 74 5c 52 65 cts\pe_inject\Re
00ebee18 6c 65 61 73 65 5c 74 65-73 74 2e 65 78 65 00 ff lease\test.exe..
0:000> db 00e50688
00e50688 44 3a 5c 64 6f 63 75 6d-65 6e 74 73 5c 56 69 73 D:\documents\Vis
00e50698 75 61 6c 20 53 74 75 64-69 6f 20 50 72 6f 6a 65 ual Studio Proje
00e506a8 63 74 73 5c 70 65 5f 69-6e 6a 65 63 74 5c 52 65 cts\pe_inject\Re
00e506b8 6c 65 61 73 65 5c 7e 56-43 32 36 2e 74 6d 70 00 lease\~VC26.tmp.
(vc6将test.exe->~VC26.tmp)
kernel32!MoveFileA:
7c835ea7 8bff mov edi,edi
0:000> dd esp
0013f100 73d8c63f 00e50268 00ebede8 50027e1f
0013f110 00e50268 00ebede8 0013f290 0013f28c
0:000> db 00e50268
00e50268 44 3a 5c 64 6f 63 75 6d-65 6e 74 73 5c 56 69 73 D:\documents\Vis
00e50278 75 61 6c 20 53 74 75 64-69 6f 20 50 72 6f 6a 65 ual Studio Proje
00e50288 63 74 73 5c 70 65 5f 69-6e 6a 65 63 74 5c 52 65 cts\pe_inject\Re
00e50298 6c 65 61 73 65 5c 7e 56-43 32 35 2e 74 6d 70 00 lease\~VC25.tmp.
0:000> db 00ebede8
00ebede8 44 3a 5c 64 6f 63 75 6d-65 6e 74 73 5c 56 69 73 D:\documents\Vis
00ebedf8 75 61 6c 20 53 74 75 64-69 6f 20 50 72 6f 6a 65 ual Studio Proje
00ebee08 63 74 73 5c 70 65 5f 69-6e 6a 65 63 74 5c 52 65 cts\pe_inject\Re
00ebee18 6c 65 61 73 65 5c 74 65-73 74 2e 65 78 65 00 ff lease\test.exe..
将~VC25.tmp->test.exe,shift+F11后就发现exe图标变化了~呵呵
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!