|
You last visited: Today at 12:35
Advertisement
Memory Editing mit injected Dll
Discussion on Memory Editing mit injected Dll within the General Coding forum part of the Coders Den category.
02/06/2009, 15:24
|
#1
|
elite*gold: 115
Join Date: Oct 2007
Posts: 9,390
Received Thanks: 12,345
|
Memory Editing mit injected Dll
Zuerst einmal möchte ich sagen, dass ich zuvor noch nie was mit Dll-Injections zu tun hatte.
Also ich habe ein kleines Programm geschrieben, das eine Dll in einen Prozess injected und anschließend eine Prozedur innerhalb der Dll aufruft. Klappt auch alles wunderbar. Wenn ich nun in der Dll mit WriteProcessMemory() einen Opcode "wegNOPen" will, klappt das auch. Nun will ich aber wenn ich ja schon im Prozess bin, das ganze mit Assembler lösen.
So sieht meine Prozedur aus:
Code:
[B]asm[/B]
mov dword ptr ds:[$0043A83B], $90909090
mov word ptr ds:[$0043A83F], $9090
[B]end;[/B]
Wenn ich das machen will bekomme ich aber "Access Violation". Mit Minesweeper habe ich das auch schon versucht, bekomme da aber auch "Access Violation".
Programmsprache ist Delphi und OS Vista.
Edit: Hab gerade rausgefunden, dass ich nur die Opcodes nicht umschreiben kann, alle anderen Bytes im Speicher kann ich ohne Error ändern.
Edit2: Ich habe es selbst hinbekommen. Musste nur die entsprechende Speicherregion mit VirtualProtect() writable machen. Der Thread kann nun geschlossen/gelöscht werden.
|
|
|
02/06/2009, 21:08
|
#2
|
elite*gold: 46
Join Date: Mar 2006
Posts: 2,589
Received Thanks: 1,198
|
Quote:
Originally Posted by Disconnect
Zuerst einmal möchte ich sagen, dass ich zuvor noch nie was mit Dll-Injections zu tun hatte.
Also ich habe ein kleines Programm geschrieben, das eine Dll in einen Prozess injected und anschließend eine Prozedur innerhalb der Dll aufruft. Klappt auch alles wunderbar. Wenn ich nun in der Dll mit WriteProcessMemory() einen Opcode "wegNOPen" will, klappt das auch. Nun will ich aber wenn ich ja schon im Prozess bin, das ganze mit Assembler lösen.
So sieht meine Prozedur aus:
Code:
[B]asm[/B]
mov dword ptr ds:[$0043A83B], $90909090
mov word ptr ds:[$0043A83F], $9090
[B]end;[/B]
Wenn ich das machen will bekomme ich aber "Access Violation". Mit Minesweeper habe ich das auch schon versucht, bekomme da aber auch "Access Violation".
Programmsprache ist Delphi und OS Vista.
Edit: Hab gerade rausgefunden, dass ich nur die Opcodes nicht umschreiben kann, alle anderen Bytes im Speicher kann ich ohne Error ändern.
Edit2: Ich habe es selbst hinbekommen. Musste nur die entsprechende Speicherregion mit VirtualProtect() writable machen. Der Thread kann nun geschlossen/gelöscht werden.
|
Edit2: Ich habe es selbst hinbekommen. Musste nur die entsprechende Speicherregion mit VirtualProtect() writable machen. Der Thread kann nun geschlossen/gelöscht werden.
Wollte ich auch gerade schreiben
|
|
|
02/07/2009, 22:56
|
#3
|
elite*gold: 0
Join Date: Oct 2008
Posts: 1,637
Received Thanks: 1,119
|
ich habs ma so gelöst (übergangsweise):
Code:
#include <windows.h>
#include <cstdio>
#include <iostream>
using namespace std;
typedef HINSTANCE (*fpLoadLibrary)(char*);
typedef LPVOID (*fpGetProcAddress)(HINSTANCE, char*);
typedef void (*fpFunktion)(void);
struct DllInjecter
{
fpLoadLibrary LoadLibrary;
fpGetProcAddress GetProcAddress;
char path[255];
char func[255];
};
DWORD WINAPI threadstart(LPVOID addr)
{
HINSTANCE hDll;
fpFunktion funktion;
DllInjecter * is = (DllInjecter*)addr;
hDll = is->LoadLibrary(is->path);
funktion = (fpFunktion)is->GetProcAddress(hDll, is->func);
funktion();
return 0;
}
void threadend()
{
}
bool EnableDebugPrivilege()
{
TOKEN_PRIVILEGES priv;
HANDLE hThis, hToken;
LUID luid;
hThis = GetCurrentProcess();
OpenProcessToken(hThis, TOKEN_ADJUST_PRIVILEGES, &hToken);
LookupPrivilegeValue(0, "seDebugPrivilege", &luid);
priv.PrivilegeCount = 1;
priv.Privileges[0].Luid = luid;
priv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(hToken, false, &priv, 0, 0, 0);
CloseHandle(hToken);
CloseHandle(hThis);
return true;
}
int main()
{
EnableDebugPrivilege();
HANDLE hProc;
LPVOID start, thread;
DWORD funcsize;
HINSTANCE hDll;
DllInjecter is;
DWORD id;
HWND hwnd;
hwnd = FindWindow(0,"[WINTITLE]");
if (!hwnd)
{
WinExec("C:\\start3\\_win32.exe");
}
else
{
hDll = LoadLibrary("KERNEL32");
is.LoadLibrary = (fpLoadLibrary)GetProcAddress(hDll, "LoadLibraryA");
is.GetProcAddress = (fpGetProcAddress)GetProcAddress(hDll, "GetProcAddress");
strcpy(is.path, "C:\\die_dll.dll");
strcpy(is.func, "die_func");
funcsize = (DWORD)threadend-(DWORD)threadstart;
GetWindowThreadProcessId(hwnd,&id);
cout << "ID: " << id << endl;
hProc = OpenProcess(PROCESS_ALL_ACCESS, false, id);
printf("Prozess Handle: %x\n", hProc);
start = VirtualAllocEx(hProc, 0, funcsize+sizeof(DllInjecter), MEM_COMMIT, PAGE_EXECUTE_READWRITE);
printf("Memory: %x\n", start);
WriteProcessMemory(hProc, start, (LPVOID)&is, sizeof(DllInjecter), NULL);
thread = (LPVOID)((DWORD)start+sizeof(DllInjecter));
WriteProcessMemory(hProc, thread, (LPVOID)threadstart, funcsize, NULL);
CreateRemoteThread(hProc, 0, 0, (LPTHREAD_START_ROUTINE)thread, start, 0, 0);
CloseHandle(hProc);
}
return 0;
}
|
|
|
02/09/2009, 14:36
|
#4
|
elite*gold: 0
Join Date: Aug 2005
Posts: 1,245
Received Thanks: 60
|
Quote:
Originally Posted by syntex
Edit2: Ich habe es selbst hinbekommen. Musste nur die entsprechende Speicherregion mit VirtualProtect() writable machen. Der Thread kann nun geschlossen/gelöscht werden.
|
Aber sonst geht es euch gut, ja ? Das darf nicht gelöscht werden :P
Close meinetwegen
|
|
|
 |
Similar Threads
|
using memory editing
10/26/2007 - General Coding - 2 Replies
ok, so i downloaded a memory changing program, in this case tsearch, and thought i would have a bash at trying to alter stats on an online game called neocron, at first all seemed to be going well, i found out the 'address' or whateva its called which alters ur money stat. I had a little play around and changed the value, and b4 i know it, my cash ingame has changed from 10k to 100k, i thought this was pretty smart but it didnt want to recognise it and 'believed' i still had 10k even tho it...
|
memory editing
05/24/2006 - General Coding - 5 Replies
also ich wollt mir mal nen eignenen namespoofer fuer wc3 basteln(der von shadowfrench suckt) aber dazu muesst ich wissen wie man in vb etwas in den speicher schreibt hab kein tut gefunden das darauf eingeht
helft mir plz
|
Memory Editing
12/30/2005 - Ragnarok Online - 10 Replies
Hey all,
I just want to know if memory editing is possible on ro. with TSearch for example ...
I deleted the game thats y i cant test it myself so answear me please if u know it.
Thy
|
All times are GMT +1. The time now is 12:35.
|
|