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.
- Detect Registry Run Key Modifications 
DeviceRegistryEvents | where RegistryKey has_any ("\\Run", "\\RunOnce", "\\RunServices") | project Timestamp, DeviceName, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessAccountNamePurpose: Identify changes to registry keys used to launch programs at startup.
- Monitor Startup Folder for New Files 
DeviceFileEvents | where FolderPath endswith "Startup" and FileOperation == "Create" | project Timestamp, DeviceName, FileName, FolderPath, InitiatingProcessAccountNamePurpose: Detect new files added to the Startup folder.
- Detect New Service Creation 
    DeviceServiceEvents | where ActionType == "ServiceInstalled" | project Timestamp, DeviceName, ServiceName, InitiatingProcessCommandLine, InitiatingProcessAccountNamePurpose: Monitor for the installation of new services that could be used for persistence.
- Identify New Scheduled Tasks 
DeviceProcessEvents | where ProcessCommandLine has "schtasks /create" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountNamePurpose: Detect the creation of new scheduled tasks.
- 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, RegistryValueDataPurpose: Identify autorun entries that can be used to persist malicious code.
- Detect Creation of WMI Event Subscriptions 
DeviceProcessEvents | where ProcessCommandLine has "wmic" and ProcessCommandLine has "EventFilter" and ProcessCommandLine has "create" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountNamePurpose: Monitor for the creation of WMI event subscriptions that can be used for persistence.
- Identify Modifications to Userinit Key 
DeviceRegistryEvents | where RegistryKey == "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Userinit" | project Timestamp, DeviceName, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessAccountNamePurpose: Detect modifications to the Userinit registry key, which can be used to launch programs at logon.
- Monitor for DLLs Added to Startup Folders 
DeviceFileEvents | where FolderPath endswith "Startup" and FileExtension == ".dll" | project Timestamp, DeviceName, FileName, FolderPath, InitiatingProcessAccountNamePurpose: Detect DLL files added to startup folders for persistence.
- Detect Modifications to Shell Registry Key 
DeviceRegistryEvents | where RegistryKey == "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Shell" | project Timestamp, DeviceName, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessAccountNamePurpose: Monitor for changes to the Shell registry key that can be used to persist malware.
- Identify New Logon Scripts 
DeviceFileEvents | where FolderPath has "Scripts\\Logon" and FileOperation == "Create" | project Timestamp, DeviceName, FileName, FolderPath, InitiatingProcessAccountNamePurpose: 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.
- Detect Creation of New Scheduled Tasks 
DeviceProcessEvents | where ProcessCommandLine has "schtasks /create" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountNamePurpose: Identify the creation of new scheduled tasks.
- Monitor for Changes to Existing Scheduled Tasks 
DeviceProcessEvents | where ProcessCommandLine has "schtasks /change" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountNamePurpose: Detect changes made to existing scheduled tasks.
- 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, InitiatingProcessAccountNamePurpose: Monitor for scheduled tasks executing commands commonly used in attacks.
- Detect Scheduled Task Execution 
DeviceProcessEvents | where ProcessCommandLine has "taskeng.exe" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountNamePurpose: Identify the execution of scheduled tasks.
- Monitor for Scheduled Task Executions by Non-Admin Users 
DeviceProcessEvents | where ProcessCommandLine has "taskeng.exe" and InitiatingProcessAccountName != "Administrator" | project Timestamp, DeviceName, ProcessCommandLinePurpose: Detect scheduled tasks being executed by non-administrative users.
- Identify Scheduled Task Execution with Elevated Privileges 
DeviceProcessEvents | where ProcessCommandLine has "taskeng.exe" and TokenElevationType == "Full" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountNamePurpose: Monitor for scheduled tasks running with elevated privileges.
- Detect Suspicious Task Scheduler Executables 
DeviceProcessEvents | where ProcessCommandLine has_any ("taskeng.exe", "taskschd.msc") | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountNamePurpose: Identify suspicious use of task scheduler executables.
- Monitor for AT Command Usage 
DeviceProcessEvents | where ProcessCommandLine has "at" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountNamePurpose: Detect the use of the AT command to schedule tasks.
- Identify Suspicious Scheduled Task Parameters 
DeviceProcessEvents | where ProcessCommandLine has "schtasks" and ProcessCommandLine has_any ("/TN", "/TR", "/SC") | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountNamePurpose: Monitor for suspicious parameters in scheduled tasks.
- Detect Creation of Hidden Scheduled Tasks 
DeviceProcessEvents | where ProcessCommandLine has "schtasks /create" and ProcessCommandLine has "/RU SYSTEM" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountNamePurpose: 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.
- 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, InitiatingProcessAccountNamePurpose: Identify new or modified entries in registry run keys.
- Monitor Startup Folder for New Executables 
DeviceFileEvents | where FolderPath endswith "Startup" and FileExtension == ".exe" and FileOperation == "Create" | project Timestamp, DeviceName, FileName, FolderPath, InitiatingProcessAccountNamePurpose: Detect new executable files added to the Startup folder.
- 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, InitiatingProcessAccountNamePurpose: Detect DLLs added to registry run keys for persistence.
- 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, InitiatingProcessAccountNamePurpose: Identify suspicious modifications to RunOnce registry keys.
- Detect Executables Added to Startup Folders 
DeviceFileEvents | where FolderPath endswith "Startup" and FileExtension == ".exe" | project Timestamp, DeviceName, FileName, FolderPath, InitiatingProcessAccountNamePurpose: Monitor for executables added to Startup folders that could be used for persistence.
- Identify Script Files Added to Startup Folders 
DeviceFileEvents | where FolderPath endswith "Startup" and FileExtension in (".vbs", ".ps1", ".bat") | project Timestamp, DeviceName, FileName, FolderPath, InitiatingProcessAccountNamePurpose: Detect script files added to Startup folders for persistence.
- 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, InitiatingProcessAccountNamePurpose: Identify suspicious entries in RunServices registry keys.
- Detect Modifications to Shell Registry Key 
DeviceRegistryEvents | where RegistryKey == "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Shell" | project Timestamp, DeviceName, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessAccountNamePurpose: Monitor for changes to the Shell registry key that may indicate persistence.
- Identify Modifications to Userinit Key 
DeviceRegistryEvents | where RegistryKey == "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Userinit" | project Timestamp, DeviceName, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessAccountNamePurpose: Detect modifications to the Userinit registry key for persistence.
- 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, InitiatingProcessAccountNamePurpose: 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.
- Detect New Service Creation 
DeviceServiceEvents | where ActionType == "ServiceInstalled" | project Timestamp, DeviceName, ServiceName, InitiatingProcessCommandLine, InitiatingProcessAccountNamePurpose: Identify the installation of new services that could be used for persistence.
- Monitor for Service Configuration Changes 
DeviceServiceEvents | where ActionType == "ServiceModified" | project Timestamp, DeviceName, ServiceName, InitiatingProcessCommandLine, InitiatingProcessAccountNamePurpose: Detect changes to existing service configurations.
- Identify Services Set to Auto Start 
DeviceServiceEvents | where ActionType == "ServiceInstalled" and ServiceStartType == "Auto" | project Timestamp, DeviceName, ServiceName, InitiatingProcessCommandLine, InitiatingProcessAccountNamePurpose: Monitor for services configured to start automatically, which may be used for persistence.
- Detect Services Running Executables from Non-Standard Locations 
DeviceServiceEvents | where ActionType == "ServiceInstalled" and InitiatingProcessFolderPath has_not "C:\\Windows\\System32" | project Timestamp, DeviceName, ServiceName, InitiatingProcessCommandLine, InitiatingProcessAccountNamePurpose: Identify services running executables from unusual or non-standard locations.
- Monitor for New Service Executables 
DeviceFileEvents | where FilePath has "\\System32\\services.exe" | project Timestamp, DeviceName, FileName, FilePath, InitiatingProcessAccountNamePurpose: Detect new executables associated with services.
- Identify Suspicious Service Descriptions 
DeviceServiceEvents | where ActionType == "ServiceInstalled" and ServiceDescription has_any ("backdoor", "trojan", "rat") | project Timestamp, DeviceName, ServiceName, ServiceDescription, InitiatingProcessAccountNamePurpose: Monitor for suspicious service descriptions that may indicate malicious intent.
- Detect Modifications to System Services 
DeviceServiceEvents | where ActionType == "ServiceModified" and InitiatingProcessAccountName != "SYSTEM" | project Timestamp, DeviceName, ServiceName, InitiatingProcessCommandLine, InitiatingProcessAccountNamePurpose: Identify modifications to system services by non-system accounts.
- Monitor for Services with Elevated Privileges 
DeviceServiceEvents | where ActionType == "ServiceInstalled" and InitiatingProcessAccountName == "SYSTEM" | project Timestamp, DeviceName, ServiceName, InitiatingProcessCommandLinePurpose: Detect services installed with elevated privileges.
- Identify Services Executing Suspicious Commands 
DeviceServiceEvents | where ActionType == "ServiceInstalled" and InitiatingProcessCommandLine has_any ("powershell.exe", "cmd.exe", "wscript.exe") | project Timestamp, DeviceName, ServiceName, InitiatingProcessCommandLine, InitiatingProcessAccountNamePurpose: Monitor for services executing suspicious commands.
- Detect Services Executing Non-Executable Files 
DeviceServiceEvents | where ActionType == "ServiceInstalled" and InitiatingProcessCommandLine has_any (".txt", ".log", ".pdf") | project Timestamp, DeviceName, ServiceName, InitiatingProcessCommandLine, InitiatingProcessAccountNamePurpose: 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.
- Detect New Browser Extension Installation 
DeviceProcessEvents | where ProcessCommandLine has_any ("chrome.exe", "firefox.exe", "edge.exe") and ProcessCommandLine has "ExtensionInstall" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountNamePurpose: Identify the installation of new browser extensions.
- 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, InitiatingProcessAccountNamePurpose: Detect modifications to existing browser extensions.
- 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, InitiatingProcessAccountNamePurpose: Monitor for browser extensions requesting suspicious permissions.
- Detect Browser Extensions Executing Scripts 
DeviceProcessEvents | where ProcessCommandLine has_any ("chrome.exe", "firefox.exe", "edge.exe") and ProcessCommandLine has ".js" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountNamePurpose: Identify browser extensions executing JavaScript files.
- 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, InitiatingProcessAccountNamePurpose: Detect unusual activity in browser extension folders.
- Identify Browser Extensions Making Network Requests 
DeviceNetworkEvents | where RemotePort == 443 and InitiatingProcessFileName in ("chrome.exe", "firefox.exe", "msedge.exe") | project Timestamp, DeviceName, RemoteIP, InitiatingProcessCommandLinePurpose: Monitor for network requests made by browser extensions.
- 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, InitiatingProcessAccountNamePurpose: Identify browser extensions accessing sensitive files.
- 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, InitiatingProcessAccountNamePurpose: Detect browser extensions installed by non-administrative users.
- 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, InitiatingProcessAccountNamePurpose: Monitor for browser extensions executing system commands.
- Detect Browser Extensions with Elevated Privileges 
DeviceProcessEvents | where ProcessCommandLine has_any ("chrome.exe", "firefox.exe", "edge.exe") and TokenElevationType == "Full" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountNamePurpose: 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.
- Detect Creation of WMI Event Filters 
DeviceProcessEvents | where ProcessCommandLine has "wmic" and ProcessCommandLine has "EventFilter" and ProcessCommandLine has "create" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountNamePurpose: Identify the creation of WMI event filters for persistence.
- Monitor for Modification of WMI Event Filters 
DeviceProcessEvents | where ProcessCommandLine has "wmic" and ProcessCommandLine has "EventFilter" and ProcessCommandLine has "modify" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountNamePurpose: Detect modifications to existing WMI event filters.
- 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, InitiatingProcessAccountNamePurpose: Monitor for WMI event consumers that create or modify files.
- 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, InitiatingProcessAccountNamePurpose: Identify WMI event consumers executing suspicious commands.
- Monitor for New or Modified System Log Event Filters 
DeviceRegistryEvents | where RegistryKey has "HKLM\\System\\CurrentControlSet\\Services\\EventLog" | project Timestamp, DeviceName, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessAccountNamePurpose: Detect new or modified system log event filters.
- Identify Task Scheduler Event Triggers 
DeviceProcessEvents | where ProcessCommandLine has "schtasks" and ProcessCommandLine has "/SC ONLOGON" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountNamePurpose: Monitor for task scheduler event triggers associated with logon events.
- Detect Creation of Hidden WMI Event Consumers 
DeviceProcessEvents | where ProcessCommandLine has "wmic" and ProcessCommandLine has "CommandLineEventConsumer" and ProcessCommandLine has "/NOINTERACTIVE" | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountNamePurpose: Identify the creation of hidden WMI event consumers.
- 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, InitiatingProcessAccountNamePurpose: Detect event triggers that execute in response to user activity.
- Identify System Service Event Triggers 
DeviceServiceEvents | where ActionType == "ServiceModified" and ServiceStartType == "TriggerStart" | project Timestamp, DeviceName, ServiceName, InitiatingProcessCommandLine, InitiatingProcessAccountNamePurpose: Monitor for system services configured to trigger on specific events.
- 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, InitiatingProcessAccountNamePurpose: Identify scheduled tasks with event triggers that run with elevated privileges.
Last updated