🔏
RootGuard
HomeSOC OperationsIncident ResponseWindows ForensicsLinux ForensicsKQL Investigations
  • Welcome
    • RootGuard
      • Who Am I?
        • Professional Profile
  • Resources Hub
    • Blogs
      • Articles
        • Safeguarding SMEs: The Strategic Importance of a Security Operations Center (SOC)
      • Posts
        • Roadmap to Becoming a Cybersecurity Specialist
        • Starting a Career in Cybersecurity
        • A Guide to Landing Your First Cybersecurity Analyst Role
        • Moving from Intermediate to Expert Incident Responder
  • SOC Operations
    • Introduction
      • Development Resources
        • SOC Analysts Roadmap
        • Becoming A SOC Analyst
        • SOC Analysts Prep Interview Questions
    • Essential Skills
      • Critical Windows EventIDs to Monitor
    • Junior Analyst Skills
      • Splunk Use Cases
      • KQL Use Cases
        • Reconnaissance (TA0043)
        • Initial Access (TA0001)
        • Execution (TA0002)
        • Persistence (TA0003)
        • Privilege Escalation (TA0004)
        • Defence Evasion (TA0005)
        • Credential Access (TA0006)
        • Discovery (TA0007)
        • Lateral Movement (TA0008)
        • Collection (TA0009)
        • Command and Control (TA0011)
        • Exfiltration (TA0010)
        • Impact (TA0040)
      • Investigating Common Attacks
        • Domain Dominance Attacks - Detection & Analysis
        • Investigating a Suspected AD FS Distributed Key Management (DKM) Attack
        • Authentication From Suspicious DeviceName
        • Identifying Interactive or RemoteInteractive Session From Service Account
        • Identifying Split or Part Archive File Transfers
        • Detect Potential Cleartext Credentials in Command Line
        • Detecting Command Line Interpreters Launched via Scheduled Tasks
        • Detecting Files Containing Potentially Sensitive Data
        • Detecting DeviceNetworkEvents From Windows Processes and Domains by TLD
        • Detecting Silent cmd.exe Execution With Redirected STDERR & STDOUT
        • Detecting Low Prevalence DLL Loaded From Process In User Downloads Directory
        • Detecting Virtual Drive Mounted From Archive
        • Identify Execution of Script From User's Downloads Folder
        • Identify Potential RDP Tunneled Sessions
        • Identify Instances of PowerShell Invoke-WebRequest, IWR or Net.WebClient
        • Identify Processes Launched by PowerShell Remoting (WSMProvHost.exe)
        • Detect DeviceNetworkEvents for LOLBAS with Download or Upload Functions
        • Detect Execution of PSEXESVC via Remote Systems
        • Identify Suspicious String in Service Creation ImagePath
        • Identify File with Double Extensions
        • Detect Potential Cleartext Credentials in Commandline
        • Detect When Large Number of Files Downloaded From OneDrive or SharePoint
        • Identify and Investigate Phishing Attacks with KQL
      • PowerShell for SecOps
        • Powershell Remoting
        • Reconnaissance Discovery
        • Initial Access Discovery
        • Execution Discovery
        • Persistence Discovery
        • Privilege Escalation Discovery
        • Defence Evasion Discovery
        • Credential Access Discovery
        • Discovery
        • Lateral Movement Discovery
        • Collection Discovery
        • Command & Control (C2) Discovery
        • Exfiltration Discovery
        • Impact Discovery
      • Packet Analysis (pcap)
        • Tcpdump
        • Tcpdump (Intermediate)
        • Tshark
        • Ngrep
      • Investigating Suspicious Emails Using KQL
    • Intermediate and Advanced Skills
      • Investigate Using MITRE ATT&CK Methodology
        • Reconnaissance (TA0043) Techniques
        • Resource Development (TA0042) Techniques
        • Initial Access (TA0001) Techniques
        • Command Execution (TA0002) Techniques
        • Persistence (TA0003) Techniques
        • Privilege Escalation (TA0004) Techniques
        • Defence Evasion (TA0005) Techniques
        • Credential Access (TA0006) Techniques
        • Discovery (TA0007) Techniques
        • Lateral Movement (TA0008) Techniques
        • Collection (TA0009) Techniques
        • Command and Control (C2) (TA0011) Techniques
        • Exfiltration (TA0010) Techniques
        • Impact (TA0040) Techniques
    • Vulnerability Management
    • Malware Analysis
  • DFIR
    • Incident Response
      • Incident Triage
        • Triage Types and Processes
        • PowerShell for Detection and Analysis
          • Malware or Compromise Investigation
          • Lateral Movement Discovery
        • Registry Analysis
        • Sysinternals Intrusion Analysis
        • PowerShell Intrusion Analysis
        • Velociraptor Intrusion Analysis
        • Zimmerman Tools Intrusion Analysis
      • KAPE Artifacts Analysis
      • Velociraptor Artifacts Analysis
      • Using The Unified Kill Chain Model to Analyse Individual Cyber Attacks
        • Phase 1 - Gaining an Initial Foothold
          • Gaining Access to the Network
          • Establishing a Foothold
          • Network Discovery
      • Response Strategies
        • Privilege Escalation Assessment
        • Command and Control Assessment
        • Command Execution Assessment
        • Defence Evasion Assessment
        • Detection Assessment
        • Discovery Assessment
        • Exfiltration Assessment
        • Initial Access Assessment
        • Initial Impact Assessment Techniques
        • Lateral Movement Assessment
        • Persistence Assessment
    • Windows Forensics
      • Evidence of Execution
      • Window Artifact Analysis
        • Account Usage
        • User Activity Tracking (Event Logs)
        • Program Execution
        • File and Folder Opening
        • File Download
        • Browser Usage
        • Deleted File or File Knowledge
        • External Device & USB Usage
    • Linux Forensics
      • Linux Commandline Basics
      • Host Compromise Assessment
    • KQL for Defender & Sentinel
      • MDO (Office)
      • MDI (Identity)
      • MDE (Endpoint)
    • Memory Forensics
      • Memory Forensics (Volatility 3)
    • Playbooks
      • First Responder DFIR Playbook
        • Device Isolation
        • Evidence Collection
          • Acquire Triage Image Using KAPE
          • Acquire Triage Data Using Velociraptor
          • Acquire Triage Data Using Powershell
          • Acquire Triage Memory Image
          • Acquire Image Using FTK
          • AXIOM Cyber Data Collection
        • Windows Forensic Artefacts
          • Application Execution
          • File & Folder Knowledge
          • External Device Usage
          • Network Activity
          • Windows Event Logs
        • Initial Analysis
          • Memory Analysis (Vol 3)
          • Axiom Cyber Examiner
  • Detection Engineering
    • AD Attack Detections & Mitigations
      • Kerberoasting
      • Authentication Server Response (AS-REP) Roasting
      • Password Spraying
      • MachineAccountQuota Compromise
      • Unconstrained Delegation
      • Password in Group Policy Preferences (GPP) Compromise
      • Active Directory Certificate Services (AD CS) Compromise
      • Golden Certificate
      • DCSync
      • Dumping ntds.dit
      • Golden Ticket
      • Silver Ticket
      • Golden Security Assertion Markup Language (SAML)
      • Microsoft Entra Connect Compromise
      • One-way Domain Trust Bypass
      • Security Identifier (SID) History Compromise
      • Skeleton Key
      • Active Directory Security Controls
      • Active Directory Events for Detecting Compromise
    • Attack Triage Playbooks (KQL Triage)
      • Windows Malware Detection Playbook
      • Linux Host Intrusion Detection Playbook (CLI)
      • Linux Intrusion Detection Playbook
      • Large-Scale Compromise Detection Playbook
      • Ransomware Detection Playbook
      • Phishing Email Compromise Detection Playbook
      • Scam Detection Playbook
      • Customer Phishing Detection Playbook
      • Insider Abuse Detection Playbook
      • Information Leakage Detection Playbook
      • Social Engineering Detection Playbook
      • Malicious Network Behaviour Detection Playbook
      • Windows Intrusion Detection Playbook
      • Vulnerability Detection Playbook
      • Business Email Compromise Detection Playbook
    • Process Execution (KQL Triage)
    • Threat Hunting
      • Hunting Ransomware Indicators
      • Hunting With KQL
        • Detecting Malware Infection (MITRE ATT&CK: T1566, T1059)
        • Discovery Activities (MITRE ATT&CK: T1016, T1083, T1046)
        • Credential Theft (MITRE ATT&CK: T1003, T1078)
        • Lateral Movement (MITRE ATT&CK: T1076, T1021)
        • Data Theft (MITRE ATT&CK: T1041, T1071)
        • Detecting CommandLine Executions (MITRE ATT&CK: T1059)
        • Windows Security Logs (Identity and Logon Activities)
      • Hunting With Splunk
Powered by GitBook
On this page
  • Introduction
  • Using KQL to Investigate Lateral Movement Activities in an Environment Using Defender/Sentinel
  • 1. T1021.001 - Remote Desktop Protocol (RDP)
  • 2. T1021.002 - SMB/Windows Admin Shares
  • 3. T1075 - Pass the Hash
  • 4. T1021.004 - SSH
  • 5. T1563 - Remote Service Session Hijacking
  • 6. T1091 - Replication Through Removable Media
  • 7. T1021.006 - Windows Remote Management (WinRM)
Edit on GitHub
  1. SOC Operations
  2. Intermediate and Advanced Skills
  3. Investigate Using MITRE ATT&CK Methodology

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.

  1. Detect RDP Logon Activity

IdentityLogonEvents | where LogonType == "RemoteInteractive" | project Timestamp, AccountName, LogonType, DeviceName, LogonResult

Purpose: Identify logons that use Remote Desktop Protocol.

  1. Monitor for Unusual RDP Connections

DeviceNetworkEvents | where RemotePort == 3389 | project Timestamp, DeviceName, RemoteIP, RemotePort, InitiatingProcessAccountName

Purpose: Detect RDP connections from unusual IP addresses or at odd hours.

  1. Identify Multiple RDP Sessions from a Single Account

IdentityLogonEvents | where LogonType == "RemoteInteractive" | summarize RDPCount = count() by AccountName, DeviceName | where RDPCount > 3 | project Timestamp, AccountName, DeviceName, RDPCount

Purpose: Monitor for multiple RDP sessions initiated by the same account in a short time frame.

  1. Detect Suspicious RDP Session Initiation

DeviceProcessEvents | where FileName == "mstsc.exe" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Identify the use of Remote Desktop Connection client.

  1. Monitor for RDP Session Shadowing

DeviceProcessEvents | where FileName == "shadow.exe" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Detect the use of shadow sessions, which allow viewing or controlling an active RDP session.

  1. Identify Unauthorized RDP Access Attempts

IdentityLogonEvents | where LogonType == "RemoteInteractive" and LogonResult == "Failed" | project Timestamp, AccountName, DeviceName, LogonResult

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.

  1. Detect Access to Admin Shares

DeviceNetworkEvents | where RemotePort == 445 and RemoteIP != "127.0.0.1" and FolderPath has_any ("\\ADMIN$", "\\C$") | project Timestamp, DeviceName, RemoteIP, FolderPath, InitiatingProcessAccountName

Purpose: Identify attempts to access administrative shares like ADMIN$ or C$.

  1. Monitor for Lateral Movement Using PsExec

DeviceProcessEvents | where ProcessCommandLine has "PsExec.exe" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Detect the use of PsExec, a tool commonly used for lateral movement via SMB.

  1. Identify File Transfers Over SMB

DeviceFileEvents | where FolderPath startswith "\\\\" and FileOperation == "Create" | project Timestamp, DeviceName, FolderPath, FileName, InitiatingProcessAccountName

Purpose: Monitor for files being copied over SMB shares, which may indicate data exfiltration or tool transfer.

  1. Detect Attempts to Map Network Drives

DeviceProcessEvents | where ProcessCommandLine has "net use" and ProcessCommandLine has_not ("\\domain") | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Identify attempts to map network drives using the net use command.

  1. Monitor for Unauthorized Access to Hidden Shares

DeviceNetworkEvents | where RemotePort == 445 and FolderPath has_any ("\\IPC$", "\\print$") | project Timestamp, DeviceName, RemoteIP, FolderPath, InitiatingProcessAccountName

Purpose: Detect attempts to access hidden administrative shares like IPC$.

  1. Identify Use of WMI for SMB-Based Lateral Movement

DeviceProcessEvents | where ProcessCommandLine has_any ("wmic", "process call create") and ProcessCommandLine has "\\\\" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

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.

  1. Detect Unusual NTLM Logon Events

IdentityLogonEvents | where AuthenticationPackage == "NTLM" | project Timestamp, AccountName, DeviceName, LogonType, LogonResult

Purpose: Identify NTLM logon events that may indicate pass-the-hash attacks.

  1. Monitor for NTLM Authentication Without Interactive Logon

IdentityLogonEvents | where LogonType != "Interactive" and AuthenticationPackage == "NTLM" | project Timestamp, AccountName, DeviceName, LogonType, LogonResult

Purpose: Detect NTLM authentication attempts where no interactive logon occurred, potentially indicating pass-the-hash.

  1. Identify High-Frequency NTLM Logons

IdentityLogonEvents | where AuthenticationPackage == "NTLM" | summarize LogonCount = count() by AccountName, DeviceName | where LogonCount > 5 | project Timestamp, AccountName, DeviceName, LogonCount

Purpose: Monitor for multiple NTLM logon attempts in a short time frame.

  1. Detect Use of Mimikatz for Pass-the-Hash

DeviceProcessEvents | where ProcessCommandLine has_any ("mimikatz", "sekurlsa::pth") | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Identify the use of Mimikatz, a tool commonly used for pass-the-hash attacks.

  1. Monitor for Suspicious NTLM Network Traffic

DeviceNetworkEvents | where RemotePort == 445 and Protocol == "TCP" and Direction == "Inbound" | project Timestamp, DeviceName, RemoteIP, RemotePort, Protocol

Purpose: Detect inbound NTLM traffic that could indicate pass-the-hash attempts.

  1. Identify NTLM Logons from Non-Domain Systems

IdentityLogonEvents | where AuthenticationPackage == "NTLM" and AccountDomain != "YourDomain" | project Timestamp, AccountName, AccountDomain, DeviceName, LogonResult

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.

  1. Detect SSH Logons

IdentityLogonEvents | where LogonType == "Network" and ProcessCommandLine has "ssh" | project Timestamp, AccountName, DeviceName, LogonType, LogonResult

Purpose: Identify SSH logon events, especially those originating from unusual locations.

  1. Monitor for Failed SSH Logon Attempts

IdentityLogonEvents | where LogonType == "Network" and ProcessCommandLine has "ssh" and LogonResult == "Failed" | project Timestamp, AccountName, DeviceName, LogonType, LogonResult

Purpose: Detect failed SSH logon attempts, which may indicate brute force attacks.

  1. Identify SSH Connections from Unusual IP Addresses

DeviceNetworkEvents | where RemotePort == 22 | project Timestamp, DeviceName, RemoteIP, RemotePort, InitiatingProcessAccountName

Purpose: Monitor SSH connections from IP addresses that are not commonly seen.

  1. Detect Use of SSH for File Transfer

DeviceProcessEvents | where ProcessCommandLine has_any ("scp", "rsync") | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Identify SSH-based file transfer commands like scp or rsync.

  1. Monitor for SSH Key Usage

DeviceProcessEvents | where ProcessCommandLine has "ssh" and ProcessCommandLine has ".pem" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Detect SSH logons using private key files, which could indicate key theft or unauthorized access.

  1. Identify Lateral Movement via SSH in WSL

DeviceProcessEvents | where ProcessCommandLine has "ssh" and FolderPath has "C:\\Users\\" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

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.

  1. Detect Suspicious RDP Shadowing Sessions

DeviceProcessEvents | where FileName == "shadow.exe" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Identify use of the shadow.exe tool for RDP session hijacking.

  1. Monitor for VNC Session Hijacking Attempts

DeviceProcessEvents | where FileName has_any ("vncviewer.exe", "winvnc.exe") | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Detect VNC session hijacking attempts using known VNC clients.

  1. Identify SSH Session Hijacking Commands

DeviceProcessEvents | where ProcessCommandLine has "ssh" and ProcessCommandLine has_any ("-O control", "-o ProxyCommand") | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Monitor for SSH commands attempting to hijack existing sessions.

  1. Detect Attempts to Reuse Existing RDP Sessions

DeviceProcessEvents | where ProcessCommandLine has "tscon" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Identify attempts to switch or reuse existing RDP sessions using tscon.

  1. Monitor for Suspicious Use of rdesktop (Linux)

DeviceProcessEvents | where ProcessCommandLine has "rdesktop" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Detect attempts to hijack or reconnect to RDP sessions using rdesktop.

  1. Identify Attempts to Hijack Remote Desktop Services

DeviceProcessEvents | where ProcessCommandLine has "qwinsta" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

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.

  1. Detect Removable Media Insertion

DeviceEvents | where ActionType == "RemovableMediaInserted" | project Timestamp, DeviceName, RemovableMediaName, InitiatingProcessAccountName

Purpose: Identify when removable media is inserted into the system, which could be used for lateral movement.

  1. Monitor for Files Transferred to Removable Media

DeviceFileEvents | where FolderPath startswith "E:\\" | project Timestamp, DeviceName, FileName, FolderPath, FileOperation, InitiatingProcessAccountName

Purpose: Detect files being copied to removable media, potentially as part of data exfiltration or spreading malware.

  1. Identify Execution of Files from Removable Media

DeviceProcessEvents | where FolderPath startswith "E:\\" and ProcessCommandLine has ".exe" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Monitor for the execution of files from removable media.

  1. Detect Suspicious Scripts on Removable Media

DeviceFileEvents | where FolderPath startswith "E:\\" and FileExtension in (".vbs", ".bat", ".ps1") | project Timestamp, DeviceName, FileName, FolderPath, InitiatingProcessAccountName

Purpose: Identify potentially malicious scripts on removable media.

  1. Monitor for Autorun Configurations on Removable Media

DeviceFileEvents | where FileName == "autorun.inf" | project Timestamp, DeviceName, FileName, FolderPath, InitiatingProcessAccountName

Purpose: Detect the presence of autorun.inf files that could automatically execute malicious content.

  1. Identify Data Transfer to Unusual Removable Media Devices

DeviceFileEvents | where FolderPath startswith "E:\\" and DeviceName has "Unknown" | project Timestamp, DeviceName, FileName, FolderPath, InitiatingProcessAccountName

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.

  1. Detect WinRM Logon Activity

IdentityLogonEvents | where LogonType == "Network" and ProcessCommandLine has "winrm" | project Timestamp, AccountName, DeviceName, LogonType, LogonResult

Purpose: Identify logons that use WinRM for remote management.

  1. Monitor for Use of PowerShell Remoting via WinRM

DeviceProcessEvents | where ProcessCommandLine has "powershell" and ProcessCommandLine has "Enter-PSSession" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Detect the use of PowerShell Remoting, which uses WinRM to execute commands remotely.

  1. Identify Unusual WinRM Connections

DeviceNetworkEvents | where RemotePort == 5985 or RemotePort == 5986 | project Timestamp, DeviceName, RemoteIP, RemotePort, InitiatingProcessAccountName

Purpose: Monitor WinRM connections from unusual IP addresses or during off-hours.

  1. Detect Unauthorized WinRM Configurations

DeviceProcessEvents | where ProcessCommandLine has "winrm" and ProcessCommandLine has_any ("set", "config") | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Identify changes to WinRM configurations that could enable lateral movement.

  1. Monitor for Use of Invoke-Command via WinRM

DeviceProcessEvents | where ProcessCommandLine has "powershell" and ProcessCommandLine has "Invoke-Command" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Detect the use of Invoke-Command to execute PowerShell commands remotely via WinRM.

  1. Identify Suspicious WinRM Logon Failures

IdentityLogonEvents | where LogonType == "Network" and ProcessCommandLine has "winrm" and LogonResult == "Failed" | project Timestamp, AccountName, DeviceName, LogonResult

Purpose: Monitor for failed WinRM logon attempts, which may indicate unauthorized access attempts.

PreviousDiscovery (TA0007) TechniquesNextCollection (TA0009) Techniques

Last updated 4 months ago