🔏
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 Persistence Activities in an Environment Using Defender/Sentinel
  • 1. T1547 - Boot or Logon Autostart Execution
  • 2. T1053 - Scheduled Task/Job
  • 3. T1060 - Registry Run Keys / Startup Folder
  • 4. T1543 - Create or Modify System Process
  • 5. T1176 - Browser Extensions
  • 6. T1546 - Event Triggered Execution
Edit on GitHub
  1. SOC Operations
  2. Intermediate and Advanced Skills
  3. Investigate Using MITRE ATT&CK Methodology

Persistence (TA0003) Techniques

Introduction

Investigating persistence mechanisms in a network, Windows workstations, and server systems is crucial in understanding how attackers maintain access to compromised environments. Persistence allows attackers to regain entry even after initial entry points are closed, making it a critical aspect of forensic analysis.

Understand Common Persistence Techniques

  • Registry Keys: Autoruns, Run keys, and other registry locations where programs can be set to run on startup.

  • Startup Folders: Programs placed in these directories will automatically launch at startup.

  • Scheduled Tasks: Malicious tasks can be scheduled to run at specific times or intervals.

  • Service Creation: Malware can install itself as a service, which is automatically started by Windows.

  • DLL Hijacking: Malware replaces legitimate DLLs or adds malicious DLLs referenced by legitimate programs.

  • WMI Event Subscriptions: WMI can execute scripts or binaries in response to certain system events.

  • Account Manipulation: Creation of new user accounts or modification of existing accounts for future access.

Data Collection and Preservation

  • Forensic Imaging: Use tools like FTK Imager or dd to create images of affected systems.

  • Live System Data: If possible, gather live data, including running processes, network connections, and currently loaded drivers.

  • Log Collection: Collect security logs, system logs, application logs, and event logs.

Analysis Techniques

  • Registry Analysis: Use tools like Registry Explorer or RegRipper to analyse registry hives for unauthorised modifications.

  • File System Analysis: Tools like Autopsy or X-Ways can analyse file systems for suspicious files in startup directories, unusual file creation/modification dates, or hidden files.

  • Scheduled Task Analysis: Review Windows Task Scheduler for any unrecognised or suspicious tasks.

  • Service Analysis: Examine the list of installed services for unknown or modified services.

  • Log Analysis: Investigate logs for evidence of account creation, modification, or other signs of unauthorised access.

Investigate Common Persistence Locations

  • Autostart Locations: Check common autostart locations like HKCU\Software\Microsoft\Windows\CurrentVersion\Run or HKLM\Software\Microsoft\Windows\CurrentVersion\Run.

  • Startup Directories: Inspect directories like %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup.

  • Task Scheduler: Look for tasks that execute on system start or at regular intervals.

  • Services: Analyse the list of services (services.msc) for new or modified entries.

Network Analysis

  • Endpoint Detection and Response (EDR): Use EDR tools to monitor network traffic for signs of C2 communication.

  • SIEM Systems: Analyse aggregated logs for patterns indicative of persistence mechanisms.

6. Utilise Specialised Forensic Tools

  • Sysinternals Suite: Tools like Autoruns can help identify programs configured to run during system bootup.

  • PowerShell Scripts: Scripts like Get-Service, Get-ScheduledTask, or custom scripts can help identify anomalies.

Documentation and Reporting

  • Detailed Documentation: Keep a detailed record of all findings, methods used, and evidence paths.

  • Reporting: Prepare a comprehensive report outlining the persistence mechanisms found, their impact, and recommendations for remediation.

Remediation and Recovery

  • Remove Persistence Mechanisms: Based on findings, remove or disable the identified persistence mechanisms.

  • Strengthen Defenses: Update security policies, patch vulnerabilities, and adjust endpoint protection strategies.

Post-Incident Analysis

  • Review and Learn: Analyse the incident to understand how the persistence was established and improve defences accordingly.

Key Considerations

  • Legal and Compliance: Ensure compliance with legal and organisational guidelines.

  • Chain of Custody: Maintain a clear chain of custody for all forensic evidence.

  • Confidentiality: Ensure that sensitive data is handled appropriately.

Persistence investigation requires a comprehensive approach, leveraging various tools and techniques to uncover how attackers maintain access. Tailor your investigation to the specifics of the incident and the environment you are dealing with.

Using KQL to Investigate Persistence Activities in an Environment Using Defender/Sentinel

Persistence techniques allow adversaries to maintain access to a compromised system even after reboots or other interruptions.

1. T1547 - Boot or Logon Autostart Execution

Objective: Detect mechanisms that automatically execute code upon boot or user logon.

  1. Detect Registry Run Key Modifications

DeviceRegistryEvents | where RegistryKey has_any ("\\Run", "\\RunOnce", "\\RunServices") | project Timestamp, DeviceName, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessAccountName

Purpose: Identify changes to registry keys used to launch programs at startup.

  1. Monitor Startup Folder for New Files

DeviceFileEvents | where FolderPath endswith "Startup" and FileOperation == "Create" | project Timestamp, DeviceName, FileName, FolderPath, InitiatingProcessAccountName

Purpose: Detect new files added to the Startup folder.

  1. Detect New Service Creation

    DeviceServiceEvents | where ActionType == "ServiceInstalled" | project Timestamp, DeviceName, ServiceName, InitiatingProcessCommandLine, InitiatingProcessAccountName

Purpose: Monitor for the installation of new services that could be used for persistence.

  1. Identify New Scheduled Tasks

DeviceProcessEvents | where ProcessCommandLine has "schtasks /create" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Detect the creation of new scheduled tasks.

  1. Monitor for Autorun Entries in the Registry

DeviceRegistryEvents | where RegistryKey has_any ("HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run") | project Timestamp, DeviceName, RegistryKey, RegistryValueName, RegistryValueData

Purpose: Identify autorun entries that can be used to persist malicious code.

  1. Detect Creation of WMI Event Subscriptions

DeviceProcessEvents | where ProcessCommandLine has "wmic" and ProcessCommandLine has "EventFilter" and ProcessCommandLine has "create" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Monitor for the creation of WMI event subscriptions that can be used for persistence.

  1. Identify Modifications to Userinit Key

DeviceRegistryEvents | where RegistryKey == "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Userinit" | project Timestamp, DeviceName, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessAccountName

Purpose: Detect modifications to the Userinit registry key, which can be used to launch programs at logon.

  1. Monitor for DLLs Added to Startup Folders

DeviceFileEvents | where FolderPath endswith "Startup" and FileExtension == ".dll" | project Timestamp, DeviceName, FileName, FolderPath, InitiatingProcessAccountName

Purpose: Detect DLL files added to startup folders for persistence.

  1. Detect Modifications to Shell Registry Key

DeviceRegistryEvents | where RegistryKey == "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Shell" | project Timestamp, DeviceName, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessAccountName

Purpose: Monitor for changes to the Shell registry key that can be used to persist malware.

  1. Identify New Logon Scripts

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

Purpose: Detect new logon scripts that can be used for persistence.

2. T1053 - Scheduled Task/Job

Objective: Detect the creation or modification of scheduled tasks or jobs that persistently execute malicious code.

  1. Detect Creation of New Scheduled Tasks

DeviceProcessEvents | where ProcessCommandLine has "schtasks /create" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Identify the creation of new scheduled tasks.

  1. Monitor for Changes to Existing Scheduled Tasks

DeviceProcessEvents | where ProcessCommandLine has "schtasks /change" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Detect changes made to existing scheduled tasks.

  1. Identify Scheduled Task Executing Suspicious Commands

DeviceProcessEvents | where ProcessCommandLine has "schtasks /create" and ProcessCommandLine has_any ("powershell.exe", "cmd.exe", "wscript.exe") | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Monitor for scheduled tasks executing commands commonly used in attacks.

  1. Detect Scheduled Task Execution

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

Purpose: Identify the execution of scheduled tasks.

  1. Monitor for Scheduled Task Executions by Non-Admin Users

DeviceProcessEvents | where ProcessCommandLine has "taskeng.exe" and InitiatingProcessAccountName != "Administrator" | project Timestamp, DeviceName, ProcessCommandLine

Purpose: Detect scheduled tasks being executed by non-administrative users.

  1. Identify Scheduled Task Execution with Elevated Privileges

DeviceProcessEvents | where ProcessCommandLine has "taskeng.exe" and TokenElevationType == "Full" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Monitor for scheduled tasks running with elevated privileges.

  1. Detect Suspicious Task Scheduler Executables

DeviceProcessEvents | where ProcessCommandLine has_any ("taskeng.exe", "taskschd.msc") | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Identify suspicious use of task scheduler executables.

  1. Monitor for AT Command Usage

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

Purpose: Detect the use of the AT command to schedule tasks.

  1. Identify Suspicious Scheduled Task Parameters

DeviceProcessEvents | where ProcessCommandLine has "schtasks" and ProcessCommandLine has_any ("/TN", "/TR", "/SC") | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Monitor for suspicious parameters in scheduled tasks.

  1. Detect Creation of Hidden Scheduled Tasks

DeviceProcessEvents | where ProcessCommandLine has "schtasks /create" and ProcessCommandLine has "/RU SYSTEM" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Identify the creation of hidden or system-level scheduled tasks.

3. T1060 - Registry Run Keys / Startup Folder

Objective: Detect the use of registry run keys or startup folders to maintain persistence on a system.

  1. Detect New Entries in Registry Run Keys

DeviceRegistryEvents | where RegistryKey has_any ("HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run") | project Timestamp, DeviceName, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessAccountName

Purpose: Identify new or modified entries in registry run keys.

  1. Monitor Startup Folder for New Executables

DeviceFileEvents | where FolderPath endswith "Startup" and FileExtension == ".exe" and FileOperation == "Create" | project Timestamp, DeviceName, FileName, FolderPath, InitiatingProcessAccountName

Purpose: Detect new executable files added to the Startup folder.

  1. Identify DLLs Added to Registry Run Keys

DeviceRegistryEvents | where RegistryKey has_any ("HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run") and RegistryValueData has ".dll" | project Timestamp, DeviceName, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessAccountName

Purpose: Detect DLLs added to registry run keys for persistence.

  1. Monitor for Suspicious Modifications to RunOnce Keys

DeviceRegistryEvents | where RegistryKey has_any ("HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce", "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce") | project Timestamp, DeviceName, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessAccountName

Purpose: Identify suspicious modifications to RunOnce registry keys.

  1. Detect Executables Added to Startup Folders

DeviceFileEvents | where FolderPath endswith "Startup" and FileExtension == ".exe" | project Timestamp, DeviceName, FileName, FolderPath, InitiatingProcessAccountName

Purpose: Monitor for executables added to Startup folders that could be used for persistence.

  1. Identify Script Files Added to Startup Folders

DeviceFileEvents | where FolderPath endswith "Startup" and FileExtension in (".vbs", ".ps1", ".bat") | project Timestamp, DeviceName, FileName, FolderPath, InitiatingProcessAccountName

Purpose: Detect script files added to Startup folders for persistence.

  1. Monitor for Suspicious Entries in RunServices Keys

DeviceRegistryEvents | where RegistryKey has_any ("HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices", "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices") | project Timestamp, DeviceName, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessAccountName

Purpose: Identify suspicious entries in RunServices registry keys.

  1. Detect Modifications to Shell Registry Key

DeviceRegistryEvents | where RegistryKey == "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Shell" | project Timestamp, DeviceName, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessAccountName

Purpose: Monitor for changes to the Shell registry key that may indicate persistence.

  1. Identify Modifications to Userinit Key

DeviceRegistryEvents | where RegistryKey == "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Userinit" | project Timestamp, DeviceName, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessAccountName

Purpose: Detect modifications to the Userinit registry key for persistence.

  1. Monitor for Unusual Activity in Common Startup Locations

DeviceFileEvents | where FolderPath has_any ("C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Startup", "C:\\Users\\%USERNAME%\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup") | project Timestamp, DeviceName, FileName, FolderPath, InitiatingProcessAccountName

Purpose: Detect unusual activity in common startup locations.

4. T1543 - Create or Modify System Process

Objective: Detect the creation or modification of system processes for persistence.

  1. Detect New Service Creation

DeviceServiceEvents | where ActionType == "ServiceInstalled" | project Timestamp, DeviceName, ServiceName, InitiatingProcessCommandLine, InitiatingProcessAccountName

Purpose: Identify the installation of new services that could be used for persistence.

  1. Monitor for Service Configuration Changes

DeviceServiceEvents | where ActionType == "ServiceModified" | project Timestamp, DeviceName, ServiceName, InitiatingProcessCommandLine, InitiatingProcessAccountName

Purpose: Detect changes to existing service configurations.

  1. Identify Services Set to Auto Start

DeviceServiceEvents | where ActionType == "ServiceInstalled" and ServiceStartType == "Auto" | project Timestamp, DeviceName, ServiceName, InitiatingProcessCommandLine, InitiatingProcessAccountName

Purpose: Monitor for services configured to start automatically, which may be used for persistence.

  1. Detect Services Running Executables from Non-Standard Locations

DeviceServiceEvents | where ActionType == "ServiceInstalled" and InitiatingProcessFolderPath has_not "C:\\Windows\\System32" | project Timestamp, DeviceName, ServiceName, InitiatingProcessCommandLine, InitiatingProcessAccountName

Purpose: Identify services running executables from unusual or non-standard locations.

  1. Monitor for New Service Executables

DeviceFileEvents | where FilePath has "\\System32\\services.exe" | project Timestamp, DeviceName, FileName, FilePath, InitiatingProcessAccountName

Purpose: Detect new executables associated with services.

  1. Identify Suspicious Service Descriptions

DeviceServiceEvents | where ActionType == "ServiceInstalled" and ServiceDescription has_any ("backdoor", "trojan", "rat") | project Timestamp, DeviceName, ServiceName, ServiceDescription, InitiatingProcessAccountName

Purpose: Monitor for suspicious service descriptions that may indicate malicious intent.

  1. Detect Modifications to System Services

DeviceServiceEvents | where ActionType == "ServiceModified" and InitiatingProcessAccountName != "SYSTEM" | project Timestamp, DeviceName, ServiceName, InitiatingProcessCommandLine, InitiatingProcessAccountName

Purpose: Identify modifications to system services by non-system accounts.

  1. Monitor for Services with Elevated Privileges

DeviceServiceEvents | where ActionType == "ServiceInstalled" and InitiatingProcessAccountName == "SYSTEM" | project Timestamp, DeviceName, ServiceName, InitiatingProcessCommandLine

Purpose: Detect services installed with elevated privileges.

  1. Identify Services Executing Suspicious Commands

DeviceServiceEvents | where ActionType == "ServiceInstalled" and InitiatingProcessCommandLine has_any ("powershell.exe", "cmd.exe", "wscript.exe") | project Timestamp, DeviceName, ServiceName, InitiatingProcessCommandLine, InitiatingProcessAccountName

Purpose: Monitor for services executing suspicious commands.

  1. Detect Services Executing Non-Executable Files

DeviceServiceEvents | where ActionType == "ServiceInstalled" and InitiatingProcessCommandLine has_any (".txt", ".log", ".pdf") | project Timestamp, DeviceName, ServiceName, InitiatingProcessCommandLine, InitiatingProcessAccountName

Purpose: Identify services configured to execute non-executable files.

5. T1176 - Browser Extensions

Objective: Detect the installation or modification of browser extensions that can be used for persistence.

  1. Detect New Browser Extension Installation

DeviceProcessEvents | where ProcessCommandLine has_any ("chrome.exe", "firefox.exe", "edge.exe") and ProcessCommandLine has "ExtensionInstall" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Identify the installation of new browser extensions.

  1. Monitor for Changes to Existing Browser Extensions

DeviceFileEvents | where FolderPath has_any ("Chrome\\Extensions", "Firefox\\Profiles", "Edge\\Extensions") and FileOperation == "Modify" | project Timestamp, DeviceName, FileName, FolderPath, InitiatingProcessAccountName

Purpose: Detect modifications to existing browser extensions.

  1. Identify Browser Extensions with Suspicious Permissions

DeviceProcessEvents | where ProcessCommandLine has_any ("chrome.exe", "firefox.exe", "edge.exe") and ProcessCommandLine has_any ("<all_urls>", "activeTab") | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Monitor for browser extensions requesting suspicious permissions.

  1. Detect Browser Extensions Executing Scripts

DeviceProcessEvents | where ProcessCommandLine has_any ("chrome.exe", "firefox.exe", "edge.exe") and ProcessCommandLine has ".js" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Identify browser extensions executing JavaScript files.

  1. Monitor for Unusual Activity in Browser Extension Folders

DeviceFileEvents | where FolderPath has_any ("Chrome\\Extensions", "Firefox\\Profiles", "Edge\\Extensions") and FileOperation == "Create" | project Timestamp, DeviceName, FileName, FolderPath, InitiatingProcessAccountName

Purpose: Detect unusual activity in browser extension folders.

  1. Identify Browser Extensions Making Network Requests

DeviceNetworkEvents | where RemotePort == 443 and InitiatingProcessFileName in ("chrome.exe", "firefox.exe", "msedge.exe") | project Timestamp, DeviceName, RemoteIP, InitiatingProcessCommandLine

Purpose: Monitor for network requests made by browser extensions.

  1. Detect Extensions Accessing Sensitive Files

DeviceFileEvents | where InitiatingProcessFileName in ("chrome.exe", "firefox.exe", "msedge.exe") and FilePath has_any (".docx", ".xlsx", ".pdf") | project Timestamp, DeviceName, FileName, FolderPath, InitiatingProcessAccountName

Purpose: Identify browser extensions accessing sensitive files.

  1. Monitor for Browser Extensions Installed by Non-Admin Users

DeviceProcessEvents | where ProcessCommandLine has_any ("chrome.exe", "firefox.exe", "edge.exe") and InitiatingProcessAccountName != "Administrator" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Detect browser extensions installed by non-administrative users.

  1. Identify Browser Extensions Executing System Commands

DeviceProcessEvents | where ProcessCommandLine has_any ("chrome.exe", "firefox.exe", "edge.exe") and ProcessCommandLine has_any ("cmd.exe", "powershell.exe", "wscript.exe") | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Monitor for browser extensions executing system commands.

  1. Detect Browser Extensions with Elevated Privileges

DeviceProcessEvents | where ProcessCommandLine has_any ("chrome.exe", "firefox.exe", "edge.exe") and TokenElevationType == "Full" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Identify browser extensions operating with elevated privileges.

6. T1546 - Event Triggered Execution

Objective: Detect the creation or modification of event triggers that persistently execute malicious code in response to specific events.

  1. Detect Creation of WMI Event Filters

DeviceProcessEvents | where ProcessCommandLine has "wmic" and ProcessCommandLine has "EventFilter" and ProcessCommandLine has "create" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Identify the creation of WMI event filters for persistence.

  1. Monitor for Modification of WMI Event Filters

DeviceProcessEvents | where ProcessCommandLine has "wmic" and ProcessCommandLine has "EventFilter" and ProcessCommandLine has "modify" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Detect modifications to existing WMI event filters.

  1. Identify WMI Event Consumers Creating or Modifying Files

DeviceProcessEvents | where ProcessCommandLine has "wmic" and ProcessCommandLine has "CommandLineEventConsumer" and ProcessCommandLine has_any ("cmd.exe", "powershell.exe") | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Monitor for WMI event consumers that create or modify files.

  1. Detect WMI Event Consumers Executing Suspicious Commands

DeviceProcessEvents | where ProcessCommandLine has "wmic" and ProcessCommandLine has "CommandLineEventConsumer" and ProcessCommandLine has_any ("explorer.exe", "taskeng.exe") | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Identify WMI event consumers executing suspicious commands.

  1. Monitor for New or Modified System Log Event Filters

DeviceRegistryEvents | where RegistryKey has "HKLM\\System\\CurrentControlSet\\Services\\EventLog" | project Timestamp, DeviceName, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessAccountName

Purpose: Detect new or modified system log event filters.

  1. Identify Task Scheduler Event Triggers

DeviceProcessEvents | where ProcessCommandLine has "schtasks" and ProcessCommandLine has "/SC ONLOGON" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Monitor for task scheduler event triggers associated with logon events.

  1. Detect Creation of Hidden WMI Event Consumers

DeviceProcessEvents | where ProcessCommandLine has "wmic" and ProcessCommandLine has "CommandLineEventConsumer" and ProcessCommandLine has "/NOINTERACTIVE" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Identify the creation of hidden WMI event consumers.

  1. Monitor for Suspicious Event Triggers Related to User Activity

DeviceProcessEvents | where ProcessCommandLine has "schtasks" and ProcessCommandLine has_any ("/SC ONIDLE", "/SC ONWORKSTATIONUNLOCK") | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Detect event triggers that execute in response to user activity.

  1. Identify System Service Event Triggers

DeviceServiceEvents | where ActionType == "ServiceModified" and ServiceStartType == "TriggerStart" | project Timestamp, DeviceName, ServiceName, InitiatingProcessCommandLine, InitiatingProcessAccountName

Purpose: Monitor for system services configured to trigger on specific events.

  1. Detect Scheduled Task Event Triggers with Elevated Privileges

DeviceProcessEvents | where ProcessCommandLine has "schtasks" and ProcessCommandLine has_any ("/SC ONSTART", "/SC ONLOGON") and TokenElevationType == "Full" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName

Purpose: Identify scheduled tasks with event triggers that run with elevated privileges.

PreviousCommand Execution (TA0002) TechniquesNextPrivilege Escalation (TA0004) Techniques

Last updated 4 months ago