Process death in Win2k

Source: Internet
Author: User

This program uses a public Win2k injection remote thread to protect the specified process from always running. If wap32.exe is generated and copied to c: \, The Wap32 process will not die.
Include Win32.inc
. 386
. Model flat, stdcall
. Data
Protect2kProc proc ProcID: dword
Call GetKnlOpenProcess
KnlOpenProcess dd?
GetKnlOpenProcess:
Pop eax
Call [eax], PROCESS_ALL_ACCESS, FALSE, ProcID
Or eax, eax
Jz short ExitProtectProc
Mov ebx, eax
Call GetKnlWaitForSingleObject
KnlWaitForSingleObject dd?
GetKnlWaitForSingleObject:
Pop eax
Call [eax], ebx,-1 h
Call GetFileNameAddress
GetFileNameAddress:
Pop ecx
Add ecx, offset FileName-offset GetFileNameAddress
Call GetKnlWinExec
KnlWinExec dd?
GetKnlWinExec:
Pop eax
Call [eax], ecx, 01
ExitProtectProc:
Ret
Protect2kProc endp
FileName db 'C: \ wap32.exe ', 0
KnlOpenProcessStr db 'openprocess', 0
KnlWaitForObjectStr db 'waitforsingleobject', 0
KnlWinExecStr db 'winexec ', 0
. Code
Extrn GetProcAddress: proc
Extrn OpenProcess: proc
Extrn find0000wa: proc
Extrn GetWindowThreadProcessId: proc
Extrn VirtualAllocEx: proc
Extrn VirtualFreeEx: proc
Extrn WriteProcessMemory: proc
Extrn GetCurrentProcessId: proc
Extrn CreateRemoteThread: proc
Extrn GetExitCodeThread: proc
Extrn CloseHandle: proc
Extrn WinExec: proc
Extrn MessageBoxA: proc
Extrn Sleep: proc
Start:
Call GetProcAddress, 077e60000h, offset KnlOpenProcessStr
Mov KnlOpenProcess, eax
Call GetProcAddress, 077e60000h, offset KnlWaitForObjectStr
Mov KnlWaitForSingleObject, eax
Call GetProcAddress, 077e60000h, offset KnlWinExecStr
Mov KnlWinExec, eax
Call find0000wa, 0, 0
Push eax
Call GetWindowThreadProcessId, eax, esp
Call OpenProcess, PROCESS_ALL_ACCESS, FALSE
Or eax, eax
Jz short OpenProcessError
Mov ebx, eax
Call VirtualAllocEx, ebx, NULL, 1000 h, MEM_COMMIT, L 40 h
Or eax, eax
Jz short OpenProcessError
Mov edi, eax
Push eax
Call WriteProcessMemory, ebx, edi, OFF Protect2kProc, 1000 h, esp
Call GetCurrentProcessId
Call CreateRemoteThread, ebx, NULL, NULL, edi, eax, NULL, esp
Call GetExitCodeThread, eax, esp
Pop eax
; Call VirtualFreeEx, ebx, edi, 1000 h, MEM_DECOMMIT
Call CloseHandle, ebx
Call Sleep, 100 h
Call MessageBoxA, 0, offset FileName, offset FileName, 0
OpenProcessError:
Ret
End Start

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.