🔏
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
  • Capabilities of PowerShell for Lateral Movement Discovery in DFIR
  • Efficiency Provided by PowerShell in Lateral Movement Discovery
  • Lateral Movement Discovery
  • 1. Remote Execution and Access Tools
  • 2. Pass-the-Hash and Pass-the-Ticket
  • 3. Remote Services and Scheduled Tasks
  • 4. File Sharing and Remote File Copy
  • 5. Credential Harvesting and Stealing
  • 6. Use of Legitimate Admin Tools
  • 7. Domain Controller and Active Directory Access
  • 8. Application and Script Execution
  • 9. Use of Third-Party Remote Access Tools
  • 10. Command and Control (C2) and Beaconing
  • Additional Discovery Techniques
  • 1. Remote Desktop Protocol (RDP) Usage
  • 2. Remote Services and Command Execution
  • 3. Windows Management Instrumentation (WMI)
  • 4. Service and Scheduled Task Creation
  • 5. File and Directory Discovery
  • 6. Account and Credential Manipulation
  • 7. Pass-the-Hash and Pass-the-Ticket Attacks
  • 8. File Transfer and Data Staging
  • 9. Network and Protocol Analysis
  • 10. Anomalous Behaviour and Activity Monitoring
Edit on GitHub
  1. SOC Operations
  2. Junior Analyst Skills
  3. PowerShell for SecOps

Lateral Movement Discovery

Introduction

PowerShell is a vital tool for security operations (SecOps), offering powerful capabilities to manage systems, automate processes, and investigate security incidents. Its deep integration with Windows, flexibility, and robust scripting capabilities make it a go-to tool for Digital Forensics and Incident Response (DFIR). One of its critical applications in DFIR is uncovering Lateral Movement Discovery activities. Lateral movement involves attackers navigating through a network to escalate privileges, access sensitive resources, or maintain persistence. PowerShell allows SecOps teams to efficiently detect and investigate these activities, providing actionable insights to mitigate threats and protect enterprise networks.


Capabilities of PowerShell for Lateral Movement Discovery in DFIR

1. Detecting Unauthorised Credential Use:

PowerShell enables analysts to identify the use of compromised credentials during lateral movement. This includes tracking unusual logins, remote session creations, or suspicious account activities across endpoints.

2. Monitoring Remote Execution Attempts:

Attackers often leverage remote execution tools and protocols like PowerShell Remoting, WMI, or PsExec to move laterally. PowerShell can detect these activities by querying logs, inspecting process creations, and analysing command-line arguments.

3. Investigating File and Payload Transfers:

PowerShell can help uncover unauthorised file transfers, such as malicious payloads being moved between systems. This includes monitoring shared directories, network drives, and suspicious use of file copy tools like robocopy or custom scripts.

4. Identifying Service and Scheduled Task Abuses:

Attackers frequently create or manipulate services and scheduled tasks on remote systems to execute malicious code. PowerShell allows for the enumeration and analysis of these configurations to detect anomalies or unauthorised changes.

5. Analysing Network Connections:

PowerShell provides insights into active and historical network connections, enabling analysts to identify unusual connections between systems that may indicate lateral movement attempts.

6. Detecting Lateral Movement Tools:

Common tools used for lateral movement, such as Mimikatz, Cobalt Strike, or Impacket, leave traces in logs and processes. PowerShell can identify evidence of these tools, as well as their artifacts, across systems.

7. Event Log Analysis for Lateral Movement Patterns:

PowerShell facilitates querying security logs for specific events indicative of lateral movement. This includes analysing Event IDs related to remote logins (e.g., 4624, 4648) or the use of administrative tools like WMI or SMB.


Efficiency Provided by PowerShell in Lateral Movement Discovery

  1. Comprehensive Endpoint Visibility: PowerShell provides access to critical data, such as logs, processes, and network configurations, enabling thorough investigation of lateral movement activities.

  2. Real-Time Detection: PowerShell enables real-time querying and analysis of suspicious activities, allowing security teams to quickly identify and respond to lateral movement attempts.

  3. Scalability: Using PowerShell Remoting, SecOps teams can monitor and investigate lateral movement activities across multiple systems in parallel, making it ideal for enterprise-scale networks.

  4. Automation and Consistency: PowerShell scripts can automate routine discovery tasks, such as log analysis or process enumeration, ensuring consistent detection and reducing manual effort.

  5. Customisable Detection: PowerShell’s scripting flexibility allows analysts to tailor detection mechanisms for specific lateral movement techniques, aligning with frameworks like MITRE ATT&CK.

  6. Integration with Security Tools: PowerShell integrates seamlessly with tools such as Microsoft Sentinel, Defender for Endpoint, and SIEM platforms, enabling enriched detection workflows and automated remediation.


By leveraging PowerShell’s capabilities, SecOps teams can efficiently uncover and analyse lateral movement activities in enterprise networks, enabling rapid containment and strengthening the organisation’s overall security posture.

Lateral Movement Discovery

1. Remote Execution and Access Tools

1.1. Detecting Remote Desktop Protocol (RDP) Usage

Purpose: Identify suspicious use of RDP, which may indicate lateral movement.

Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4624} |  Where-Object {$_.Properties[10].Value -eq '10'} |  Select-Object TimeCreated, @{n='AccountName';e={$_.Properties[5].Value}}, @{n='SourceIP';e={$_.Properties[18].Value}}

1.2. Monitoring for PowerShell Remoting

Purpose: Detect usage of PowerShell Remoting for remote code execution.

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-PowerShell/Operational'; ID=4103} |  Where-Object {$_.Message -like "*Creating Scriptblock text*"} | Select-Object TimeCreated, @{n='ScriptBlock';e={$_.Message}}

2. Pass-the-Hash and Pass-the-Ticket

2.1. Detecting Pass-the-Hash Attacks

Purpose: Monitor for usage of NTLM hashes to authenticate without the actual password.

Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4624} |  Where-Object {$_.Properties[8].Value -eq 'NTLM'} |  Select-Object TimeCreated, @{n='AccountName';e={$_.Properties[5].Value}}, @{n='LogonType';e={$_.Properties[10].Value}}

2.2. Monitoring for Pass-the-Ticket Attempts

Purpose: Identify suspicious usage of Kerberos tickets that may indicate pass-the-ticket attacks.

Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4769} |  Where-Object {$_.Properties[8].Value -eq '0x1'} |  Select-Object TimeCreated, @{n='ServiceName';e={$_.Properties[5].Value}}

3. Remote Services and Scheduled Tasks

3.1. Detecting Remote Service Creation

Purpose: Identify the creation of services on remote systems, often used for lateral movement.

Get-WinEvent -FilterHashtable @{LogName='System'; ID=7045} |  Select-Object TimeCreated, @{n='ServiceName';e={$_.Properties[0].Value}}, @{n='ServiceFile';e={$_.Properties[5].Value}}

3.2. Monitoring Scheduled Tasks on Remote Systems

Purpose: Detect creation of scheduled tasks on remote systems for executing code.

Get-ScheduledTask | Where-Object {$_.Principal.UserId -like "*"} | Select-Object TaskName, Principal, @{n='Actions';e={$_.Actions}}

4. File Sharing and Remote File Copy

4.1. Monitoring for Use of Admin Shares

Purpose: Detect the use of administrative shares (e.g., C$) for file transfers.

Get-WmiObject -Query "SELECT * FROM Win32_Share WHERE Name LIKE 'C$' OR Name LIKE 'ADMIN$'" | Select-Object Name, Path

4.2. Detecting Remote File Copy Operations

Purpose: Identify file copy operations to or from remote systems, which may indicate lateral movement.

Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4663} |  Where-Object {$_.Properties[8].Value -match 'File Read|File Write'} |  Select-Object TimeCreated, @{n='ObjectName';e={$_.Properties[6].Value}}

5. Credential Harvesting and Stealing

5.1. Monitoring for Credential Dumping Tools

Purpose: Detect the use of tools like Mimikatz for credential harvesting.

Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4688} |  Where-Object {$_.Properties[5].Value -match 'mimikatz'} | Select-Object TimeCreated, @{n='ProcessName';e={$_.Properties[5].Value}}, @{n='CommandLine';e={$_.Properties[9].Value}}

5.2. Detecting LSASS Memory Access

Purpose: Monitor for access attempts to the LSASS process, which contains credentials.

Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4656} |  Where-Object {$_.Properties[9].Value -match 'lsass.exe'} |  Select-Object TimeCreated, @{n='ProcessName';e={$_.Properties[5].Value}}, @{n='HandleID';e={$_.Properties[7].Value}}

6. Use of Legitimate Admin Tools

6.1. Detecting PsExec Usage

Purpose: Identify the use of PsExec, a legitimate tool often used for remote execution.

Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4688} |  Where-Object {$_.Properties[5].Value -match 'psexec'} |  Select-Object TimeCreated, @{n='ProcessName';e={$_.Properties[5].Value}}, @{n='CommandLine';e={$_.Properties[9].Value}}

6.2. Monitoring for WMI Remote Command Execution

Purpose: Detect usage of WMI for executing commands remotely.

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-WMI-Activity/Operational'; ID=5857} |  Where-Object {$_.Message -match 'CommandLineEventConsumer'}

7. Domain Controller and Active Directory Access

7.1. Monitoring Access to Domain Controllers

Purpose: Detect unauthorized access or enumeration attempts against domain controllers.

Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4662} |  Where-Object {$_.Properties[8].Value -match 'Domain Controller'} |  Select-Object TimeCreated, @{n='ObjectName';e={$_.Properties[5].Value}}

7.2. Detecting Enumeration of Active Directory

Purpose: Identify attempts to enumerate Active Directory objects, such as users, groups, or computers.

Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4662} |  Where-Object {$_.Properties[5].Value -match 'DS_Replication_*'} |  Select-Object TimeCreated, @{n='ObjectName';e={$_.Properties[5].Value}}

8. Application and Script Execution

8.1. Detecting Script Execution Across Network

Purpose: Identify the execution of scripts on remote systems.

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-PowerShell/Operational'; ID=4104} |  Where-Object {$_.Message -match 'Invoke-Command'} |  Select-Object TimeCreated, @{n='ScriptBlock';e={$_.Message}}

8.2. Monitoring for Malicious Batch Files

Purpose: Detect the execution of batch files that may be used for lateral movement.

Get-ChildItem -Path "C:\Windows\Temp\" -Filter "*.bat" | Select-Object FullName, CreationTime

9. Use of Third-Party Remote Access Tools

9.1. Detecting Use of VNC

Purpose: Identify the use of VNC software for remote control.

Get-WmiObject -Class Win32_Process |  Where-Object {$_.Name -match "vnc"} | Select-Object Name, ProcessId, CommandLine

9.2. Monitoring for TeamViewer Usage

Purpose: Detect the presence and use of TeamViewer for remote sessions.

Get-Process | Where-Object {$_.ProcessName -match 'TeamViewer'} | Select-Object ProcessName, Id, StartTime

10. Command and Control (C2) and Beaconing

10.1. Monitoring for Beaconing Activity

Purpose: Detect regular interval connections that may indicate beaconing.

Get-NetTCPConnection |  Where-Object {$_.State -eq 'Established' -and $_.RemoteAddress -notin 'KnownGoodIPs'} | Group-Object -Property RemoteAddress |  Where-Object {$_.Count -gt 10}

10.2. Detecting C2 Infrastructure Usage

Purpose: Identify connections to known Command and Control infrastructure.

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-DNS-Client/Operational'; ID=101} |  Where-Object {($_.Message -match 'SuspiciousDomain1.com') -or ($_.Message -match 'SuspiciousDomain2.com')}

Additional Discovery Techniques

1. Remote Desktop Protocol (RDP) Usage

1.1. Detecting Unauthorized RDP Sessions

Purpose: Identify unauthorized RDP sessions, which may indicate lateral movement.

Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4624} | Where-Object {$_.Properties[10].Value -eq '10'} |  Select-Object TimeCreated, @{n='AccountName';e={$_.Properties[5].Value}}, @{n='SourceIP';e={$_.Properties[18].Value}}

1.2. Monitoring Multiple RDP Connections from Single Account

Purpose: Detect multiple RDP connections from a single account, indicating potential misuse.

Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4624} | Where-Object {$_.Properties[10].Value -eq '10'} | Group-Object -Property {$_.Properties[5].Value} | Where-Object {$_.Count -gt 5} | Select-Object Name, Count

2. Remote Services and Command Execution

2.1. Detecting PsExec Usage

Purpose: Identify the use of PsExec for remote command execution.

Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4688} | Where-Object {$_.Properties[5].Value -match 'psexec'} | Select-Object TimeCreated, @{n='CommandLine';e={$_.Properties[9].Value}}

2.2. Monitoring Remote PowerShell Sessions

Purpose: Detect unauthorized remote PowerShell sessions.

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-PowerShell/Operational'; ID=4103} | Where-Object {$_.Message -match "New-PSSession"} | Select-Object TimeCreated, @{n='CommandLine';e={$_.Message}}

3. Windows Management Instrumentation (WMI)

3.1. Detecting WMI Command Execution

Purpose: Monitor for commands executed via WMI, often used for lateral movement.

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-WMI-Activity/Operational'; ID=5857} | Where-Object {$_.Message -match 'CommandLineEventConsumer'} | Select-Object TimeCreated, @{n='CommandLine';e={$_.Message}}

3.2. Monitoring WMI Event Subscription Persistence

Purpose: Identify persistent WMI event subscriptions, which can be used for lateral movement.

Get-WmiObject -Namespace "root\subscription" -Class __EventFilter | Select-Object Name, Query

4. Service and Scheduled Task Creation

4.1. Detecting Creation of New Services

Purpose: Identify the creation of new services, which can be used for lateral movement.

Get-WinEvent -FilterHashtable @{LogName='System'; ID=7045} | Select-Object TimeCreated, @{n='ServiceName';e={$_.Properties[0].Value}}, @{n='ServiceFile';e={$_.Properties[5].Value}}

4.2. Monitoring Scheduled Task Creation

Purpose: Detect the creation of scheduled tasks that may be used for executing commands.

Get-ScheduledTask | Where-Object {$_.Principal.UserId -like "*"} | Select-Object TaskName, Principal, @{n='Actions';e={$_.Actions}}

5. File and Directory Discovery

5.1. Monitoring Access to Shared Folders

Purpose: Detect unauthorized access to shared folders, which may indicate lateral movement.

Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4663} | Where-Object {$_.Properties[6].Value -match '\\\\.*\\Share\\'} | Select-Object TimeCreated, @{n='ObjectName';e={$_.Properties[6].Value}}

5.2. Detecting Access to Administrative Shares

Purpose: Identify attempts to access administrative shares, often used for lateral movement.

`Get-WmiObject -Query "SELECT * FROM Win32_Share WHERE Type=0" | Where-Object {($_.Name -match 'C$|ADMIN$')} | Select-Object Name, Path`

6. Account and Credential Manipulation

6.1. Monitoring for Privilege Escalation Attempts

Purpose: Detect actions that indicate attempts to escalate privileges.

`Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4672} | Select-Object TimeCreated, @{n='AccountName';e={$_.Properties[5].Value}}, @{n='Privileges';e={$_.Properties[9].Value}}`

6.2. Detecting Unauthorized User Account Creation

Purpose: Identify the creation of unauthorized user accounts.

Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4720} | Select-Object TimeCreated, @{n='AccountName';e={$_.Properties[0].Value}}, @{n='CreatedBy';e={$_.Properties[1].Value}}

7. Pass-the-Hash and Pass-the-Ticket Attacks

7.1. Detecting NTLM Authentication Attempts

Purpose: Monitor for NTLM authentication attempts, which may indicate pass-the-hash attacks.

Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4624} | Where-Object {$_.Properties[8].Value -eq 'NTLM'} | Select-Object TimeCreated, @{n='AccountName';e={$_.Properties[5].Value}}, @{n='SourceIP';e={$_.Properties[18].Value}}

7.2. Monitoring Kerberos Ticket Requests

Purpose: Identify unusual Kerberos ticket requests, which may indicate pass-the-ticket attacks.

Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4769} | Where-Object {$_.Properties[8].Value -eq "0x1"} | Select-Object TimeCreated, @{n='ServiceName';e={$_.Properties[5].Value}}

8. File Transfer and Data Staging

8.1. Detecting File Transfers via SMB

Purpose: Identify file transfers over SMB, which may indicate lateral movement.

Get-WinEvent -FilterHashtable @{LogName='Security'; ID=5145} | Where-Object {$_.Properties[8].Value -match 'File Read|File Write'} | Select-Object TimeCreated, @{n='ObjectName';e={$_.Properties[6].Value}}

8.2. Monitoring Use of RDP Clipboard for File Transfer

Purpose: Detect the use of RDP clipboard for transferring files.

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-TerminalServices-RDPClient/Operational'; ID=150} | Where-Object {$_.Message -match "Clipboard"} | Select-Object TimeCreated, @{n='Details';e={$_.Message}}

9. Network and Protocol Analysis

9.1. Detecting Anomalous Network Traffic

Purpose: Identify unusual network traffic patterns that may indicate lateral movement.

Get-NetTCPConnection | Where-Object {($_.State -eq 'Established') -and ($_.RemoteAddress -notin 'KnownGoodIPs')} | Select-Object LocalAddress, LocalPort, RemoteAddress, RemotePort

9.2. Monitoring for Use of Lateral Movement Tools

Purpose: Detect the use of tools like SMBexec, CrackMapExec, or other lateral movement tools.

Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4688} | Where-Object {$_.Properties[9].Value -match 'smbexec|crackmapexec'} | Select-Object TimeCreated, @{n='CommandLine';e={$_.Properties[9].Value}}

10. Anomalous Behaviour and Activity Monitoring

10.1. Detecting Anomalous Login Times

Purpose: Identify logins occurring at unusual times, indicating potential lateral movement.

Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4624} | Where-Object {($_.TimeCreated.Hour -lt 6) -or ($_.TimeCreated.Hour -gt 20)} | Select-Object TimeCreated, @{n='AccountName';e={$_.Properties[5].Value}}

10.2. Monitoring for Unusual Access Patterns

Purpose: Detect unusual patterns of access to sensitive systems or data.

Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4663} | Where-Object {($_.Properties[6].Value -match 'SensitiveData') -and ($_.Properties[18].Value -notin 'KnownIPs')} | Select-Object TimeCreated, @{n='ObjectName';e={$_.Properties[6].Value}}
PreviousDiscoveryNextCollection Discovery

Last updated 4 months ago