PDA

View Full Version : [Release] DLL Injection Project



Dyndrilliac
11-06-2005, 12:38 PM
Recently I started work on creating a nifty DLL Injector from scratch, and now it's done. I wrote my core DLL in C++ to handle the actual injection, and a pretty client in Visual Basic. The test DLL is also written in C++. The archive contains all the binaries and the source to each piece.

The VB source for the client also shows how to use my Injection API.

To use the program, place the InjectionLib.dll in your system32 directory.

Download Here (http://www.hackcentral.2ya.com/INJECTOR.zip)

Megaz
11-06-2005, 02:19 PM
thanks alot for this.

Aberrant
11-06-2005, 04:52 PM
As usual, you rock thanks for the info.

SatansMessiah
11-06-2005, 05:01 PM
nice setup dude:)

K? Pŕo?ćtiόnŹ
11-06-2005, 05:13 PM
I was going to do something like this but my part of the project was all the hard work...

XCreepingDeathX
11-06-2005, 06:46 PM
Good Job. I repped.

NyNe
11-09-2005, 02:29 AM
sorry for this question being dumb
but how does the InjectionLib and TestLib DLLs work?

good job with the exe btw

Perma
11-09-2005, 07:59 AM
The injection library works nicely. Good work, Dynsecks. :wub:

Dyndrilliac
11-09-2005, 09:02 AM
sorry for this question being dumb
but how does the InjectionLib and TestLib DLLs work?

good job with the exe btw

I believe the source to both is in the *.zip archive. TestLib is just an empty DLL that makes a call to MessageBoxA() once it has been successfully injected. InjectionLib uses the infamous VirtualAllocEx/CreateRemoteThread/LoadLibrary/VirtualFreeEx method of injection. It may be easier if I post the source.


#include <windows.h>
#include <stdlib.h>

// These are our function prototypes.
BOOL WINAPI InjectByWindowTitle(LPCTSTR szWindowTitle, LPCTSTR szFileName);
BOOL WINAPI InjectByWindowClass(LPCTSTR szWindowClass, LPCTSTR szFileName);
BOOL WINAPI Inject();

// This struct allows us to keep our info on our target process organized.
struct PROCINFO {
HWND hTargetWnd;
DWORD pId;
HANDLE hThread;
HANDLE hProc;
LPVOID rAddress;
HMODULE hLibrary;
};

PROCINFO PIS;
LPCTSTR szLibrary;

BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) {
switch (dwReason) {
case DLL_PROCESS_ATTACH:
break;
case DLL_PROCESS_DETACH:
break;
default:
break;
}

return true;
}

BOOL WINAPI InjectByWindowTitle(LPCTSTR szWindowTitle, LPCTSTR szFileName) {
PIS.hTargetWnd = FindWindow(NULL, szWindowTitle);
szLibrary = szFileName;

return Inject();
}

BOOL WINAPI InjectByWindowClass(LPCTSTR szWindowClass, LPCTSTR szFileName) {
PIS.hTargetWnd = FindWindow(szWindowClass, NULL);
szLibrary = szFileName;

return Inject();
}

BOOL WINAPI Inject() {

GetWindowThreadProcessId(PIS.hTargetWnd, &PIS.pId);

if ((PIS.hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, PIS.pId)) == NULL) {
return FALSE;
}

if ((PIS.rAddress = VirtualAllocEx(PIS.hProc, NULL, strlen(szLibrary), MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE)) == NULL) {
return FALSE;
}

if (!WriteProcessMemory(PIS.hProc, PIS.rAddress, (LPVOID)szLibrary, strlen(szLibrary), NULL)) {
VirtualFreeEx(PIS.hProc, PIS.rAddress, strlen(szLibrary), MEM_RELEASE|MEM_DECOMMIT);
return FALSE;
}

PIS.hLibrary = GetModuleHandle("KERNEL32.DLL");

PIS.hThread = CreateRemoteThread(PIS.hProc, NULL, 0, (LPTHREAD_START_ROUTINE)GetProcAddress(PIS.hLibrar y, "LoadLibraryA"), PIS.rAddress, 0, NULL);
if (PIS.hThread == NULL) {
VirtualFreeEx(PIS.hProc, PIS.rAddress, strlen(szLibrary), MEM_RELEASE|MEM_DECOMMIT);
return FALSE;
}

VirtualFreeEx(PIS.hProc, PIS.rAddress, strlen(szLibrary), MEM_RELEASE|MEM_DECOMMIT);
CloseHandle(PIS.hProc);

return TRUE;
}

~=HyDrO=~
11-10-2005, 12:05 AM
i see a future hacker coming to join the crew xD!

gj wit ur injector!

*edit*
let me dl and test it tho >.<


*edit*
omg uber wd gj!

hey i got an idea for it..
1. add multiple things to select a .DLL file to inject
2. make a dll finder thingy, like to pull-down and search for the dll...
3. make a window finder thing aswell to make it very much easier to inject the dll's into it...

apart from these, u have made a very nice injector xD

Dyndrilliac
11-10-2005, 08:18 AM
i see a future hacker coming to join the crew xD!

I've been on the gamehacking scene for quite some time.

\Lestat/
11-14-2005, 06:09 AM
damn Dyn thats realy clean (how its suposed to be)awsome work man