Lateral Movement (TA0008) Techniques
Introduction
Forensically investigating lateral movement techniques on workstations and server systems is crucial to understanding how an attacker moves within a network after gaining initial access. Lateral movement involves techniques that enable an attacker to access and control remote systems within a network.
Understanding Common Lateral Movement Techniques
Remote Services: Such as RDP, SSH, VNC.
Exploitation of Trust: Utilising valid credentials or exploiting trusted relationships between systems.
Use of File Shares: Accessing network shares to move files or execute code.
Pass-the-Hash/Pass-the-Ticket: Stealing and reusing authentication tokens.
Remote Execution Tools: Tools like PsExec or remote scripting like PowerShell Remoting.
Initial Data Collection
Forensic Imaging: Create exact copies of the hard drives of affected systems using tools like FTK Imager or dd.
Memory Capture: Capture volatile memory from systems using tools like WinPmem or Magnet RAM Capture.
Log Collection: Gather security logs, system logs, application logs, and especially Windows Event Logs.
Analysing Remote Access
Security and System Logs: Review logs for signs of remote access activities, like RDP logins (Event ID 4624 with logon type 10).
Authentication Logs: Examine logs for abnormal authentication patterns or use of unusual user accounts.
Network Traffic Analysis
Network Monitoring Tools: Use tools like Wireshark or Tcpdump to analyse network traffic for remote access protocols or unusual internal traffic patterns.
Flow Data Analysis: Review NetFlow data for evidence of lateral movements.
Investigating Account Usage
User Account Analysis: Look for evidence of unauthorised use of user accounts, especially privileged ones.
Pass-the-Hash/Pass-the-Ticket Detection: Analyse memory dumps or security logs for signs of these techniques.
File and Directory Analysis
File Access and Movement: Check file access logs for indications of files being accessed or moved in a manner consistent with lateral movement.
Artefact Analysis: Look for artefacts left by remote execution tools or scripts.
Analysing Use of Remote Services
RDP, SSH, and Other Protocols: Examine logs and settings related to these services for unauthorised access or configuration changes.
Service Configuration: Review the configuration of services commonly used for lateral movement.
Specialised Forensic Tools Usage
Forensic Suites: Tools like EnCase, Autopsy, or X-Ways for comprehensive analysis.
Sysinternals Suite: For in-depth analysis of Windows systems, including tools like Process Explorer and TCPView.
Documentation and Reporting
Detailed Documentation: Record all findings, processes used and evidence paths.
Forensic Report: Compile a comprehensive report detailing the lateral movement investigation.
Post-Investigation Actions
Mitigation and Remediation: Implement necessary measures to contain and eradicate the attacker's presence.
Recovery: Restore affected systems from clean backups.
Enhancing Defenses: Update security policies and tools based on the findings.
Key Considerations
Chain of Custody: Maintain an accurate chain of custody for all forensic evidence.
Legal Compliance: Ensure that the investigation complies with legal requirements.
Data Confidentiality: Maintain the confidentiality and integrity of data throughout the investigation.
Lateral movement investigations require a detailed and methodical approach, as attackers often use sophisticated methods to avoid detection. Tailor the investigation to the specifics of the incident and the environment in which you are operating.
Using KQL to Investigate Lateral Movement Activities in an Environment Using Defender/Sentinel
Lateral Movement techniques involve adversaries trying to move through the network to gain access to other systems and sensitive data.
1. T1021.001 - Remote Desktop Protocol (RDP)
Objective: Detect attempts to use RDP to move laterally across systems.
Detect RDP Logon Activity
Purpose: Identify logons that use Remote Desktop Protocol.
Monitor for Unusual RDP Connections
Purpose: Detect RDP connections from unusual IP addresses or at odd hours.
Identify Multiple RDP Sessions from a Single Account
Purpose: Monitor for multiple RDP sessions initiated by the same account in a short time frame.
Detect Suspicious RDP Session Initiation
Purpose: Identify the use of Remote Desktop Connection client.
Monitor for RDP Session Shadowing
Purpose: Detect the use of shadow sessions, which allow viewing or controlling an active RDP session.
Identify Unauthorized RDP Access Attempts
Purpose: Monitor for failed RDP logon attempts, which may indicate unauthorized access attempts.
2. T1021.002 - SMB/Windows Admin Shares
Objective: Detect attempts to use SMB shares for lateral movement, such as administrative shares or file shares.
Detect Access to Admin Shares
Purpose: Identify attempts to access administrative shares like ADMIN$
or C$
.
Monitor for Lateral Movement Using
PsExec
Purpose: Detect the use of PsExec
, a tool commonly used for lateral movement via SMB.
Identify File Transfers Over SMB
Purpose: Monitor for files being copied over SMB shares, which may indicate data exfiltration or tool transfer.
Detect Attempts to Map Network Drives
Purpose: Identify attempts to map network drives using the net use
command.
Monitor for Unauthorized Access to Hidden Shares
Purpose: Detect attempts to access hidden administrative shares like IPC$
.
Identify Use of WMI for SMB-Based Lateral Movement
Purpose: Monitor for WMI commands used to execute processes remotely over SMB.
3. T1075 - Pass the Hash
Objective: Detect attempts to use stolen NTLM hashes to authenticate to other systems without needing the associated plaintext password.
Detect Unusual NTLM Logon Events
Purpose: Identify NTLM logon events that may indicate pass-the-hash attacks.
Monitor for NTLM Authentication Without Interactive Logon
Purpose: Detect NTLM authentication attempts where no interactive logon occurred, potentially indicating pass-the-hash.
Identify High-Frequency NTLM Logons
Purpose: Monitor for multiple NTLM logon attempts in a short time frame.
Detect Use of Mimikatz for Pass-the-Hash
Purpose: Identify the use of Mimikatz, a tool commonly used for pass-the-hash attacks.
Monitor for Suspicious NTLM Network Traffic
Purpose: Detect inbound NTLM traffic that could indicate pass-the-hash attempts.
Identify NTLM Logons from Non-Domain Systems
Purpose: Monitor for NTLM logons originating from non-domain systems, which may indicate an attack.
4. T1021.004 - SSH
Objective: Detect attempts to use SSH for lateral movement, particularly in environments that use SSH for remote management.
Detect SSH Logons
Purpose: Identify SSH logon events, especially those originating from unusual locations.
Monitor for Failed SSH Logon Attempts
Purpose: Detect failed SSH logon attempts, which may indicate brute force attacks.
Identify SSH Connections from Unusual IP Addresses
Purpose: Monitor SSH connections from IP addresses that are not commonly seen.
Detect Use of SSH for File Transfer
Purpose: Identify SSH-based file transfer commands like scp
or rsync
.
Monitor for SSH Key Usage
Purpose: Detect SSH logons using private key files, which could indicate key theft or unauthorized access.
Identify Lateral Movement via SSH in WSL
Purpose: Monitor for SSH lateral movement attempts within Windows Subsystem for Linux (WSL).
5. T1563 - Remote Service Session Hijacking
Objective: Detect attempts to hijack existing remote sessions, such as RDP, VNC, or SSH sessions, to move laterally without establishing a new connection.
Detect Suspicious RDP Shadowing Sessions
Purpose: Identify use of the shadow.exe
tool for RDP session hijacking.
Monitor for VNC Session Hijacking Attempts
Purpose: Detect VNC session hijacking attempts using known VNC clients.
Identify SSH Session Hijacking Commands
Purpose: Monitor for SSH commands attempting to hijack existing sessions.
Detect Attempts to Reuse Existing RDP Sessions
Purpose: Identify attempts to switch or reuse existing RDP sessions using tscon
.
Monitor for Suspicious Use of
rdesktop
(Linux)
Purpose: Detect attempts to hijack or reconnect to RDP sessions using rdesktop
.
Identify Attempts to Hijack Remote Desktop Services
Purpose: Monitor for the use of qwinsta
to enumerate and hijack remote desktop sessions.
6. T1091 - Replication Through Removable Media
Objective: Detect attempts to spread malware or access credentials by replicating data through removable media.
Detect Removable Media Insertion
Purpose: Identify when removable media is inserted into the system, which could be used for lateral movement.
Monitor for Files Transferred to Removable Media
Purpose: Detect files being copied to removable media, potentially as part of data exfiltration or spreading malware.
Identify Execution of Files from Removable Media
Purpose: Monitor for the execution of files from removable media.
Detect Suspicious Scripts on Removable Media
Purpose: Identify potentially malicious scripts on removable media.
Monitor for Autorun Configurations on Removable Media
Purpose: Detect the presence of autorun.inf
files that could automatically execute malicious content.
Identify Data Transfer to Unusual Removable Media Devices
Purpose: Monitor for data transfers to unrecognized or unusual removable media devices.
7. T1021.006 - Windows Remote Management (WinRM)
Objective: Detect attempts to use WinRM for lateral movement, particularly in environments where PowerShell Remoting is used for remote management.
Detect WinRM Logon Activity
Purpose: Identify logons that use WinRM for remote management.
Monitor for Use of PowerShell Remoting via WinRM
Purpose: Detect the use of PowerShell Remoting, which uses WinRM to execute commands remotely.
Identify Unusual WinRM Connections
Purpose: Monitor WinRM connections from unusual IP addresses or during off-hours.
Detect Unauthorized WinRM Configurations
Purpose: Identify changes to WinRM configurations that could enable lateral movement.
Monitor for Use of
Invoke-Command
via WinRM
Purpose: Detect the use of Invoke-Command
to execute PowerShell commands remotely via WinRM.
Identify Suspicious WinRM Logon Failures
Purpose: Monitor for failed WinRM logon attempts, which may indicate unauthorized access attempts.
Last updated