27. Post‑Exploitation: Lateral Movement, Persistence, and C2 Frameworks for CTF
⏱ 8 min
⏱ 8 min
sekurlsa::pth in Meterpreter to impersonate a user without the plaintext password.\n- SMB Relay – ntlmrelayx.py from Impacket can relay captured NTLM hashes to other hosts.\n- Remote Service Creation – sc create or PowerShell New-Service to execute payloads on a target.\n\nIn the Pakistani financial context, a compromised easypaisa account can be the entry point for PtH to the internal payment switch.\n\n## Persistence Mechanisms\n1. Registry Run keys – HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run.\n2. Scheduled Tasks – schtasks /create /tn MyTask /tr payload.exe /sc daily.\n3. WMI Event Subscriptions – Use wmic or PowerShell to activate a payload on logon.\n\nThese methods are mapped to MITRE ATT&CK tactics T1050, T1053, and T1547.\n\n## C2 Frameworks\n- Metasploit – msfconsole with payload/reverse_tcp.\n- PowerShell Empire – lightweight agents written in PowerShell.\n- Covenant – cross‑platform C2 with a web‑based GUI.\n\nConfigure listeners on a non‑standard port to avoid basic detection.\n\n## Detection with MITRE ATT&CK and SIEM\nMap each technique to a MITRE ID, then write Sigma rules for your SIEM (e.g., ELK). Example rule for PtH: look for lsass.exe opening handles to remote SAM database. Correlate logs across hosts to spot lateral movement chains.\n\n## Quick Do / Don't\n- Do document every action with timestamps and hashes for the forensic write‑up.\n- Don't reuse the same C2 domain across multiple challenges; isolation prevents flag leakage.\n\n## Takeaway\nPractice a full ** footholds → lateral move → persistence → C2** chain in a sandbox. Use the SBP consumer guidelines to understand what a real‑world attacker would target in financial apps. Report any suspicious activity to NCCIA 1799.