<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Infizieren]]></title><description><![CDATA[<p>Hallo hab ein Problem mit dem infizieren einer dll in ein Process. Also Der Code lässt sich builden und starten. Nachdem ich die Process ID angebe und die Adresse des Handles sowie Memory bekommen habe, strüzt das ZielProgramm ab.</p>
<pre><code>#include &lt;windows.h&gt;
#include &lt;cstdio&gt;

typedef HINSTANCE (*fpLoadLibrary)(char*);
typedef LPVOID (*fpGetProcAddress)(HINSTANCE, char*);
typedef void (*fpFunktion)(void);

struct INJECTSTRUCT
{
       fpLoadLibrary loadlib;
       fpGetProcAddress getprocaddress;
       char path[255];
       char func[255];
};

DWORD WINAPI threadstart(LPVOID addr)
{
	HINSTANCE hDll;
	fpFunktion funktion;
	INJECTSTRUCT * is = (INJECTSTRUCT*)addr;       
	hDll = is-&gt;loadlib(is-&gt;path);
	funktion = (fpFunktion)is-&gt;getprocaddress(hDll, is-&gt;func);
	funktion();
	return 0;

}
void threadend()
{
}

int main()
{
    HANDLE hProc;    
	LPVOID start, thread;    
	DWORD funcsize, written;   
	HINSTANCE hDll;    
	INJECTSTRUCT is;  
	DWORD id;

	hDll = LoadLibrary(&quot;KERNEL32&quot;);   
	is.loadlib = (fpLoadLibrary)GetProcAddress(hDll, &quot;LoadLibraryA&quot;);   
	is.getprocaddress = (fpGetProcAddress)GetProcAddress(hDll, &quot;GetProcAddress&quot;);  
	strcpy(is.path, &quot;C:\\DLL.dll&quot;);  
	strcpy(is.func, &quot;Funktion&quot;);

	funcsize = (DWORD)threadend-(DWORD)threadstart;

	printf(&quot;ID: &quot;);	
	scanf(&quot;%d&quot;,&amp;id);

	hProc = OpenProcess(PROCESS_ALL_ACCESS, false, id);   
	printf(&quot;Prozess Handle:       %x\n&quot;, hProc);

	start = VirtualAllocEx(hProc, 0, funcsize+sizeof(INJECTSTRUCT), MEM_COMMIT, PAGE_EXECUTE_READWRITE);	
	printf(&quot;Memory:               %x\n&quot;, start);

	WriteProcessMemory(hProc, start, (LPVOID)&amp;is, sizeof(INJECTSTRUCT), NULL);

	thread = (LPVOID)((DWORD)start+sizeof(INJECTSTRUCT));	

	WriteProcessMemory(hProc, thread, (LPVOID)threadstart, funcsize, NULL);	
	CreateRemoteThread(hProc, 0, 0, (LPTHREAD_START_ROUTINE)thread, start, 0, 0);

	CloseHandle(hProc);

	return 0;
}
</code></pre>
<p>die DLL</p>
<pre><code>#include &lt;windows.h&gt;

extern &quot;C&quot; void __declspec(dllexport) Funktion()
{
     Beep(2000, 2000);
}

BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
{
    return TRUE;
}
</code></pre>
<p>kennt sich jemand damit aus? Warum stürzt das HANDLE hProc ab? Ich hab als zeil zb Editor genommen und der stürzt immer ab.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/133382/infizieren</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Jul 2026 17:26:51 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/133382.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 17 Jan 2006 12:45:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Infizieren on Tue, 17 Jan 2006 12:45:38 GMT]]></title><description><![CDATA[<p>Hallo hab ein Problem mit dem infizieren einer dll in ein Process. Also Der Code lässt sich builden und starten. Nachdem ich die Process ID angebe und die Adresse des Handles sowie Memory bekommen habe, strüzt das ZielProgramm ab.</p>
<pre><code>#include &lt;windows.h&gt;
#include &lt;cstdio&gt;

typedef HINSTANCE (*fpLoadLibrary)(char*);
typedef LPVOID (*fpGetProcAddress)(HINSTANCE, char*);
typedef void (*fpFunktion)(void);

struct INJECTSTRUCT
{
       fpLoadLibrary loadlib;
       fpGetProcAddress getprocaddress;
       char path[255];
       char func[255];
};

DWORD WINAPI threadstart(LPVOID addr)
{
	HINSTANCE hDll;
	fpFunktion funktion;
	INJECTSTRUCT * is = (INJECTSTRUCT*)addr;       
	hDll = is-&gt;loadlib(is-&gt;path);
	funktion = (fpFunktion)is-&gt;getprocaddress(hDll, is-&gt;func);
	funktion();
	return 0;

}
void threadend()
{
}

int main()
{
    HANDLE hProc;    
	LPVOID start, thread;    
	DWORD funcsize, written;   
	HINSTANCE hDll;    
	INJECTSTRUCT is;  
	DWORD id;

	hDll = LoadLibrary(&quot;KERNEL32&quot;);   
	is.loadlib = (fpLoadLibrary)GetProcAddress(hDll, &quot;LoadLibraryA&quot;);   
	is.getprocaddress = (fpGetProcAddress)GetProcAddress(hDll, &quot;GetProcAddress&quot;);  
	strcpy(is.path, &quot;C:\\DLL.dll&quot;);  
	strcpy(is.func, &quot;Funktion&quot;);

	funcsize = (DWORD)threadend-(DWORD)threadstart;

	printf(&quot;ID: &quot;);	
	scanf(&quot;%d&quot;,&amp;id);

	hProc = OpenProcess(PROCESS_ALL_ACCESS, false, id);   
	printf(&quot;Prozess Handle:       %x\n&quot;, hProc);

	start = VirtualAllocEx(hProc, 0, funcsize+sizeof(INJECTSTRUCT), MEM_COMMIT, PAGE_EXECUTE_READWRITE);	
	printf(&quot;Memory:               %x\n&quot;, start);

	WriteProcessMemory(hProc, start, (LPVOID)&amp;is, sizeof(INJECTSTRUCT), NULL);

	thread = (LPVOID)((DWORD)start+sizeof(INJECTSTRUCT));	

	WriteProcessMemory(hProc, thread, (LPVOID)threadstart, funcsize, NULL);	
	CreateRemoteThread(hProc, 0, 0, (LPTHREAD_START_ROUTINE)thread, start, 0, 0);

	CloseHandle(hProc);

	return 0;
}
</code></pre>
<p>die DLL</p>
<pre><code>#include &lt;windows.h&gt;

extern &quot;C&quot; void __declspec(dllexport) Funktion()
{
     Beep(2000, 2000);
}

BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
{
    return TRUE;
}
</code></pre>
<p>kennt sich jemand damit aus? Warum stürzt das HANDLE hProc ab? Ich hab als zeil zb Editor genommen und der stürzt immer ab.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/968835</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/968835</guid><dc:creator><![CDATA[HANNIBAL LeCtor;]]></dc:creator><pubDate>Tue, 17 Jan 2006 12:45:38 GMT</pubDate></item><item><title><![CDATA[Reply to Infizieren on Tue, 17 Jan 2006 13:29:46 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile.php?mode=viewprofile&amp;u=403" rel="nofollow">HumeSikkins</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=15" rel="nofollow">C++</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=4" rel="nofollow">WinAPI</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic.php?t=39405" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/968887</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/968887</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Tue, 17 Jan 2006 13:29:46 GMT</pubDate></item><item><title><![CDATA[Reply to Infizieren on Tue, 17 Jan 2006 13:35:50 GMT]]></title><description><![CDATA[<p>Du musst Dir mal die Beispiele anschauen:<br />
<a href="http://www.codeproject.com/dll/DLL_Injection_tutorial.asp" rel="nofollow">http://www.codeproject.com/dll/DLL_Injection_tutorial.asp</a><br />
<a href="http://www.google.de/search?q=CreateRemoteThread+site%3Acodeproject.com" rel="nofollow">http://www.google.de/search?q=CreateRemoteThread+site%3Acodeproject.com</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/968896</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/968896</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Tue, 17 Jan 2006 13:35:50 GMT</pubDate></item></channel></rss>