CreateProcessW 函数劫持
调用 detours 库实现劫持支持x86的系统 x64系统暂不支持
测试截图,通过运行创建cmd dll注入版本及注入工具,源代码
#include"stdio.h"
#include "stdlib.h"
#include "windows.h"
#include "detours.h"
#pragma comment(lib,"detours.lib")
BOOL(WINAPI *poldCreateProcess)(
LPCWSTR lpApplicationName,
LPWSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
DWORD dwCreationFlags,
LPVOID lpEnvironment,
LPCWSTR lpCurrentDirectory,
LPSTARTUPINFOW lpStartupInfo,
LPPROCESS_INFORMATION lpProcessInformation
) = CreateProcessW;
BOOL NEWCreateProcessW(
LPCWSTR lpApplicationName,
LPWSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
DWORD dwCreationFlags,
LPVOID lpEnvironment,
LPCWSTR lpCurrentDirectory,
LPSTARTUPINFOW lpStartupInfo,
LPPROCESS_INFORMATION lpProcessInformation
)
{
return 0;
}
void hook()
{
DetourRestoreAfterWith(); //恢复状态
DetourTransactionBegin();//开始拦截
DetourUpdateThread(GetCurrentThread());//刷新线程
DetourAttach((void**)&poldCreateProcess, NEWCreateProcessW);
DetourTransactionCommit();
}
_declspec(dllexport)void go()
{
hook();
} 使用方法,选择explorer.exe 进程注入。
此dll只供研究使用,请不要用于其他非法途径。 谢谢分享,来学习了,好文章了! 谢谢分享,来学习了
页:
[1]