Detection and Prevention
Here are your structured defensive notes for the Shells & Payloads moduleβs Monitoring and Detection section β complete with key concepts, actionable tips, and real-world examples for Blue Team ops ππ‘οΈ:
π‘οΈ Defensive Side: Detecting Shells, Payloads & Exploits
π MITRE ATT&CK Framework
Tactic
Technique
Initial Access
Via public-facing services (web apps, SMB, RDP, etc.), weak auth, or misconfigs. See MITRE or OWASP Top 10.
Execution
Code running on victim host. Includes PowerShell, webshells, MSF payloads, etc. Often linked to exploits or command injection.
Command & Control (C2)
Remote interaction after shell access. Can use HTTP(S), DNS, Slack, Discord, Netcat, Meterpreter. May blend with normal traffic to evade detection.
β οΈ Key Events to Watch For
π File Uploads
Especially on web servers (e.g.,
shell.php
,upload.aspx
)Monitor application logs, antivirus, and firewalls
Use WAFs, AV scanning on upload, and restricted filetypes
π€ Suspicious User Actions
Non-admins using
whoami
,net user
,ipconfig
, etc.Lateral SMB traffic (host β host) is abnormal for users
Monitor command-line logs, PowerShell transcripts, SIEM alerts
π Anomalous Network Sessions
Unusual traffic patterns (e.g., port 4444, uncommon protocols)
Bulk POST/GET requests
Netcat sessions:
Traffic is unencrypted (cleartext)
Easily identifiable in Wireshark, Zeek, or NetFlow
π‘ Establishing Network Visibility
π Good Practices
Document hosts, flows, and devices
Create network topology diagrams
Understand baseline traffic (apps, IPs, protocols, ports)
π οΈ Tools to Explore
NetBrain
Interactive network maps, config management
Cisco Meraki / Ubiquiti / Palo Alto / Check Point
Cloud dashboards with Layer 7 app/protocol visibility
SIEM (Splunk, ELK, etc.)
Log correlation, event triage
Firewall/IDS logs
Monitor traffic, detect unusual access or shell usage
π· Real-World Example
Wireshark Capture: Shows reverse shell to port 4444
Commands seen:
net user hacker Passw0rd! /add net localgroup administrators hacker /add
π§― Protecting End Devices (Endpoints)
π₯οΈ Whatβs an End Device?
Workstations, Servers, Printers, NAS, Smart TVs/Speakers, Cameras
β Basic Defenses
Windows Defender + Firewall (Domain, Private, Public all ON)
Patch Management Strategy
Behavioral Monitoring (e.g., Sysmon, EDR logs)
Restrict admin rights using Group Policy or LAPS
Monitor process creation & parent-child relationships
π Common Mitigations
Application Sandboxing
Isolates app behavior to reduce blast radius (e.g., Docker, AppArmor)
Least Privilege Access
Users should only have the access they need. No domain admins for basic users.
Host Segmentation & Hardening
Follow STIGs; place exposed hosts (e.g., web servers) in DMZs
Firewalls (Physical & App Layer)
Filter ports; deny inbound on common shell ports (e.g., 4444), use NAT and strict ACLs
π§ TL;DR β Core Defensive Takeaways
π Detect webshell uploads with AV/WAF & filetype restrictions
π§ Know what your users shouldn't be doing (e.g., running
whoami
)π Monitor NetFlow and odd traffic (port 4444, DNS tunneling, etc.)
π Correlate endpoint + network data (e.g., Wireshark + Sysmon logs)
π Harden exposed hosts, implement least privilege, and patch fast
Would you like a cheat sheet of MITRE detection rules or a SIEM correlation rule set for detecting C2 traffic next?
Last updated