Use. NET can you implement remote thread insertion?
Use strict C # without any other technology. Remote thread insertion is not possible in the. NET platform. However, on the basis of shellcode technology and the insertion of the Code for remote threading. Can be fully implemented based on. NET platform mixed remote thread inserts.
The final effect is this: the executable program used to insert a thread into another process is. NET program (mixed with hundreds of bytes of machine code), the DLL or EXE that is inserted into other processes is also pure. NET is implemented.
The object that can be inserted is the native process with all permissions processes WriteProcessMemory operations.
Implement the technology required for remote thread insertion under C #:. NET process hosted remote thread Insert code insert
What I call the C # implementation of remote thread inserts, the core of which is the one. NET assemblies are hosted in an arbitrary target process on the local computer and run as threads. The CLR environment is simply a COM server. We wrote that. NET assemblies are run with the support of this COM server. If you want to make one. NET assembly runs in any native process. So first of all, that process needs to have. NET environment time environment. Because we need to use it when the remote thread is plugged in. NET environment time environment. Without this environment, our. NET assembly, there is no way to load execution. If the native process is WIN32, no. NET runtime environment? We need to give it a, code as follows:
DWORD __stdcall clrfunclocal()
{
ICLRRuntimeHost * pClrHost;CorBindToRuntimeEx(NULL,NULL,0,CLSID_CLRRuntimeHost,IID_ICLRRuntimeHost,(PVOID*)&pClrHost);pClrHost->Start();DWORD retVal=0;hr=pClrHost->ExecuteInDefaultAppDomain(s_asmpath),s_class,s_method,NULL,&retVal);
}
The last sentence of the preceding code is used to execute one within the default program domain. NET assemblies. This piece of code is written in C + +.
If you write a WIN32 program yourself, you need to load one for some reason. NET assembly and perform its functions. You can write like that. But we do remote thread inserts, so how do we execute the code of numbers in the inserted process? The master already understood. is to compile these code into the same bare executable code as shellcode. Then code insertions with remote threading allow the CLR environment to load into other processes and make it execute what we want. NET assembly code.
If you already have a way to compile the above code into a bare executable native code. You can add these native code as resources to your C # project for backup.
Executing a remote thread insert in C # is the same as in C + +.