The concept of popping up a meterpreter session using Empire is very easy to understand. Empire can inject code directly into the memory and execute it. We just need to get an obfuscated shellcode or the DLL/EXE generated by msfvenom and inject the DLL/EXE/shellcode into the memory using Empire. Let's first generate a reverse shell DLL using msfvenom:
Upload the malicious DLL using the upload command:
We can now use the invoke_dllinjection module for DLL injection. Let's execute the following commands in order to use this module:
usemodule code_execution/invoke_dllinjection info
Set ProcessID where you want to inject your DLL, and then set the DLL path where you have uploaded the malicious DLL. The location can be an absolute path or a relative path:
Before executing the module, let's start the handler on Metasploit...