always there for you

善于生活,善于学习,这是我和你的目标.

« dnf进不了的问题普通恶意代码技术分析与检测 »

DLL注入步骤

  DLL注入需要完成的步骤以及所需要的API函数:

1.在要注入的进程中为DLL代码分配所需占据的空间---->VirtualAllocEx

LPVOID WINAPI VirtualAllocEx(
__in HANDLE hProcess,
__in_opt LPVOID lpAddress,
__in SIZE_T dwSize,
__in DWORD flAllocationType,
__in DWORD flProtect);

前去MSDN官方说明地址

2.在要注入的进程中为要注入的DLL所需的参数分配空间---->VirtualAllocEx

3.把DLL的名字和代码写入要注入进程的存储空间---->WriteProcessMemory

BOOL WriteProcessMemory(
HANDLE hProcess,         // handle to process whose memory is written to
LPVOID lpBaseAddress,    // address to start writing to
LPVOID lpBuffer,         // pointer to buffer to write data to
DWORD nSize,             // number of bytes to write
LPDWORD lpNumberOfBytesWritten   // actual number of bytes written
);

4.在要注入进程中创建线程---->CreateRemoteThread

HANDLE CreateRemoteThread(
HANDLE hProcess, // handle to process to create thread in
LPSECURITY_ATTRIBUTES lpThreadAttributes, // pointer to security attributes
DWorD dwStackSize, // initial thread stack size, in bytes
LPTHREAD_START_ROUTINE lpStartAddress, // pointer to thread function
LPVOID lpParameter, // argument for new thread
DWorD dwCreationFlags, // creation flags
LPDWorD lpThreadId // pointer to returned thread identifier
);

5.最后就是清除所消耗的资源了

 

  • 相关文章:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

日历

最新评论及回复

最近发表

Copyright www.alwaysthere.com.cn . Some Rights Reserved.

              

Powered By Z-Blog 1.8 Devo Build 80201