While Metasploit framework remains a valuable tool for penetration testing, almost all exploits generated by Metasploit or MSFvenom are already updated and detected by most security controls. This necessitates advanced techniques, particularly understanding when a reverse shell outperforms a reverse Meterpreter session.
Why Reverse Shell Surpasses Reverse Meterpreter
Detection Difficulty: Meterpreter sessions are more vulnerable to AV and EDR detection than shell sessions. While Meterpreter allows loading scripts directly (screenshots, webcam access, keyloggers), shell sessions provide basic command access. Though Meterpreter is more convenient, the shell session remains undetected longer because it triggers fewer behavioral flags.
Critical Persistence Behaviour: When antivirus detects malicious injection sources and terminates the parent process, shell reverse TCP sessions can persist. Injected shellcode creates reverse connections in child processes, when AV terminates the parent process, the child process remains as an UNKNOWN process running in the background.
Technical Demonstration
The attack chain uses:
- msfvenom to generate x64 shell_reverse_tcp payloads
- XOR encryption to delay AV detection temporarily
- Custom C# code that decrypts shellcode at runtime and injects into appropriate processes
Testing with Microsoft Windows Defender and Kaspersky Total Security revealed consistent results: an "UNKNOWN" zombie process, parentless, continues to execute remote commands despite parent termination.
The Security Implication
This represents a significant detection gap because the process hierarchy prevents complete removal. Terminating only the victim process fails. The correct mitigation is terminating the entire process tree, which causes the connection to die. Some scenarios require a system restart to fully eliminate the zombie process.
Recommendation for Defenders
AV solutions should close entire process hierarchies rather than individual processes when malicious injection is detected. This behavioural policy change is more effective than any signature update.
Originally published on cytomate.net
