005
18.12.2004, 16:52 Uhr
FloSoft
Medialer Over-Flow (Administrator)
|
naja bei mir wird schon eine user32.dll geladen, nur nicht die aus dem programmverzeichnis...
Jedenfalls hab ichs nun mal so gemacht: (nach dem Link da oben)
Loader.exe
C++: |
#include "stdafx.h"
int main() { STARTUPINFO si; PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); ZeroMemory( &pi, sizeof(pi) );
if( !CreateProcess( NULL, "Test.exe",NULL,NULL,FALSE,0,NULL,NULL,&si,&pi )) { printf("CreateProcess failed."); } InjectLib(pi.dwProcessId,"test.dll"); // aus den beiden dateien im listing return 0; }
|
Test.exe
C++: |
#include "stdafx.h"
int main(int argc, char* argv[]) { MessageBox(NULL,"Normal","Normal",MB_OK); return 0; }
|
test.dll
C++: |
#include "stdafx.h"
BOOL WINAPI hackedMsg(HWND hwnd,LPSTR a, LPSTR b,UINT uType) { MessageBoxW(NULL,L"Hack",L"Success",MB_OK); return TRUE; }
BOOL InterceptAPI(HMODULE hLocalModule, const char* c_szDllName, const char* c_szApiName, DWORD dwReplaced) { DWORD dwOldProtect; DWORD dwAddressToIntercept = (DWORD)GetProcAddress( GetModuleHandle((char*)c_szDllName), (char*)c_szApiName);
BYTE *pbTargetCode = (BYTE *) dwAddressToIntercept;
BYTE *pbReplaced = (BYTE *) dwReplaced;
VirtualProtect((void *) dwAddressToIntercept, 5, PAGE_WRITECOPY, &dwOldProtect);
*pbTargetCode++ = 0xE9; // jump rel32
*((signed int *)(pbTargetCode)) = pbReplaced - (pbTargetCode +4); VirtualProtect((void *) dwAddressToIntercept, 5, PAGE_EXECUTE, &dwOldProtect); FlushInstructionCache(GetCurrentProcess(), NULL, NULL); return TRUE; }
BOOL WINAPI DllMain(HINSTANCE hInst, DWORD dwReason, LPVOID reserved) { if (dwReason == DLL_PROCESS_ATTACH) { InterceptAPI(hInst,"user32.dll","MessageBoxA",(DWORD) hackedMsg); } else if (dwReason == DLL_PROCESS_DETACH) { // Cleanup } return TRUE; }
|
und so kommt "Hack/Success" beim start über Loader.exe -- class God : public ChuckNorris { }; Dieser Post wurde am 18.12.2004 um 16:53 Uhr von FloSoft editiert. |