无模块远程注入
本帖最后由 690827027 于 2009-3-25 10:02 编辑#include "windows.h"
//MessageBox 函数参数
typedef struct _REMOTE_PARAMETERS
{
HWND hwnd;
LPSTR lpszText;
LPSTR lpszCaption;
int nType;
}REMOTE_PARAMETERS,*PREMOTE_PARAMETERS;
//提升权限
BOOL GetDebugPrivilege()
{
BOOL bResult = FALSE;
HANDLE hToken;
TOKEN_PRIVILEGES TokenPrivileges;
if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES, &hToken))
{
TokenPrivileges.PrivilegeCount = 1;
LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &TokenPrivileges.Privileges.Luid);
TokenPrivileges.Privileges.Attributes = SE_PRIVILEGE_ENABLED;
bResult = AdjustTokenPrivileges(hToken, FALSE, &TokenPrivileges, sizeof(TOKEN_PRIVILEGES), NULL, NULL);
CloseHandle(hToken);
}
return bResult;
}
int main(int argc, char* argv[])
{
DWORD dwoffset = 0,dwsize = 0;
_asm jmp LOOP2
_asm
{
LOOP1:
mov eax,//取地址,即指向PREMOTE_PARAMETERS的指针
mov ebx,
push ebx
mov ebx,
push ebx
mov ebx,
push ebx
mov ebx,dword ptr
push ebx
mov eax, 0X77D5058A//硬编码 MessageBoxA函数地址
push 0X7C80C058//硬编码 ExitThread函数地址
push eax
ret
LOOP2:
lea eax,LOOP1
mov dwoffset,eax
lea eax,LOOP2
sub eax,offset LOOP1
mov dwsize,eax
}
GetDebugPrivilege();
DWORD dwThreadId;
PREMOTE_PARAMETERS lpParamaters = new REMOTE_PARAMETERS;
memset(lpParamaters,0,sizeof(REMOTE_PARAMETERS));
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS,FALSE,3496);//进程ID
LPVOID lpszDes = VirtualAllocEx(hProcess,0,300,MEM_COMMIT,PAGE_EXECUTE_READWRITE);
WriteProcessMemory(hProcess,lpszDes,(char*)dwoffset,100,&dwThreadId);//写入代码
WriteProcessMemory(hProcess,((char*)lpszDes + 100),"Hello QQ\r\n",100,&dwThreadId);//写入弹出字符串
lpParamaters->hwnd = 0;
lpParamaters->lpszText = (LPSTR)((char*)lpszDes + 100);
lpParamaters->lpszCaption = (LPSTR)((char*)lpszDes + 100);
lpParamaters->nType = MB_OKCANCEL|MB_ICONQUESTION;
WriteProcessMemory(hProcess,((char*)lpszDes + 200),lpParamaters,sizeof(REMOTE_PARAMETERS),&dwThreadId);//写入参数
HANDLE hRemoteThread = CreateRemoteThread(hProcess,NULL,0,(LPTHREAD_START_ROUTINE)(lpszDes),((char*)lpszDes + 200),NULL,&dwThreadId);
WaitForSingleObject(hRemoteThread,INFINITE);
return 0;
} 来点说明呀。。。。 好强大的小谭谭,学习~:lol 看不懂了 强啊 来点说明呀。。。。
LCG 发表于 2009-3-25 09:45 http://www.52pojie.cn/images/common/back.gif
先调进程令牌,提升进程权限,然后把要执行的代码写到目标进程里,CreateRemoteThread……
更详细的说明见:http://www.52pojie.cn/thread-19034-1-2.html TokenPrivileges.PrivilegeCount = 1; 虽然看不懂 但感觉好强悍! 好熟悉,学习 强啊 c++菜鸟来看看 本帖最后由 惹火上身 于 2011-3-23 17:02 编辑
看不懂啊 ,膜拜。。
页:
[1]
2