MCPcopy Create free account
hub / github.com/ch4ncellor/EAC-Reversal / GatherShellcodeToMap

Method GatherShellcodeToMap

injection.cpp:305–349  ·  view source on GitHub ↗

Most credits to mm injection reversal goes to @Sinclairq.

Source from the content-addressed store, hash-verified

303
304// Most credits to mm injection reversal goes to @Sinclairq.
305__int64 __fastcall EAC::Callbacks::GatherShellcodeToMap(struct_a1 *pInputStruct, __int64 a2, __int64 a3)
306{
307 // [COLLAPSED LOCAL DECLARATIONS. PRESS KEYPAD CTRL-"+" TO EXPAND]
308
309 pOutputStruct = 0i64;
310 if ( pInputStruct )
311 {
312 BaseAddress = EAC::Imports::NtAllocateVirtualMemoryWrapper(pInputStruct, 4096i64, a3, 64);
313 pOutputStruct = BaseAddress;
314 if ( BaseAddress )
315 {
316 EAC::Memory::CheckAddressBounds(BaseAddress, 4096i64);
317 if ( pInputStruct->ImageType == 64 )
318 { // Thanks to @Sinclairq for convieniently writing the shellcode all neatly like this
319 *v7 = EAC::Globals::ShellcodeBuffer64Bit;// 0x48, 0x83, 0xEC, 0x28, // SUB RSP, 0x28
320 // 0x4D, 0x31, 0xC0, // XOR R8, R8
321 // 0x48, 0x31, 0xD2, // XOR RDX, RDX
322 // 0x48, 0xFF, 0xC2, // INC RDX
323 // 0x48, 0xB8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // MOV RAX, 0
324 // 0xFF, 0xD0, // CALL RAX
325 // 0x48, 0x83, 0xC4, 0x28, // ADD RSP, 0x28
326 // 0xC3 // RETN
327 v7[23] = -1;
328 *&v7[15] = pInputStruct->DllEntryPoint;
329 *pOutputStruct = *v7;
330 *(pOutputStruct + 16) = *&v7[16];
331 *(pOutputStruct + 24) = 0xC48348D0;
332 *(pOutputStruct + 28) = 0xC328;
333 }
334 else
335 {
336 v8 = EAC::Globals::ShellcodeBuffer32Bit;// 0x6A, 0x00, // PUSH 0
337 // 0x6A, 0x01, // PUSH 1
338 // 0xFF, 0x74, 0xE4, 0x0C, // PUSH [RSP+0xC]
339 // 0xB8, 0x00, 0x00, 0x00, 0x00, // MOV EAX, 0
340 // 0xFF, 0xD0, // CALL EAX
341 // 0xC2, 0x04, 0x00 // RETN 4
342 *(&v8 + 9) = pInputStruct->DllEntryPoint;
343 *pOutputStruct = v8;
344 *(pOutputStruct + 16) = 4;
345 }
346 }
347 }
348 return pOutputStruct;
349}
350
351char __fastcall EAC::Callbacks::StartManualMap(ULONG64 a1)
352{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected