能力值:
( LV2,RANK:10 )
2 楼
createremotethread完全可以呀
注入shellcode
能力值:
( LV3,RANK:20 )
3 楼
你去看看罗云斌的《windows32位环境下汇编语言程序设计》过程控制那一章就会了
能力值:
( LV2,RANK:10 )
9 楼
你想单纯的注入DLL 而不被游戏保护所发现。。。 建议你这样吧。 用CretaeProcess(只是一种思路。不是所有保护都可以这么过) 启动游戏时暂停游戏主线程,注入DLL(相当于免杀中的跳转法,把程序的入口地址修改 用LoadLibrary加载我们的DLL) 然后恢复游戏主线程..直至启动完毕后。。
能力值:
( LV2,RANK:10 )
10 楼
代码注入的原理应该是VirtualAllocEx分配内存,然后WriteProcessMemory写Shellcode,然后CreateRemoteThread,如果shellcode是用于DLL注入的话,可以用下LS的方法。
CE里面的代码注入好像是先分配内存写Shell Code,然后修改该代码处跳转到分配内存的那里,运行完再跳回去。
能力值:
( LV2,RANK:10 )
11 楼
CreateRemoteThread
最后会调用到NtCreateThreadEx
能力值:
( LV3,RANK:30 )
13 楼
代码注入的方法有很多种,简单一点的 dll 注入,这样不用调整一些全局变量和跳转的位置;或者直接读写目标进程的内存,写入代码,然后再调整。这些都是要创建远程线程来控制目标进程的,没有绝对的不会被检测的方法,只是根据检测原理来发现检测漏洞来调整自己注入的方法的。
能力值:
( LV4,RANK:50 )
14 楼
#include <stdio.h>
#include <windows.h>
#define INJECT_STACK_SIZE 8192
#define CODESZ_SLACK 320
#pragma message("This program must be compiled in \"Release\" mode, otherwise the _checkesp in injectstub() will cause access violation")
//This program must be compiled in "Release" mode, otherwise the _checkesp in injectstub() will cause access violation
typedef HANDLE (_stdcall *OPENTHREAD) (DWORD dwFlag, BOOL bUnknow, DWORD dwThreadId);
typedef HMODULE (_stdcall *LOADLIBRARY) (LPCTSTR ModuleName);
typedef FARPROC (_stdcall *GETPROCADDR) (HMODULE hModule, LPCTSTR lpProcName);
typedef int (_stdcall *MESSAGEBOXA) (HWND hWnd, LPCTSTR msg, LPCTSTR caption, UINT flags);
typedef HWND (_stdcall *CREATEWINDOW) (DWORD dwExStyle, LPCTSTR IpClassName, LPCTSTR lpWindowName,
DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent,
HMENU hMenu, HANDLE hInstance, LPVOID lpParam);
typedef void (_stdcall *EXITTHREAD) (DWORD dwExitCode);
typedef DWORD (_stdcall *SUSPENDTHREAD) (HANDLE hThread);
typedef HANDLE (_stdcall *GETCURRENTTHREAD)();
typedef struct
{
void *DATA1;
void *DATA2;
void *DATA3;
void *DATA4;
void *DATA5;
void *DATA6;
void *DATA7;
void *DATA8;
void *DATA9;
void *DATA10;
}INJ_DATA, *PINJ_DATA;
void static injectstub(void *param)
{
void **ptr = (void**)param;
char *dll = (char*)ptr[0];
LOADLIBRARY fnLoadLibrary = (LOADLIBRARY)ptr[1];
GETCURRENTTHREAD fnGetThread = (GETCURRENTTHREAD)ptr[2];
SUSPENDTHREAD fnSuspendThread = (SUSPENDTHREAD)ptr[3];
fnLoadLibrary(dll);
fnSuspendThread(fnGetThread());
}
void static label()
{
}
int main()
{
//This program must be compiled in "Release" mode,
//otherwise the _checkesp in injectstub() will cause access violation
char DLLtoInject[255];
long i;
unsigned long pid, tid;
unsigned long pathlen, datalen;
unsigned long written;
unsigned long injectStart, datastart, stubstart;
long codesize;
HANDLE hRemoteThread;
GetModuleFileName(NULL, DLLtoInject, sizeof(DLLtoInject));
for (i = strlen(DLLtoInject); i >= 0; i--)
{
if (DLLtoInject[i] == '\\')
{
strcpy(&DLLtoInject[i + 1], "stealer.dll");//自动注入程序目录下的stealer.dll
break;
}
}
codesize = (long)&injectstub - (long)&label;
if (codesize < 0)
codesize = -codesize;
codesize += CODESZ_SLACK;
printf("dll pid:");
//scanf("%s", DLLtoInject);
//scanf("%d", &pid);
HWND hWnd = FindWindow(NULL, "HAHAHA");//这个程序是根据窗口来判断注入的
if (!hWnd)
{
printf("请启动目标程序再启动本程序,谢谢!\n");
return -1;
}
GetWindowThreadProcessId(hWnd, &pid);
//pid = 5408;
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
if (!hProcess)
{
printf("failed to open process %d.\n", pid);
return -1;
}
pathlen = strlen(DLLtoInject) + 1;
injectStart = (unsigned long)VirtualAllocEx(
hProcess,
0,
codesize + pathlen,
MEM_COMMIT,
PAGE_EXECUTE_READWRITE
);
if (!injectStart)
{
printf("VirtualAllocEx failed.\n");
CloseHandle(hProcess);
return -1;
}
WriteProcessMemory(hProcess, (void *)injectStart, DLLtoInject, pathlen, &written);
if (written != pathlen)
{
printf("write process memory failed.\n");
CloseHandle(hProcess);
return -1;
}
INJ_DATA data;
data.DATA1 = (void*)injectStart;
data.DATA2 = (void*)GetProcAddress(LoadLibrary("kernel32.dll"), "LoadLibraryA");
data.DATA3 = (void*)GetProcAddress(LoadLibrary("kernel32.dll"), "GetCurrentThread");
data.DATA4 = (void*)GetProcAddress(LoadLibrary("kernel32.dll"), "SuspendThread");
datastart = 0xfffffff0 & ((unsigned long)injectStart + pathlen + 0xf);//16byte alignment
WriteProcessMemory(hProcess, (void*)datastart, (void*)&data, sizeof(data), &datalen);
if (datalen != sizeof(data))
{
printf("write data failed.\n");
CloseHandle(hProcess);
return -1;
}
stubstart = 0xfffffff0 & (datastart + datalen + 0xf);//16byte alignment
WriteProcessMemory(hProcess, (void*)stubstart, &injectstub, codesize, &written);
if (written != (unsigned long)codesize)
{
printf("write code failed.\n");
CloseHandle(hProcess);
return -1;
}
hRemoteThread = CreateRemoteThread (//这个函数的调用产生新线程
hProcess,
NULL,
INJECT_STACK_SIZE,
(LPTHREAD_START_ROUTINE)stubstart, //location of injectstub
(void*)datastart,//location of DLL path
CREATE_SUSPENDED,
&tid
);
ResumeThread(hRemoteThread);
if (!hRemoteThread)
{
printf("failed to create remote thread.\n");
CloseHandle(hProcess);
return -1;
}
CloseHandle(hRemoteThread);
CloseHandle(hProcess);
printf("inject succeed, tid = %d.\n", tid);
return 0;
}