Command

A directive given to a computer program, acting as an interpreter of some kind, in order to perform a specific task[1][2]

ID: DS0017
Platforms: Android, Containers, Linux, Network, Windows, iOS, macOS
Collection Layers: Container, Host
Contributors: Center for Threat-Informed Defense (CTID); Austin Clark, @c2defense
Version: 1.1
Created: 20 October 2021
Last Modified: 20 April 2023

Data Components

Command: Command Execution

The execution of a line of text, potentially with arguments, created from program code (e.g. a cmdlet executed via powershell.exe, interactive commands like >dir, shell executions, etc. )

Command: Command Execution

The execution of a line of text, potentially with arguments, created from program code (e.g. a cmdlet executed via powershell.exe, interactive commands like >dir, shell executions, etc. )

Domain ID Name Detects
Enterprise T1548 Abuse Elevation Control Mechanism

Monitor executed commands and arguments that may circumvent mechanisms designed to control elevate privileges to gain higher-level permissions.

.001 Setuid and Setgid

Monitor for execution of utilities, like chmod, and their command-line arguments to look for setuid or setguid bits being set.

.002 Bypass User Account Control

Monitor executed commands and arguments that may bypass UAC mechanisms to elevate process privileges on system.

.003 Sudo and Sudo Caching

Monitor executed commands and arguments that may perform sudo caching and/or use the sudoers file to elevate privileges, such as the sudo command.

.006 TCC Manipulation

Monitor executed commands and arguments that may abuse or modify TCC mechanisms designed to control access to elevated privileges. macOS system logs may also indicate when AuthorizationExecuteWithPrivileges is being called.

Enterprise T1134 Access Token Manipulation

Monitor executed commands and arguments for token manipulation by auditing command-line activity. Specifically, analysts should look for use of the runas command. Detailed command-line logging is not enabled by default in Windows.[3]

.001 Token Impersonation/Theft

Monitor executed commands and arguments to detect token manipulation by auditing command-line activity. Specifically, analysts should look for use of the runas command. Detailed command-line logging is not enabled by default in Windows.[3]

.002 Create Process with Token

Monitor executed commands and arguments to detect token manipulation by auditing command-line activity. Specifically, analysts should look for use of the runas command or similar artifacts. Detailed command-line logging is not enabled by default in Windows.[3]

.003 Make and Impersonate Token

Monitor executed commands and arguments to detect token manipulation by auditing command-line activity. Specifically, analysts should look for use of the runas command or similar artifacts. Detailed command-line logging is not enabled by default in Windows.[3]

Enterprise T1087 Account Discovery

Monitor logs and other sources of command execution history for actions that could be taken to gather information about accounts, including the use of calls to cloud APIs that perform account discovery.

System and network discovery techniques normally occur throughout an operation as an adversary learns the environment, and also to an extent in normal network operations. Therefore discovery data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Lateral Movement, based on the information obtained.

.001 Local Account

Monitor for execution of commands and arguments associated with enumeration or information gathering of local accounts and groups such as net user, net account, net localgroup, Get-LocalUser, and dscl.

System and network discovery techniques normally occur throughout an operation as an adversary learns the environment, and also to an extent in normal network operations. Therefore discovery data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Lateral Movement, based on the information obtained.

.002 Domain Account

Monitor for execution of commands and arguments associated with enumeration or information gathering of domain accounts and groups, such as net user /domain and net group /domain, dscacheutil -q groupon macOS, and ldapsearch on Linux.

System and network discovery techniques normally occur throughout an operation as an adversary learns the environment, and also to an extent in normal network operations. Therefore discovery data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Lateral Movement, based on the information obtained.

.003 Email Account

Monitor for execution of commands and arguments associated with enumeration or information gathering of email addresses and accounts such as Get-AddressList, Get-GlobalAddressList, and Get-OfflineAddressBook.

.004 Cloud Account

Monitor logs for actions that could be taken to gather information about cloud accounts, including the use of calls to cloud APIs that perform account discovery.

System and network discovery techniques normally occur throughout an operation as an adversary learns the environment, and also to an extent in normal network operations. Therefore discovery data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Lateral Movement, based on the information obtained.

Enterprise T1098 Account Manipulation

Monitor executed commands and arguments for suspicious commands to modify accounts or account settings (including files such as the authorized_keys or /etc/ssh/sshd_config).

Monitor executed commands and arguments of suspicious commands (such as Add-MailboxPermission) that may be indicative of modifying the permissions of Exchange and other related service settings.

.004 SSH Authorized Keys

Monitor executed commands and arguments to modify the authorized_keys or /etc/ssh/sshd_config files.

Enterprise T1010 Application Window Discovery

Monitor executed commands and arguments for actions that could be taken to gather system and network information. Information may also be acquired through Windows system management tools such as Windows Management Instrumentation and PowerShell.

Note: Commands can also be obtained from Payload event field for PowerShell event id 4103. For PowerShell Module logging event id 4103, enable logging for module Microsoft.PowerShell.Management.

Analytic 1 - Suspicious Commands

sourcetype="WinEventLog:Microsoft-Windows-PowerShell/Operational" EventCode="4103" | where CommandLine LIKE "%Get-Process%" AND CommandLine LIKE "%mainWindowTitle%"

Enterprise T1560 Archive Collected Data

Monitor executed commands and arguments for actions that will aid in compression or encrypting data that is collected prior to exfiltration, such as tar.

.001 Archive via Utility

Monitor executed commands and arguments for actions that will aid in compression or encrypting data that is collected prior to exfiltration, such as tar.

Enterprise T1123 Audio Capture

Monitor executed commands and arguments for actions that can leverage a computer’s peripheral devices (e.g., microphones and webcams) or applications (e.g., voice and video call services) to capture audio recordings for the purpose of listening into sensitive conversations to gather information.

Enterprise T1119 Automated Collection

Monitor executed commands and arguments for actions that could be taken to collect internal data.

ICS T0802 Automated Collection

Monitor executed commands and arguments for actions that could be taken to collect internal data.

Enterprise T1020 Automated Exfiltration

Monitor executed commands and arguments that may exfiltrate data, such as sensitive documents, through the use of automated processing after being gathered during Collection

Enterprise T1197 BITS Jobs

Monitor executed commands and arguments from the BITSAdmin tool (especially the ‘Transfer’, 'Create', 'AddFile', 'SetNotifyFlags', 'SetNotifyCmdLine', 'SetMinRetryDelay', 'SetCustomHeaders', and 'Resume' command options)[4] Admin logs, PowerShell logs, and the Windows Event log for BITS activity.[5] Also consider investigating more detailed information about jobs by parsing the BITS job database.[6]

Enterprise T1547 Boot or Logon Autostart Execution

Monitor executed commands and arguments that may configure system settings to automatically execute a program during system boot or logon to maintain persistence or gain higher-level privileges on compromised systems.

.001 Registry Run Keys / Startup Folder

Monitor executed commands and arguments that may achieve persistence by adding a program to a startup folder or referencing it with a Registry run key.

.002 Authentication Package

Monitor executed commands and arguments that may abuse authentication packages to execute DLLs when the system boots.

.003 Time Providers

Monitor executed commands and arguments that may abuse time providers to execute DLLs when the system boots.

.004 Winlogon Helper DLL

Monitor executed commands and arguments that may abuse features of Winlogon to execute DLLs and/or executables when a user logs in.

.005 Security Support Provider

Monitor executed commands and arguments that may abuse security support providers (SSPs) to execute DLLs when the system boots.

.006 Kernel Modules and Extensions

Loading, unloading, and manipulating modules on Linux systems can be detected by monitoring for the following commands: modprobe, insmod, lsmod, rmmod, or modinfo [7] Adversaries may run commands on the target system before loading a malicious module in order to ensure that it is properly compiled. [8] Adversaries may also execute commands to identify the exact version of the running Linux kernel and/or download multiple versions of the same .ko (kernel object) files to use the one appropriate for the running system.[9] Many LKMs require Linux headers (specific to the target kernel) in order to compile properly. These are typically obtained through the operating systems package manager and installed like a normal package.

On macOS, monitor for execution of kextload commands and user installed kernel extensions performing abnormal and/or potentially malicious activity (such as creating network connections). Monitor for new rows added in the kext_policy table. KextPolicy stores a list of user approved (non Apple) kernel extensions and a partial history of loaded kernel modules in a SQLite database, /var/db/SystemPolicyConfiguration/KextPolicy.[10][11][12]

.007 Re-opened Applications

Monitor executed commands and arguments that may modify plist files to automatically run an application when a user logs in.

.013 XDG Autostart Entries

Monitor executed commands and arguments that may modify XDG autostart entries to execute programs or commands during system boot.

.014 Active Setup

Monitor executed commands and arguments that may achieve persistence by adding a Registry key to the Active Setup of the local machine.

Enterprise T1037 Boot or Logon Initialization Scripts

Monitor executed commands and arguments that may consist of logon scripts for unusual access by abnormal users or at abnormal times.

.001 Logon Script (Windows)

Monitor executed commands and arguments for logon scripts

.002 Login Hook

Monitor executed commands with arguments to install or modify login hooks.

.003 Network Logon Script

Monitor executed commands and arguments for logon scripts

.004 RC Scripts

Monitor executed commands and arguments resulting from RC scripts for unusual or unknown applications or behavior

.005 Startup Items

Monitor executed commands and arguments for logon scripts

Enterprise T1176 Browser Extensions

Monitor executed commands and arguments for usage of the profiles tool, such as profiles install -type=configuration.

Enterprise T1217 Browser Information Discovery

Monitor executed commands and arguments for actions that could be taken to gather browser information, such as local files and databases (e.g., %APPDATA%/Google/Chrome).[13] Remote access tools with built-in features may interact directly using APIs to gather information. Information may also be acquired through system management tools such as Windows Management Instrumentation and PowerShell.

Enterprise T1110 Brute Force

Monitor executed commands and arguments that may use brute force techniques to gain access to accounts when passwords are unknown or when password hashes are obtained.

Analytic 1 - Command-line tools used for brute force attacks.

(index=security sourcetype="Powershell" EventCode=4104) OR(index=os sourcetype="linux_secure" (cmdline IN ("hydra", "medusa", "ncrack", "patator", "john", "hashcat", "rcrack", "w3af", "aircrack-ng"))) OR (index=os sourcetype="macos_secure" (cmdline IN ("hydra", "medusa", "ncrack", "patator", "john", "hashcat", "rcrack", "w3af", "aircrack-ng"))) | where match(CommandLine, "(?i)(hydra|medusa|ncrack|patator|john|hashcat|rcrack|w3af|aircrack-ng)")

Enterprise T1115 Clipboard Data

Monitor executed commands and arguments to collect data stored in the clipboard from users copying information within or between applications.

Enterprise T1651 Cloud Administration Command

Monitor for suspicious command executions via cloud management services like AWS System Manager or Azure RunCommand. In Azure, usage of Azure RunCommand can be identified via the Azure Activity Logs, and additional details on the result of executed jobs are available in the C:\Packages\Plugins\Microsoft.CPlat.Core.RunCommandWindows directory on Windows virtual machines.[14]

Analytic 1 - Abnormal or unauthorized execution of commands/scripts on VMs

index=cloud_logs sourcetype=aws:ssm OR sourcetype=azure:activity| search action IN ("RunCommand", "StartSSMCommand", "ExecuteCommand")

Enterprise T1059 Command and Scripting Interpreter

Monitor command-line arguments for script execution and subsequent behavior. Actions may be related to network and system information Discovery, Collection, or other scriptable post-compromise behaviors and could be used as indicators of detection leading back to the source script. Scripts are likely to perform actions with various effects on a system that may generate events, depending on the types of monitoring used.

Analytic 1 - Suspicious script execution

(sourcetype=WinEventLog:Security OR OR sourcetype=sysmon OR sourcetype=linux_secure OR sourcetype=linux_audit OR sourcetype=mac_os_log OR sourcetype=azure:audit OR sourcetype=o365:audit)| search Image IN ("bash", "sh", "cmd", "powershell", "python", "java", "perl", "ruby", "node", "osascript", "wmic")| eval suspicious_cmds=if(like(command_line, "%Invoke-Obfuscation%") OR like(command_line, "%-EncodedCommand%") OR like(command_line, "%IEX%") OR like(command_line, "%wget%") OR like(command_line, "%curl%"), "Yes", "No")

.001 PowerShell

If proper execution policy is set, adversaries will likely be able to define their own execution policy if they obtain administrator or system access, either through the Registry or at the command line. This change in policy on a system may be a way to detect malicious use of PowerShell. If PowerShell is not used in an environment, then simply looking for PowerShell execution may detect malicious activity. It is also beneficial to turn on PowerShell logging to gain increased fidelity in what occurs during execution (which is applied to .NET invocations). [15] PowerShell 5.0 introduced enhanced logging capabilities, and some of those features have since been added to PowerShell 4.0. Earlier versions of PowerShell do not have many logging features.[16] An organization can gather PowerShell execution details in a data analytic platform to supplement it with other data.

PowerShell can be used over WinRM to remotely run commands on a host. When a remote PowerShell session starts, svchost.exe executes wsmprovhost.exe

For this to work, certain registry keys must be set, and the WinRM service must be enabled. The PowerShell command Enter-PSSession -ComputerName \<RemoteHost> creates a remote PowerShell session.

Analytic 1 - Look for unusual PowerShell execution.

sourcetype=WinEventLog:Microsoft-Windows-PowerShell/Operational| search EventCode=4104| eval suspicious_cmds=if(like(Message, "%-EncodedCommand%") OR like(Message, "%Invoke-Expression%") OR like(Message, "%IEX%") OR like(Message, "%DownloadFile%"), "Yes", "No")| where suspicious_cmds="Yes"

.002 AppleScript

Monitor executed commands and arguments that may abuse AppleScript for execution. Scripts are likely to perform actions with various effects on a system that may generate events, depending on the types of monitoring used. Actions may be related to network and system information Discovery, Collection, or other scriptable post-compromise behaviors and could be used as indicators of detection leading back to the source script.

Analytic 1 - Look for unusual execution of AppleScript.

sourcetype=macOS:Process| search process_name="osascript"| eval suspicious_cmd=if(like(command_line, "%-e%") OR like(command_line, "%path/to/script%"), "Yes", "No")| where suspicious_cmd="Yes"

.003 Windows Command Shell

Monitor executed commands and arguments that may abuse the Windows command shell for execution. Usage of the Windows command shell may be common on administrator, developer, or power user systems depending on job function. If scripting is restricted for normal users, then any attempt to enable scripts running on a system would be considered suspicious. If scripts are not commonly used on a system, but enabled, scripts running out of cycle from patching or other administrator functions are suspicious. Scripts should be captured from the file system when possible to determine their actions and intent.

Analytic 1 - Look for unusual command shell execution.

sourcetype=WinEventLog:Security| search (EventCode=4688 OR EventCode=4689) process_name="cmd.exe"| eval suspicious_cmd=if(like(command_line, "%/c%") OR like(command_line, "%.bat%") OR like(command_line, "%.cmd%"), "Yes", "No")| where suspicious_cmd="Yes"

.004 Unix Shell

Monitor executed commands and arguments that may abuse Unix shell commands and scripts for execution. Unix shell usage may be common on administrator, developer, or power user systems, depending on job function. If scripting is restricted for normal users, then any attempt to enable scripts running on a system would be considered suspicious. If scripts are not commonly used on a system, but enabled, scripts running out of cycle from patching or other administrator functions are suspicious. Scripts should be captured from the file system when possible to determine their actions and intent.

Note: this analytic does not include an exhaustive list of potentially suspicious commands that could be executed through a shell interpreter. Instead, it is meant to serve as an example of types of commands that can warrant further investigation.

Analytic 1 - Unusual command execution

sourcetype="linux_logs" CommandLine="sh -c" AND (CommandLine="wget" OR CommandLine="curl" OR CommandLine="nc" OR CommandLine="perl")

.005 Visual Basic

Monitor executed commands and arguments that may abuse Visual Basic (VB) for execution.

Analytic 1 - Look for unusual VB execution.

sourcetype=wineventlog OR sourcetype=linux_secure OR sourcetype=macos_secure| search (command="cscript.exe" OR command="wscript.exe" OR command=".vbs" OR command=".vba" OR command=".vbe")| eval suspicious_cmd=if(like(command_line, "%.vbs" OR "%.vba" OR "%.vbe"), "Yes", "No")| where suspicious_cmd="Yes"

.006 Python

Monitor systems for abnormal Python usage and python.exe behavior, which could be an indicator of malicious activity. Understanding standard usage patterns is important to avoid a high number of false positives. If scripting is restricted for normal users, then any attempts to enable scripts running on a system would be considered suspicious. If scripts are not commonly used on a system, but enabled, scripts running out of cycle from patching or other administrator functions are suspicious. Scripts should be captured from the file system when possible to determine their actions and intent. Scripts are likely to perform actions with various effects on a system that may generate events, depending on the types of monitoring used. Monitor executed commands and arguments that may abuse Python commands and scripts for execution.

Analytic 1 - Look for unusual Python execution.

OR sourcetype=wineventlog:security OR sourcetype=sysmonEventCode=4688 OR EventCode=1 | search (process_name="python.exe" OR process_name="python3" OR process_name="python")| eval suspicious_script=if(match(command_line, ". -c .|.exec.|.import os.|.eval.|.base64."), "True", "False")| where suspicious_script="True"| table _time, user, host, command_line, process_name, parent_process

.007 JavaScript

Scripting execution is likely to perform actions with various effects on a system that may generate events, depending on the types of monitoring used. Monitor processes and command-line arguments for execution and subsequent behavior. Actions may be related to network and system information Discovery, Collection, or other programmable post-compromise behaviors and could be used as indicators of detection leading back to the source. Monitor for execution of JXA through osascript and usage of OSAScript API that may be related to other suspicious behavior occurring on the system.

.008 Network Device CLI

Consider reviewing command history in either the console or as part of the running memory to determine if unauthorized or suspicious commands were used to modify device configuration. [17] Consider comparing a copy of the network device configuration against a known-good version to discover unauthorized changes to the command interpreter. The same process can be accomplished through a comparison of the run-time memory, though this is non-trivial and may require assistance from the vendor.

.009 Cloud API

Consider reviewing command history in either host machines or cloud audit logs to determine if unauthorized or suspicious commands were executed.

Cloud API activity logging is typically enabled by default and may be reviewed in sources like the Microsoft Unified Audit Log, AWS CloudTrail, and GCP Admin Activty logs. Review these sources for history of executed API commands. Host logs may also be reviewed to capture CLI commands or PowerShell module usage to invoke Cloud API functions.

.010 AutoHotKey & AutoIT

Monitor executed commands and arguments for abnormal usage of utilities and command-line arguments that may be used in support of malicious execution. Compare recent invocations of AutoIt3.exe and AutoHotkey.exe with prior history of known good arguments to determine anomalous and potentially adversarial activity (ex: obfuscated and/or malicious commands).

.011 Lua

Monitor command-line arguments for script execution and subsequent behavior. Actions may be related to network and system information Discovery, Collection, or other scriptable post-compromise behaviors such as using os.execute to execute operating system commands.

Mobile T1623 Command and Scripting Interpreter

Command-line activities can potentially be detected through Mobile Threat Defense (MTD) integrations with lower-level OS APIs. This could grant the MTD agents access to running processes and their parameters, potentially detecting unwanted or malicious shells.

.001 Unix Shell

Command-line activities can potentially be detected through Mobile Threat Defense (MTD) integrations with lower-level OS APIs. This could grant the MTD agents access to running processes and their parameters, potentially detecting unwanted or malicious shells.

ICS T0807 Command-Line Interface

On Windows and Unix systems monitor executed commands and arguments that may use shell commands for execution. Shells may be common on administrator, developer, or power user systems depending on job function.

On network device and embedded system CLIs consider reviewing command history if unauthorized or suspicious commands were used to modify device configuration.

Enterprise T1609 Container Administration Command

Monitor command execution within containers to detect suspicious activity. Commands executed via Docker (docker exec) or Kubernetes (kubectl exec) should be captured along with relevant metadata.

Analytic 1 - Unusual command executions in container services

sourcetype=docker:daemon OR sourcetype=kubernetes:apiserver| search command IN ("docker exec", "kubectl exec")

Enterprise T1136 Create Account

Monitor executed commands and arguments for actions that are associated with account creation, such as net user or useradd

.001 Local Account

Monitor executed commands and arguments for actions that are associated with local account creation, such as net user /add, useradd, dscl -create, and kubectl create serviceaccount.

.002 Domain Account

Monitor executed commands and arguments for actions that are associated with local account creation, such as net user /add /domain.

Enterprise T1543 Create or Modify System Process

Command-line invocation of tools capable of modifying services may be unusual, depending on how systems are typically used in a particular environment. Look for abnormal process call trees from known services and for execution of other commands that could relate to Discovery or other adversary techniques.

.001 Launch Agent

Ensure Launch Agent's ProgramArguments key pointing to executables located in the /tmp or /shared folders are in alignment with enterprise policy. Ensure all Launch Agents with the RunAtLoad key set to true are in alignment with policy.

.002 Systemd Service

Suspicious systemd services can also be identified by comparing results against a trusted system baseline. Malicious systemd services may be detected by using the systemctl utility to examine system wide services: systemctl list-units -–type=service –all. Auditing the execution and command-line arguments of the 'systemctl' utility, as well related utilities such as /usr/sbin/service may reveal malicious systemd service execution.

.003 Windows Service

Monitor processes and command-line arguments for actions that could create or modify services. Command-line invocation of tools capable of adding or modifying services may be unusual, depending on how systems are typically used in a particular environment. Services may also be modified through Windows system management tools such as Windows Management Instrumentation and PowerShell, so additional logging may need to be configured to gather the appropriate data. Also collect service utility execution and service binary path arguments used for analysis. Service binary paths may even be changed to execute commands or scripts.

.004 Launch Daemon

Some legitimate LaunchDaemons point to unsigned code that could be exploited. For Launch Daemons with the RunAtLoad parameter set to true, ensure the Program parameter points to signed code or executables are in alignment with enterprise policy. Some parameters are interchangeable with others, such as Program and ProgramArguments parameters but one must be present. [18]

.005 Container Service

Monitor for suspicious uses of the docker or podman command, such as attempts to mount the root filesystem of the host.

Enterprise T1555 Credentials from Password Stores

Monitor executed commands and arguments that may search for common password storage locations to obtain user credentials.

Analytic 1 - Commands indicating credential searches.

(index=os sourcetype IN ("Powershell", "linux_secure", "macos_secure") CommandLine IN ("findstr /si password", "findstr /si pass", "grep -r password", "grep -r pass", "grep -r secret", "security find-generic-password", "security find-internet-password", "security dump-keychain", "gsettings get org.gnome.crypto.cache", "cat /etc/shadow", "strings /etc/shadow", "ls -al ~/.ssh/known_hosts", "ssh-add -L"))

.001 Keychain

Monitor executed commands with arguments that may be used to collect Keychain data from a system to acquire credentials.

Analytic 1 - Commands indicating credential searches in Keychain.

index=security sourcetype="macos_secure"(event_type="process" AND (command IN ("security dump-keychain", "security find-generic-password", "security find-internet-password", "security unlock-keychain") OR command IN ("security dump-keychain", "security find-generic-password", "security find-internet-password", "security unlock-keychain")))

.002 Securityd Memory

Monitor executed commands and arguments that may obtain root access (allowing them to read securityd’s memory), then they can scan through memory to find the correct sequence of keys in relatively few tries to decrypt the user’s logon keychain.

Analytic 1 - Commands indicating attempts to read securityd’s memory.

index=security sourcetype IN ("linux_secure", "macos_secure") event_type="process"(CommandLine IN ("gcore", "dbxutil", "vmmap", "gdb", "lldb", "memdump", "strings", "cat /proc//maps", "grep /proc//maps") OR CommandLine IN ("security find-generic-password", "security find-internet-password", "security dump-keychain"))

.003 Credentials from Web Browsers

Monitor executed commands and arguments that may acquire credentials from web browsers by reading files specific to the target browser.[19]

Analytic 1 - Commands indicating credential searches in web browsers.

index=security sourcetype IN ("WinEventLog:Microsoft-Windows-Sysmon/Operational", "linux_secure", "macos_secure") event_type="process"(CommandLine IN ("sqlite3 logins", "CryptUnprotectData", "security find-internet-password", "sqlcipher logins", "strings Login Data", "cat Login Data", "cat logins.json", "sqlite3 signons.sqlite"))

.004 Windows Credential Manager

Monitor executed commands and arguments for suspicious activity listing credentials from the Windows Credentials locker (e.g. vaultcmd /listcreds:"Windows Credentials").[20]

Analytic 1 - Commands indicating credential searches in Windows Credential Manager.

index=security sourcetype="Powershell" EventCode=4104(CommandLine IN ("vaultcmd.exe", "rundll32.exe keymgr.dll KRShowKeyMgr"))

.005 Password Managers

Monitor executed commands and arguments that may acquire user credentials from third-party password managers. [21]

Analytic 1 - Commands indicating credential searches in password managers.

index=security sourcetype IN ("linux_secure", "macos_secure")(CommandLine IN ("keepass", "lastpass", "1password", "bitwarden", "dashlane", "passwordsafe", "login", "vault"))

Enterprise T1485 Data Destruction

Monitor executed commands and arguments for binaries that could be involved in data destruction activity, such as SDelete.

Mobile T1662 Data Destruction

Command-line activities can potentially be detected through Mobile Threat Defense (MTD) integrations with lower-level OS APIs. This could grant the MTD agents access to running processes and their parameters, potentially detecting file deletion processes.

ICS T0809 Data Destruction

Monitor executed commands and arguments for binaries that could be involved in data destruction activity, such as SDelete.

Enterprise T1486 Data Encrypted for Impact

Monitor executed commands and arguments for actions involved in data destruction activity, such as vssadmin, wbadmin, and bcdedit

Enterprise T1005 Data from Local System

Monitor executed commands and arguments that may search and collect local system sources, such as file systems or local databases, to find files of interest and sensitive data prior to Exfiltration. Remote access tools with built-in features may interact directly with the Windows API to gather data. Data may also be acquired through Windows system management tools such as Windows Management Instrumentation and PowerShell.

For network devices, monitor executed commands in AAA logs, especially those run by unexpected or unauthorized users.

ICS T0893 Data from Local System

Monitor executed commands and arguments that may search and collect local system sources, such as file systems or local databases, to find files of interest and sensitive data. Remote access tools with built-in features may interact directly with the Windows API to gather data. Data may also be acquired through Windows system management tools such as Windows Management Instrumentation and PowerShell.

Enterprise T1039 Data from Network Shared Drive

Monitor executed commands and arguments for actions that could be taken to collect files from a network share. Remote access tools with built-in features may interact directly with the Windows API to gather and copy to a location. Data may also be acquired and staged through Windows system management tools such as Windows Management Instrumentation and PowerShell.

Enterprise T1025 Data from Removable Media

Monitor executed commands and arguments for actions that could be taken to collect files from a system's connected removable media. For example, data may be acquired through Windows system management tools such as Windows Management Instrumentation and PowerShell.

Enterprise T1074 Data Staged

Monitor executed commands and arguments arguments for actions that could be taken to collect and combine files. Remote access tools with built-in features may interact directly with the Windows API to gather and copy to a location. Data may also be acquired and staged through Windows system management tools such as Windows Management Instrumentation and PowerShell.

.001 Local Data Staging

Monitor executed commands and arguments arguments for actions that could be taken to collect and combine files. Remote access tools with built-in features may interact directly with the Windows API to gather and copy to a location. Data may also be acquired and staged through Windows system management tools such as Windows Management Instrumentation and PowerShell.

.002 Remote Data Staging

Monitor executed commands and arguments arguments for actions that could be taken to collect and combine files. Remote access tools with built-in features may interact directly with the Windows API to gather and copy to a location. Data may also be acquired and staged through Windows system management tools such as Windows Management Instrumentation and PowerShell.

Enterprise T1622 Debugger Evasion

Monitor executed commands and arguments that may employ various means to detect and avoid debugged environments. Detecting actions related to debugger identification may be difficult depending on the adversary's implementation and monitoring required.

Enterprise T1652 Device Driver Discovery

Monitor executed commands (lsmod, driverquery, etc.) with arguments highlighting potentially malicious attempts to enumerate device drivers.

Enterprise T1006 Direct Volume Access

Monitor executed commands and arguments that could be taken to copy files from the logical drive and evade common file system protections. Since this technique may also be used through PowerShell, additional logging of PowerShell scripts is recommended.

Enterprise T1561 Disk Wipe

Monitor for direct access read/write attempts using the \\.\ notation.[22] Monitor for unusual kernel driver installation activity.

.001 Disk Content Wipe

Monitor executed commands and arguments that may erase the contents of storage devices on specific systems or in large numbers in a network to interrupt availability to system and network resources.

.002 Disk Structure Wipe

Monitor executed commands and arguments that may corrupt or wipe the disk data structures on a hard drive necessary to boot a system; targeting specific critical systems or in large numbers in a network to interrupt availability to system and network resources.

Enterprise T1484 Domain or Tenant Policy Modification

Monitor executed commands and arguments for modifications to domain trust settings, such as when a user or application modifies the federation settings on the domain or updates domain authentication from Managed to Federated via ActionTypes Set federation settings on domain and Set domain authentication.[23][24]

.001 Group Policy Modification

Monitor executed commands and arguments that may modify Group Policy Objects (GPOs) to subvert the intended discretionary access controls for a domain, usually with the intention of escalating privileges on the domain.

.002 Trust Modification

Monitor executed commands and arguments that updates domain authentication from Managed to Federated via ActionTypes Set federation settings on domain and Set domain authentication.[23] Monitor for PowerShell commands such as: Update-MSOLFederatedDomain –DomainName: "Federated Domain Name", or Update-MSOLFederatedDomain –DomainName: "Federated Domain Name" –supportmultipledomain.[25]

Enterprise T1482 Domain Trust Discovery

Monitor executed commands and arguments for actions that could be taken to gather system and network information, such as nltest /domain_trusts. Remote access tools with built-in features may interact directly with the Windows API to gather information.

Enterprise T1114 Email Collection

Monitor executed processes and command-line arguments for actions that could be taken to gather local email files. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as Windows Management Instrumentation and PowerShell.

On Windows systems, monitor for creation of suspicious inbox rules through the use of the New-InboxRule, Set-InboxRule, New-TransportRule, and Set-TransportRule PowerShell cmdlets.[26][27]

.001 Local Email Collection

Monitor executed commands and arguments for actions that could be taken to gather local email files. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as Windows Management Instrumentation and PowerShell.

.002 Remote Email Collection

Monitor executed commands and arguments for actions that may target an Exchange server, Office 365, or Google Workspace to collect sensitive information.

.003 Email Forwarding Rule

On Windows systems, monitor for creation of suspicious inbox rules through the use of the New-InboxRule, Set-InboxRule, New-TransportRule, and Set-TransportRule PowerShell cmdlets.[26][27]

Enterprise T1546 Event Triggered Execution

Monitor executed commands and arguments that may establish persistence and/or elevate privileges using system mechanisms that trigger execution based on specific events.

.001 Change Default File Association

Monitor executed commands and arguments that may establish persistence by executing malicious content triggered by a file type association.

.002 Screensaver

Monitor executed commands and arguments of .scr files.

.003 Windows Management Instrumentation Event Subscription

Monitor executed commands and arguments that can be used to register WMI persistence, such as the Register-WmiEvent PowerShell cmdlet [28]

.004 Unix Shell Configuration Modification

Monitor executed commands and arguments that may establish persistence through executing malicious commands triggered by a user’s shell.

.005 Trap

Monitor executed commands and arguments that may establish persistence by executing malicious content triggered by an interrupt signal.

.006 LC_LOAD_DYLIB Addition

Monitor executed commands and arguments that may establish persistence by executing malicious content triggered by the execution of tainted binaries.

.007 Netsh Helper DLL

Monitor executed commands and arguments that may establish persistence by executing malicious content triggered by Netsh Helper DLLs.

.008 Accessibility Features

Monitor executed commands and arguments that may establish persistence and/or elevate privileges by executing malicious content triggered by accessibility features. Command line invocation of tools capable of modifying the Registry for associated keys are also suspicious. Utility arguments and the binaries themselves should be monitored for changes.

Note: Event ID 4104 (from the Microsoft-Windows-Powershell/Operational log) captures Powershell script blocks, which can be analyzed and used to detect on abuse of Accessibility Features.

.009 AppCert DLLs

Monitor executed commands and arguments that may establish persistence and/or elevate privileges by executing malicious content triggered by AppCert DLLs loaded into processes.

.010 AppInit DLLs

Monitor executed commands and arguments that may establish persistence and/or elevate privileges by executing malicious content triggered by AppInit DLLs loaded into processes.

.011 Application Shimming

Monitor executed commands and arguments for sdbinst.exe for potential indications of application shim abuse.

.012 Image File Execution Options Injection

Monitor executed commands and arguments that may establish persistence and/or elevate privileges by executing malicious content triggered by Image File Execution Options (IFEO) debuggers.

.013 PowerShell Profile

Monitor abnormal PowerShell commands, unusual loading of PowerShell drives or modules.

.014 Emond

Monitor executed commands and arguments that may gain persistence and elevate privileges by executing malicious content triggered by the Event Monitor Daemon (emond).

.015 Component Object Model Hijacking

Monitor executed commands and arguments that may establish persistence by executing malicious content triggered by hijacked references to Component Object Model (COM) objects.

Note: Event ID 4104 (from the Microsoft-Windows-Powershell/Operational log) captures Powershell script blocks, which can be analyzed and used to detect on changes to COM registry keys, including HKCU\Software\Classes\CLSID*.

.016 Installer Packages

Monitor executed commands and arguments that may be related to abuse of installer packages, including malicious commands triggered by application installations.

Enterprise T1480 Execution Guardrails

Monitor executed commands and arguments that may gather information about the victim's business relationships that can be used during targeting. Detecting the use of guardrails may be difficult depending on the implementation.

.001 Environmental Keying

Monitor executed commands and arguments that may gather the victim's physical location(s) that can be used during targeting. Detecting the use of environmental keying may be difficult depending on the implementation.

Enterprise T1048 Exfiltration Over Alternative Protocol

Monitor executed commands and arguments that may steal data by exfiltrating it over a different protocol than that of the existing command and control channel.

.001 Exfiltration Over Symmetric Encrypted Non-C2 Protocol

Monitor executed commands and arguments that may steal data by exfiltrating it over a symmetrically encrypted network protocol other than that of the existing command and control channel.

.002 Exfiltration Over Asymmetric Encrypted Non-C2 Protocol

Monitor executed commands and arguments that may steal data by exfiltrating it over a symmetrically encrypted network protocol other than that of the existing command and control channel.

.003 Exfiltration Over Unencrypted Non-C2 Protocol

Monitor executed commands and arguments that may steal data by exfiltrating it over a symmetrically encrypted network protocol other than that of the existing command and control channel.

Enterprise T1041 Exfiltration Over C2 Channel

Monitor executed commands and arguments that may steal data by exfiltrating it over an existing command and control channel.

Enterprise T1011 Exfiltration Over Other Network Medium

Monitor executed commands and arguments that may attempt to exfiltrate data over a different network medium than the command and control channel

.001 Exfiltration Over Bluetooth

Monitor executed commands and arguments that may attempt to exfiltrate data over Bluetooth rather than the command and control channel.

Enterprise T1052 Exfiltration Over Physical Medium

Monitor executed commands and arguments that may attempt to exfiltrate data via a physical medium, such as a removable drive.

.001 Exfiltration over USB

Monitor executed commands and arguments that may attempt to exfiltrate data over a USB connected physical device.

Enterprise T1567 Exfiltration Over Web Service

Monitor executed commands and arguments that may use an existing, legitimate external Web service to exfiltrate data rather than their primary command and control channel.

.001 Exfiltration to Code Repository

Monitor executed command and arguments that may exfiltrate data to a code repository rather than over their primary command and control channel.

.002 Exfiltration to Cloud Storage

Monitor executed commands and arguments that may exfiltrate data to a cloud storage service rather than over their primary command and control channel.

.004 Exfiltration Over Webhook

Monitor executed commands and arguments that may exfiltrate data to a webhook as a malicious command and control channel. Additionally, monitor commands that may create new webhook configurations in SaaS services - for example, gh webhook forward in Github or mgc subscriptions create in Office 365.[29][30]

Enterprise T1083 File and Directory Discovery

Monitor executed commands and arguments that may enumerate files and directories or may search in specific locations of a host or network share for certain information within a file system. For network devices, monitor executed commands in AAA logs, especially those run by unexpected or unauthorized users.

Enterprise T1222 File and Directory Permissions Modification

Many of the commands used to modify ACLs and file/directory ownership are built-in system utilities and may generate a high false positive alert rate, so compare against baseline knowledge for how systems are typically used and correlate modification events with other indications of malicious activity where possible.

.001 Windows File and Directory Permissions Modification

Monitor for executed commands and arguments for PowerShell cmdlets that can be used to retrieve or modify file and directory DACLs.

.002 Linux and Mac File and Directory Permissions Modification

Many of the commands used to modify ACLs and file/directory ownership are built-in system utilities and may generate a high false positive alert rate, so compare against baseline knowledge for how systems are typically used and correlate modification events with other indications of malicious activity where possible. Commonly abused command arguments include chmod +x, chmod -R 755, and chmod 777.[31]

ICS T0823 Graphical User Interface

Monitor executed commands and arguments related to services specifically designed to accept remote graphical connections, such as RDP and VNC. Remote Services and Valid Accounts may be used to access a host’s GUI.

Enterprise T1615 Group Policy Discovery

Monitor for suspicious use of gpresult. Monitor for the use of PowerShell functions such as Get-DomainGPO and Get-DomainGPOLocalGroup and processes spawning with command-line arguments containing GPOLocalGroup.

Enterprise T1564 Hide Artifacts

Monitor executed commands and arguments that may attempt to hide artifacts associated with their behaviors to evade detection.

.001 Hidden Files and Directories

Monitor the file system and shell commands for files being created with a leading "." and the Windows command-line use of attrib.exe to add the hidden attribute.

.002 Hidden Users

Monitor executed commands and arguments that could be taken to add a new user and subsequently hide it from login screens.

.003 Hidden Window

Monitor executed commands and arguments that may use hidden windows to conceal malicious activity from the plain sight of users. In Windows, enable and configure event logging and PowerShell logging to check for the hidden window style.

.004 NTFS File Attributes

The Streams tool of Sysinternals can be used to uncover files with ADSs. The dir /r command can also be used to display ADSs. [32] Many PowerShell commands (such as Get-Item, Set-Item, Remove-Item, and Get-ChildItem) can also accept a -stream parameter to interact with ADSs. [33] [34]

.006 Run Virtual Instance

Consider monitoring for commands and arguments that may be atypical for benign use of virtualization software. Usage of virtualization binaries or command-line arguments associated with running a silent installation may be especially suspect (ex. -silent, -ignore-reboot), as well as those associated with running a headless (in the background with no UI) virtual instance (ex. VBoxManage startvm $VM --type headless).[35] Similarly, monitoring command line arguments which suppress notifications may highlight potentially malicious activity (ex. VBoxManage.exe setextradata global GUI/SuppressMessages "all"). Monitor for commands which enable hypervisors such as Hyper-V.

.008 Email Hiding Rules

On Windows and Exchange systems, monitor for creation or modification of suspicious inbox rules through the use of the New-InboxRule, Set-InboxRule, New-TransportRule, and Set-TransportRule PowerShell cmdlets.[26][27][36]

.009 Resource Forking

Monitor executed commands and arguments that are leveraging the use of resource forks, especially those immediately followed by potentially malicious activity such as creating network connections.

.011 Ignore Process Interrupts

Monitor executed commands and arguments, such as nohup, that may attempt to hide processes from interrupt signals.

Enterprise T1574 Hijack Execution Flow

Monitor executed commands and arguments that may execute their own malicious payloads by hijacking the way operating systems run programs.

.006 Dynamic Linker Hijacking

Monitor executed commands and arguments associated with modifications to variables and files associated with loading shared libraries such as LD_PRELOAD on Linux and DYLD_INSERT_LIBRARIES on macOS.

.011 Services Registry Permissions Weakness

Monitor for the execution of commands and arguments that can be used for adversaries to modify services' registry keys and values through applications such as Windows Management Instrumentation and PowerShell. Additional logging may need to be configured to gather the appropriate data.

.012 COR_PROFILER

Extra scrutiny should be placed on suspicious modification of Registry keys such as COR_ENABLE_PROFILING, COR_PROFILER, and COR_PROFILER_PATH by command line tools like wmic.exe, setx.exe, and Reg. Monitoring for command-line arguments indicating a change to COR_PROFILER variables may aid in detection.

Enterprise T1562 Impair Defenses

Monitor executed commands and arguments that may maliciously modify components of a victim environment in order to hinder or disable defensive mechanisms.

.001 Disable or Modify Tools

Monitor for the execution of commands and arguments associated with disabling or modification of security software processes or services such as Set-MpPreference-DisableScriptScanning 1 in Windows,sudo spctl --master-disable in macOS, and setenforce 0 in Linux. Furthermore, on Windows monitor for the execution of taskkill.exe or Net Stop commands which may deactivate antivirus software and other security systems.

.002 Disable Windows Event Logging

Monitor executed commands and arguments for commands that can be used to disable logging. For example, Wevtutil, auditpol, sc stop EventLog, reg add, Set- or Stop-Service, Set- or New-ItemProperty, sc config, and offensive tooling (such as Mimikatz and Invoke-Phant0m) may be used to clear logs and/or change the EventLog/audit policy.[37][38][39]

.003 Impair Command History Logging

Correlating a user session with a distinct lack of new commands in their .bash_history can be a clue to suspicious behavior. Monitor for modification of PowerShell command history settings through processes being created with -HistorySaveStyle SaveNothing command-line arguments and use of the PowerShell commands Set-PSReadlineOption -HistorySaveStyle SaveNothing and Set-PSReadLineOption -HistorySavePath {File Path}. For network devices, monitor for missing or inconsistencies in Network Device CLI logging present in AAA logs as well as in specific RADIUS and TACAS+ logs.

.004 Disable or Modify System Firewall

Monitor executed commands and arguments associated with disabling or the modification of system firewalls such as netsh advfirewall firewall set rule group="file and printer sharing" new enable=Yes,ufw disable, and ufw logging off.

.006 Indicator Blocking

Monitor executed commands and arguments that may attempt to block indicators or events typically captured by sensors from being gathered and analyzed. Adversaries may attempt to evade system defenses by unloading minifilter drivers used by host-based sensors such as Sysmon through the use of the fltmc command-line utility. Accordingly, this analytic looks for command-line invocations of this utility when used to unload minifilter drivers.

.009 Safe Mode Boot

Monitor executed commands and arguments associated with making configuration changes to boot settings, such as bcdedit.exe and bootcfg.exe.[40][41][42]

.010 Downgrade Attack

Monitor for commands or other activity that may be indicative of attempts to abuse older or deprecated technologies (ex: powershell –v 2).

.012 Disable or Modify Linux Audit System

Command-line invocation of the auditctl utility may be unusual, depending on how systems are typically used in a particular environment. At runtime, look for commands to modify or create rules using the auditctl utility.

Enterprise T1070 Indicator Removal

Monitor executed commands and arguments that may delete or alter generated artifacts on a host system, including logs or captured files such as quarantined malware.

.001 Clear Windows Event Logs

Monitor executed commands and arguments for actions that would delete Windows event logs (via PowerShell) such as Remove-EventLog -LogName Security.

Note: Event ID 4104 (from the Microsoft-Windows-Powershell/Operational log) captures Powershell script blocks, which can be analyzed and used to detect on attempts to Clear Windows Event Logs. In particular, Powershell has a built-in Clear-EventLog cmdlet that allows for a specified log to be cleared.

.002 Clear Linux or Mac System Logs

Monitor executed commands and arguments for actions that could be taken to remove or overwrite system logs.

.003 Clear Command History

Monitor executed commands and arguments for actions that could be taken to clear command history, such as Clear-History on Windows or clear logging / clear history via a Network Device CLI in AAA logs, or to disable writing command history, such as history -c in bash/zsh .

Analytic 1 - Powershell Commands

(source="WinEventLog:Microsoft-Windows-Powershell/Operational" EventCode="4103") (CommandLine="Clear-History" OR (CommandLine="Remove-Item" AND CommandLine="ConsoleHost_history.text*"))

.004 File Deletion

Monitor executed commands and arguments for actions that could be utilized to unlink, rename, or delete files.

.005 Network Share Connection Removal

Monitor executed commands and arguments of net use commands associated with establishing and removing remote shares over SMB, including following best practices for detection of Windows Admin Shares.

.006 Timestomp

Monitor executed commands and arguments for actions that could be taken to alter generated artifacts on a host system (e.g., Timestomp.exe and SetMace.exe).

.007 Clear Network Connection History and Configurations

Monitor executed commands and arguments that may delete or alter malicious network configuration settings as well as generated artifacts on a host system, including logs and files such as Default.rdp or /var/log/.

.008 Clear Mailbox Data

Monitor executed commands and arguments that may delete or alter generated artifacts on a host system, including logs or captured files such as quarantined emails. In Exchange environments, monitor for PowerShell cmdlets that may create or alter transport rules, such as New-TransportRule and Set-TransportRule.[27]

.009 Clear Persistence

Monitor executed commands and arguments that may delete or alter generated artifacts associated with persistence on a host system.

ICS T0872 Indicator Removal on Host

Monitor executed commands and arguments that may delete or alter generated artifacts on a host system, including logs or captured files such as quarantined malware.

Enterprise T1202 Indirect Command Execution

Monitor executed commands and arguments to bypass security restrictions that limit the use of command-line interpreters.

Enterprise T1105 Ingress Tool Transfer

Monitor executed commands and arguments for suspicious activity associated with downloading external content.

Enterprise T1490 Inhibit System Recovery

Use process monitoring to monitor the execution and command line parameters of binaries involved in inhibiting system recovery, such as vssadmin, wbadmin, and bcdedit.

Enterprise T1056 .002 Input Capture: GUI Input Capture

Monitor executed commands and arguments, such as requests for credentials and/or strings related to creating password prompts that may be malicious.[43]

Enterprise T1570 Lateral Tool Transfer

Monitor executed commands and arguments for actions for abnormal usage of utilities and command-line arguments that may be used in support of remote transfer of files

ICS T0867 Lateral Tool Transfer

Monitor executed commands and arguments for abnormal usage of utilities and command-line arguments that may be used in support of remote transfer of files.

Enterprise T1654 Log Enumeration

Monitor for the use of commands and arguments of utilities and other tools used to access and export logs.

Enterprise T1036 Masquerading

Monitor executed commands and arguments that may attempt to manipulate features of their artifacts to make them appear legitimate or benign to users and/or security tools. [44]

Note: For Windows, Event ID 4104 (from the Microsoft-Windows-Powershell/Operational log) captures Powershell script blocks, which can be analyzed and used to detect on potential Masquerading.

.003 Rename System Utilities

Monitor executed commands and arguments that may rename legitimate system utilities to try to evade security mechanisms concerning the usage of those utilities.

.004 Masquerade Task or Service

Monitor executed commands and arguments that may attempt to manipulate the name of a task or service to make it appear legitimate or benign.

.008 Masquerade File Type

Monitor for abnormal command execution from otherwise non-executable file types (such as .txt and .jpg).

ICS T0849 Masquerading

Monitor executed commands and arguments that may attempt to manipulate features of their artifacts to make them appear legitimate or benign to users and/or security tools.[44]

Enterprise T1556 .005 Modify Authentication Process: Reversible Encryption

Monitor command-line usage for -AllowReversiblePasswordEncryption $true or other actions that could be related to malicious tampering of user settings (i.e. Group Policy Modification).

Analytic 1 - Command-line actions indicating changes to encryption settings.

index=security (sourcetype="WinEventLog:Security" OR sourcetype="powershell")(EventCode=4688 OR EventCode=4104) commandline="set-aduser" commandline="allowreversiblepasswordencryption" | table _time, Process_ID, User, CommandLine

Enterprise T1112 Modify Registry

Monitor executed commands and arguments for actions that could be taken to change, conceal, and/or delete information in the Registry. The Registry may also be modified through Windows system management tools such as Windows Management Instrumentation and PowerShell, which may require additional logging features to be configured in the operating system to collect necessary information for analysis.

ICS T0840 Network Connection Enumeration

Monitor executed commands and arguments that may look for details about the network configuration and settings, such as IP and/or MAC addresses, of systems they access or through information discovery of remote systems. Also monitor executed commands and arguments that may attempt to get a listing of network connections to or from the compromised system they are currently accessing or from remote systems by querying for information over the network. Information may also be acquired through Windows system management tools such as Windows Management Instrumentation and PowerShell.

Enterprise T1046 Network Service Discovery

Monitor executed commands and arguments that may attempt to get a listing of services running on remote hosts, including those that may be vulnerable to remote software exploitation.

Enterprise T1135 Network Share Discovery

Monitor executed commands and arguments that may look for folders and drives shared on remote systems as a means of identifying sources of information to gather as a precursor for Collection and to identify potential systems of interest for Lateral Movement.

Enterprise T1040 Network Sniffing

Monitor executed commands and arguments for actions that aid in sniffing network traffic to capture information about an environment, including authentication material passed over the network.

Analytic 1 - Unexpected command execution of network sniffing tools.

index=security (sourcetype="Powershell" EventCode=4104) | eval CommandLine=coalesce(Command_Line, CommandLine)| where ExecutingProcess IN ("tshark.exe", "windump.exe", "tcpdump.exe", "wprui.exe", "*wpr.exe")

ICS T0842 Network Sniffing

Monitor executed commands and arguments for actions that aid in sniffing network traffic to capture information about an environment.

Enterprise T1027 Obfuscated Files or Information

Monitor executed commands and arguments for indicators of obfuscation and potentially suspicious syntax such as uninterpreted escape characters (e.g., ^).

Also monitor command-lines for syntax-specific signs of obfuscation, such as variations of arguments associated with encoding.

.004 Compile After Delivery

Monitor executed commands and arguments for actions that could be taken to gather common compilers, such as csc.exe and GCC/MinGW, and correlate with other suspicious behavior to reduce false positives from normal user and administrator behavior.

.010 Command Obfuscation

Monitor executed commands and arguments for indicators of obfuscation and potentially suspicious syntax such as uninterpreted escape characters (e.g., ^).

Also monitor command-lines for syntax-specific signs of obfuscation, such as variations of arguments associated with encoding.

Enterprise T1137 Office Application Startup

Monitor executed commands and arguments that may leverage Microsoft Office-based applications for persistence between startups. Microsoft has released a PowerShell script to safely gather mail forwarding rules and custom forms in your mail environment as well as steps to interpret the output.[45] SensePost, whose tool Ruler can be used to carry out malicious rules, forms, and Home Page attacks, has released a tool to detect Ruler usage.[46]

.001 Office Template Macros

Monitor executed commands and arguments that may abuse Microsoft Office templates to obtain persistence on a compromised system.

.002 Office Test

Monitor executed commands and arguments that may abuse the Microsoft Office "Office Test" Registry key to obtain persistence on a compromised system.

.003 Outlook Forms

Monitor executed commands and arguments that may abuse Microsoft Outlook forms to obtain persistence on a compromised system. Microsoft has released a PowerShell script to safely gather mail forwarding rules and custom forms in your mail environment as well as steps to interpret the output.[45]

.004 Outlook Home Page

Monitor executed commands and arguments that may abuse Microsoft Outlook's Home Page feature to obtain persistence on a compromised system. Microsoft has released a PowerShell script to safely gather mail forwarding rules and custom forms in your mail environment as well as steps to interpret the output.[45]

.005 Outlook Rules

Monitor executed commands and arguments that may abuse Microsoft Outlook rules to obtain persistence on a compromised system. Microsoft has released a PowerShell script to safely gather mail forwarding rules and custom forms in your mail environment as well as steps to interpret the output.[45] This PowerShell script is ineffective in gathering rules with modified PR_RULE_MSG_NAME and PR_RULE_MSG_PROVIDER properties caused by adversaries using a Microsoft Exchange Server Messaging API Editor (MAPI Editor), so only examination with the Exchange Administration tool MFCMapi can reveal these mail forwarding rules.[47]

.006 Add-ins

Monitor executed commands and arguments that may abuse Microsoft Office add-ins to obtain persistence on a compromised system.

Enterprise T1003 OS Credential Dumping

Monitor executed commands and arguments that may attempt to dump credentials using tools like Mimikatz, ProcDump, NTDSUtil, or accessing /proc, /etc/passwd, and /etc/shadow.

Analytic 1 - Suspicious command execution involving credential dumping tools.(index=security sourcetype="WinEventLog:Security" EventCode=4688 Image IN ("mimikatz.exe", "procdump.exe", "ntdsutil.exe", "powershell.exe") CommandLine IN ("Invoke-Mimikatz", "Invoke-CachedCredentials", "Invoke-LSADump", "Invoke-SAMDump"))OR(index=security sourcetype="linux_secure" Command IN ("cat /etc/passwd", "cat /etc/shadow", "grep -E '^[0-9a-f-] r' /proc//maps"))OR(index=security sourcetype="macOS:UnifiedLog" process IN ("cat", "grep") message IN ("/etc/passwd", "/etc/shadow", "/var/db/shadow/hash/*", "/private/etc/master.passwd"))

.001 LSASS Memory

Monitor executed commands and arguments that may attempt to access credential material stored in the process memory of the Local Security Authority Subsystem Service (LSASS). Remote access tools may contain built-in features or incorporate existing tools like Mimikatz. PowerShell scripts also exist that contain credential dumping functionality, such as PowerSploit's Invoke-Mimikatz module,[48] which may require additional logging features to be configured in the operating system to collect necessary information for analysis.

Note: Event ID 4104 from the "Microsoft-Windows-PowerShell/Operational" log captures Powershell script blocks, whose contents can be further analyzed to determine if they’re performing LSASS dumping.

Analytic 1 - Unauthorized command execution of LSASS memory.

index=security sourcetype="Powershell" EventCode=4104Image="powershell.exe" CommandLine IN ("Invoke-Mimikatz", "procdump.exe -ma lsass", "rundll32.exe comsvcs.dll, MiniDump", "taskmgr.exe* /dump")

.002 Security Account Manager

Monitor executed commands and arguments that may attempt to extract credential material from the Security Account Manager (SAM) database either through in-memory techniques or through the Windows Registry where the SAM database is stored.

Analytic 1 - Unauthorized attempts to dump SAM database through command execution.

index=security sourcetype="Powershell" EventCode=4104 Image="powershell.exe" CommandLine IN ("Invoke-Mimikatz", "Invoke-SAMDump", "reg save hklm\sam", "reg.exe save hklm\sam*")

.003 NTDS

Monitor executed commands and arguments that may attempt to access or create a copy of the Active Directory domain database in order to steal credential information, as well as obtain other information about domain members such as devices, users, and access rights. Look for command-lines that invoke attempts to access or copy the NTDS.dit.

Note: Events 4688 (Microsoft Windows Security Auditing) and 1 (Microsoft Windows Sysmon) provide context of commands and parameters being executed via creation of a new process. Event 800 (PowerShell) provides context of commands and parameters being executed via PowerShell. This detection is based on known Windows utilities commands and parameters that can be used to copy the ntds.dit file. It is recommended to keep the list of commands and parameters up to date.

Analytic 1 - Command line attempt to access or create a copy of ntds.dit file

((sourcetype="WinEventLog:Microsoft-Windows-Powershell/Operational" EventCode="800") AND((CommandLine LIKE "%ntds%" AND CommandLine LIKE "%ntdsutil%" AND CommandLine LIKE "%create%") OR (CommandLine LIKE "%vssadmin%" AND CommandLine LIKE "%create%" AND CommandLine LIKE "%shadow%") OR (CommandLine LIKE "%copy%" AND CommandLine LIKE "%ntds.dit%")))

.004 LSA Secrets

Monitor executed commands and arguments that may access to a host may attempt to access Local Security Authority (LSA) secrets. Remote access tools may contain built-in features or incorporate existing tools like Mimikatz. PowerShell scripts also exist that contain credential dumping functionality, such as PowerSploit's Invoke-Mimikatz module,[48] which may require additional logging features to be configured in the operating system to collect necessary information for analysis.

Analytic 1 - Suspicious access to LSA secrets.

index=security (sourcetype="Powershell" EventCode=4104) Image="powershell.exe" CommandLine IN ("Invoke-Mimikatz", "Invoke-LSADump*")

.005 Cached Domain Credentials

Monitor executed commands and arguments that may attempt to access cached domain credentials used to allow authentication to occur in the event a domain controller is unavailable.[49]. Remote access tools may contain built-in features or incorporate existing tools like Mimikatz. PowerShell scripts also exist that contain credential dumping functionality, such as PowerSploit's Invoke-Mimikatz module,[48] which may require additional logging features to be configured in the operating system to collect necessary information for analysis.Detection of compromised Valid Accounts in-use by adversaries may help as well.

Analytic 1 - Unusual access to cached domain credentials.

(index=security sourcetype="Powershell" EventCode=4104 Image="powershell.exe" CommandLine IN ("Invoke-Mimikatz", "Invoke-CachedCredentials"))OR(index=security sourcetype="linux_secure" (cmd IN ("mimikatz", "cachedump*")))

.007 Proc Filesystem

Monitor executed commands and arguments that may gather credentials from information stored in the Proc filesystem or /proc. For instance, adversaries may use regex patterns to search for process memory that may be exfiltrated or searched for credentials.[50][51]

grep -E "^[0-9a-f-]* r" /proc/"$pid"/maps | grep -E 'heap|stack' | cut -d' ' -f 1

grep -E "^[0-9a-f-]* r" /proc/"$PID"/maps | grep heap | cut -d' ' -f 1

Analytic 1 - Unexpected access to /proc filesystem.

index=os sourcetype="linux_audit" command IN ("grep -E '^[0-9a-f-] r' /proc//maps", "cat /proc//maps", "awk '{print $1}' /proc//maps")

.008 /etc/passwd and /etc/shadow

Monitor executed commands and arguments that may attempt to dump the contents of /etc/passwd and /etc/shadow to enable offline password cracking.

Analytic 1 - Unexpected command execution involving /etc/passwd and /etc/shadow.

index=os sourcetype="linux_audit" command IN ("cat /etc/passwd", "cat /etc/shadow", "grep /etc/passwd", "grep /etc/shadow") | eval Command=command | eval TargetFile=case(match(Command, ".passwd."), "/etc/passwd", match(Command, ".shadow."), "/etc/shadow")

Enterprise T1201 Password Policy Discovery

Monitor executed commands and arguments for actions that may attempt to access detailed information about the password policy used within an enterprise network or cloud environment. For network devices, monitor executed commands in AAA logs, especially those run by unexpected or unauthorized users.

Enterprise T1120 Peripheral Device Discovery

Monitor executed commands and arguments that may attempt to gather information about attached peripheral devices and components connected to a computer system.

Enterprise T1069 Permission Groups Discovery

Monitor executed commands and arguments acquired through Windows system management tools such as Windows Management Instrumentation and PowerShell.

.001 Local Groups

Monitor for executed commands and arguments that may attempt to find local system groups and permission settings.

.002 Domain Groups

Monitor for executed commands and arguments that may attempt to find domain-level groups and permission settings.

.003 Cloud Groups

Monitor for executed commands and arguments that may attempt to find cloud groups and permission settings.

Enterprise T1647 Plist File Modification

Monitor for commands with arguments (such as opening common command-line editors) used to modify plist files, especially commonly abused files such as those in \~/LaunchAgents, \~/Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm, and an application's Info.plist.

Enterprise T1653 Power Settings

Monitor and inspect commands and arguments associated with manipulating the power settings of a system.

Enterprise T1542 Pre-OS Boot

Monitor executed commands and arguments in command history in either the console or as part of the running memory to determine if unauthorized or suspicious commands were used to modify device configuration.

.005 TFTP Boot

Monitor executed commands and arguments in command history in either the console or as part of the running memory to determine if unauthorized or suspicious commands were used to modify device configuration.

Enterprise T1057 Process Discovery

Monitor executed commands and arguments for actions that may attempt to get information about running processes on a system.

Enterprise T1012 Query Registry

Monitor executed commands and arguments for actions that may interact with the Windows Registry to gather information about the system, configuration, and installed software.

Note: For PowerShell Module logging event id 4103, enable logging for module Microsoft.PowerShell.Management. The New-PSDrive PowerShell cmdlet creates temporary and persistent drives that are mapped to or associated with a location in a data store, such a registry key (PSProvider "Registry"). The the Get-ChildItem gets the items in one or more specified locations. By using both, you can enumerate COM objects in one or more specified locations.

Analytic 1 - Suspicious Commands

(sourcetype="WinEventLog:Microsoft-Windows-Powershell/Operational" EventCode="4103") | WHERE CommandLine LIKE "%New-PSDrive%" AND (CommandLine LIKE "%Registry%" OR CommandLine LIKE "%HKEY_CLASSES_ROOT%" OR CommandLine LIKE "%HKCR%")

Enterprise T1563 Remote Service Session Hijacking

Monitor executed commands and arguments that may take control of preexisting sessions with remote services to move laterally in an environment.

.001 SSH Hijacking

Monitor executed commands and arguments that may hijack a legitimate user's SSH session to move laterally within an environment.

.002 RDP Hijacking

monitor service creation that uses cmd.exe /k or cmd.exe /c in its arguments to detect RDP session hijacking. Windows PowerShell log Event ID 4104 (PS script execution) can be used to capture PowerShell script block contents which may contain commands used as a precursor to RDP hijacking. For example, the following command in a PowerShell script block may be used to enumerate the systems on a network which have RDP access: Find-DomainLocalGroupMember -GroupName "Remote Desktop Users" | select -expand ComputerName.

Enterprise T1021 Remote Services

Monitor executed commands and arguments that may use Valid Accounts to log into a service specifically designed to accept remote connections, such as telnet, SSH, and VNC. The adversary may then perform actions as the logged-on user.

.002 SMB/Windows Admin Shares

Monitor executed commands and arguments that connect to remote shares, such as Net, on the command-line interface and Discovery techniques that could be used to find remotely accessible systems.[52]

Note: Event ID 4104 (from the Microsoft-Windows-Powershell/Operational log) captures Powershell script blocks, which can be analyzed and used to detect on potential connections and writing to remote shares.

.006 Windows Remote Management

Monitor executed commands and arguments that may invoke a WinRM script to correlate it with other related events.[53]

ICS T0886 Remote Services

Monitor executed commands and arguments to services specifically designed to accept remote connections, such as RDP, Telnet, SSH, and VNC. The adversary may then perform these actions using Valid Accounts.

Enterprise T1018 Remote System Discovery

Monitor executed commands and arguments that may attempt to get a listing of other systems by IP address, hostname, or other logical identifier on a network that may be used for Lateral Movement from the current system. For network devices, monitor executed commands in AAA logs, especially those run by unexpected or unauthorized users.

Windows PowerShell log Event ID 4104 (PS script execution) can be used to capture PowerShell script block contents which may contain commands used as a precursor to RDP Hijacking. For example, the following command in a PowerShell script block may be used to enumerate the systems on a network which have RDP access: Find-DomainLocalGroupMember -GroupName "Remote Desktop Users" | select -expand ComputerName.

Enterprise T1496 Resource Hijacking

Monitor executed commands and arguments that may indicate common cryptomining or proxyware functionality.

.001 Compute Hijacking

Monitor executed commands and arguments that may indicate common cryptomining functionality.

.002 Bandwidth Hijacking

Monitor executed commands and arguments that may indicate common proxyware functionality.

Enterprise T1053 Scheduled Task/Job

Monitor executed commands and arguments that may abuse task scheduling functionality to facilitate initial or recurring execution of malicious code.

Analytic 1 - Look for task scheduling commands being executed with unusual parameters.

index=security (sourcetype="WinEventLog:Security" OR sourcetype="linux_secure" OR sourcetype="macos_secure" OR sourcetype="container_logs")| eval CommandLine = coalesce(CommandLine, process)| where (sourcetype="WinEventLog:Security" AND EventCode IN (4697, 4702, 4698)) OR (sourcetype="linux_secure" AND CommandLine LIKE "%cron%" OR CommandLine LIKE "%at%") OR (sourcetype="macos_secure" AND CommandLine LIKE "%launchctl%" OR CommandLine LIKE "%cron%") OR (sourcetype="container_logs" AND (CommandLine LIKE "%cron%" OR CommandLine LIKE "%at%"))| where (sourcetype="WinEventLog:Security" AND (CommandLine LIKE "%/create%" OR CommandLine LIKE "%/delete%" OR CommandLine LIKE "%/change%")) OR (sourcetype="linux_secure" AND (CommandLine LIKE "%-f%" OR CommandLine LIKE "%-m%" OR CommandLine LIKE "%--env%")) OR (sourcetype="macos_secure" AND (CommandLine LIKE "%/Library/LaunchDaemons%" OR CommandLine LIKE "%/Library/LaunchAgents%" OR CommandLine LIKE "%/System/Library/LaunchDaemons%" OR CommandLine LIKE "%/System/Library/LaunchAgents%")) OR (sourcetype="container_logs" AND (CommandLine LIKE "%-f%" OR CommandLine LIKE "%--schedule%" OR CommandLine LIKE "%--env%"))

.002 At

Monitor executed commands and arguments for actions that could be taken to create/modify tasks. Tasks may also be created through Windows system management tools such as Windows Management Instrumentation and PowerShell, so additional logging may need to be configured to gather the appropriate data.

Analytic 1 - Linux Command Execution

index=linux_logs sourcetype=syslog "at" | rex "user=(?\w+)"

Analytic 2 - Windows Command Execution index=windows_logs sourcetype=WinEventLog:System EventCode=4698 TaskName="at*"| where NOT (user="SYSTEM" AND TaskName="\Microsoft\Windows\Defrag\ScheduledDefrag")

.003 Cron

Monitor execution of commands related to cron that are out of alignment with known software or administrative tasks. Monitor executed atq command and ensure IP addresses stored in the SSH_CONNECTION and SSH_CLIENT variables, machines that created the jobs, are trusted hosts. All at jobs are stored in /var/spool/cron/atjobs/.

Analytic 1 - Suspicious Cron execution

index=linux_logs sourcetype=cron_logs | search "cron" AND (command="crontab -e" OR command="crontab -l" OR command=" * * * " OR command="/cron.d/")

.005 Scheduled Task

Monitor for commands being executed via schtasks or other utilities related to task scheduling.

Analytic 1 - Look for schtasks.exe execution with arguments indicative of task creation/modification.

sourcetype=WinEventLog:Powershell (EventCode=4104 OR command="schtasks.exe")| stats count by user host process_name command_line| where Image="schtasks.exe" OR command_line="schtasks"

.006 Systemd Timers

Monitor executed commands and arguments the 'systemd-run' utility as it may be used to create timers.

Analytic 1 - Look for systemd-run execution with arguments indicative of timer creation.

sourcetype=linux_logs (command="systemctl" OR command="systemd-run")

Enterprise T1113 Screen Capture

Monitor executed commands and arguments that may attempt to take screen captures of the desktop to gather information over the course of an operation.

ICS T0852 Screen Capture

Monitor executed commands and arguments that may attempt to take screen captures of the desktop to gather information over the course of an operation.

ICS T0853 Scripting

Monitor command-line arguments for script execution and subsequent behavior. Actions may be related to network and system information Discovery, Collection, or other scriptable post-compromise behaviors and could be used as indicators of detection leading back to the source script. Scripts are likely to perform actions with various effects on a system that may generate events, depending on the types of monitoring used.

Enterprise T1505 .004 Server Software Component: IIS Components

Monitor execution and command-line arguments of AppCmd.exe, which may be abused to install malicious IIS modules.[54][55][56]

.005 Server Software Component: Terminal Services DLL

Monitor executed commands and arguments for potential adversary actions to modify Registry values (ex: reg.exe) or modify/replace the legitimate termsrv.dll.

Enterprise T1489 Service Stop

Monitor executed commands and arguments that may stop or disable services on a system to render those services unavailable to legitimate users.

ICS T0881 Service Stop

Monitor executed commands and arguments that may stop or disable services on a system to render those services unavailable to legitimate users.

Enterprise T1518 Software Discovery

Monitor executed commands and arguments that may attempt to get a listing of software and software versions that are installed on a system or in a cloud environment.

.001 Security Software Discovery

Monitor executed commands and arguments that may attempt to get a listing of security software, configurations, defensive tools, and sensors that are installed on a system or in a cloud environment.

Note: For Windows, Event ID 4104 (from the Microsoft-Windows-Powershell/Operational log) captures Powershell script blocks, which can be analyzed and used to detect on potential Security Software Discovery.

Enterprise T1649 Steal or Forge Authentication Certificates

Monitor for the execution of commands and other utilities abused to forge and/or steal certificates and related private keys.[57]

Enterprise T1558 Steal or Forge Kerberos Tickets

Monitor executed commands and arguments that may attempt to subvert Kerberos authentication by stealing or forging Kerberos tickets to enable Pass the Ticket.

Enterprise T1553 Subvert Trust Controls

Command monitoring may reveal malicious attempts to modify trust settings, such as the installation of root certificates or modifications to trust attributes/policies applied to files.

.001 Gatekeeper Bypass

Monitor and investigate attempts to modify extended file attributes with utilities such as xattr. Built-in system utilities may generate high false positive alerts, so compare against baseline knowledge for how systems are typically used and correlate modification events with other indications of malicious activity where possible.

.004 Install Root Certificate

Monitor for commands, such as security add-trusted-cert (macOS) or certutil -addstore (Windows), that can be used to install root certificates. A system's root certificates are unlikely to change frequently. Monitor new certificates installed on a system that could be due to malicious activity. [58] Check pre-installed certificates on new systems to ensure unnecessary or suspicious certificates are not present. Microsoft provides a list of trustworthy root certificates online and through authroot.stl. [58] The Sysinternals Sigcheck utility can also be used (sigcheck[64].exe -tuv) to dump the contents of the certificate store and list valid certificates not rooted to the Microsoft Certificate Trust List. [59]

.006 Code Signing Policy Modification

Monitor for the execution of commands that could modify the code signing policy of a system, such as bcdedit.exe -set TESTSIGNING ON[60]

Enterprise T1218 System Binary Proxy Execution

Monitor executed commands and arguments that may forge credential materials that can be used to gain access to web applications or Internet services.

.001 Compiled HTML File

Monitor executed commands and arguments that may forge SAML tokens with any permissions claims and lifetimes if they possess a valid SAML token-signing certificate.[61]

.002 Control Panel

When executed from the command line or clicked, control.exe will execute the CPL file (ex: control.exe file.cpl) before Rundll32 is used to call the CPL's API functions (ex: rundll32.exe shell32.dll,Control_RunDLL file.cpl). CPL files can be executed directly via the CPL API function with just the latter Rundll32 command, which may bypass detections and/or execution filters for control.exe.[62]

.003 CMSTP

Monitor executed commands and arguments that may gather information about the victim's hosts that can be used during targeting.

Note: Event ID 4104 (from the Microsoft-Windows-Powershell/Operational log) captures Powershell script blocks, which can be analyzed and used to detect on abuse of CMSTP.

.004 InstallUtil

Monitor executed commands and arguments used before and after the InstallUtil.exe invocation may also be useful in determining the origin and purpose of the binary being executed.

.005 Mshta

Look for mshta.exe executing raw or obfuscated script within the command-line. Compare recent invocations of mshta.exe with prior history of known good arguments and executed .hta files to determine anomalous and potentially adversarial activity. Command arguments used before and after the mshta.exe invocation may also be useful in determining the origin and purpose of the .hta file being executed.

.007 Msiexec

Command arguments used before and after the invocation of msiexec.exe may also be useful in determining the origin and purpose of the MSI files or DLLs being executed.

.008 Odbcconf

Command arguments used before and after the invocation of odbcconf.exe may also be useful in determining the origin and purpose of the DLL being loaded.

.009 Regsvcs/Regasm

Command arguments used before and after Regsvcs.exe or Regasm.exe invocation may also be useful in determining the origin and purpose of the binary being executed.

.010 Regsvr32

Command arguments used before and after the regsvr32.exe invocation may also be useful in determining the origin and purpose of the script or DLL being loaded. [63]

.011 Rundll32

Command arguments used with the rundll32.exe invocation may also be useful in determining the origin and purpose of the DLL being loaded. Typical command-line usage of rundll32.exe is "rundll32.exe DllFile,EntryPoint" where DllFile is the name of the DLL file being called and EntryPoint the name of the entry point in the DLL file.

DLLs stored on SMB shares can similarly be called using the syntax of "rundll32.exe \\DllFile,EntryPoint" where is the IPv4 address of the host of the SMB share.

Rundll32 can also be used to execute arbitrary Javascript using the syntax "rundll32.exe javascript:<code_block>"where <code_block> is a string defining the Javascript code to be executed.

.012 Verclsid

Command arguments used before and after the invocation of verclsid.exe may also be useful in determining the origin and purpose of the payload being executed.

.013 Mavinject

Adversaries may rename abusable binaries to evade detections, but the argument INJECTRUNNING is required for mavinject.exe to perform Dynamic-link Library Injection and may therefore be monitored to alert malicious activity.

.014 MMC

Monitor executed commands and arguments that may gather information about the victim's DNS that can be used during targeting.

.015 Electron Applications

Monitor executed commands and arguments that may abuse Electron apps to execute malicious content. For example, analyze commands invoking teams.exe or chrome.exe to execute malicious or abnormal content.

ICS T0894 System Binary Proxy Execution

Monitor executed commands and associated arguments for application programs which support executing custom code, scripts, commands, or executables.

Enterprise T1082 System Information Discovery

Monitor executed commands and arguments that may attempt to get detailed information about the operating system and hardware, including version, patches, hotfixes, service packs, and architecture. For network devices, monitor executed commands in AAA logs, especially those run by unexpected or unauthorized users.

Enterprise T1614 System Location Discovery

Monitor executed commands and arguments that may gather information in an attempt to calculate the geographical location of a victim host.

.001 System Language Discovery

Monitor executed commands and arguments that may attempt to gather information about the system language of a victim in order to infer the geographical location of that host.

Enterprise T1016 System Network Configuration Discovery

Monitor executed commands and arguments that may look for details about the network configuration and settings, such as IP and/or MAC addresses, of systems they access or through information discovery of remote systems. For network devices, monitor executed commands in AAA logs, especially those run by unexpected or unauthorized users.

.001 Internet Connection Discovery

Monitor executed commands and arguments that may check for Internet connectivity on compromised systems.

.002 Wi-Fi Discovery

Monitor executed commands and arguments that may collect Wi-Fi information on compromised systems.

Enterprise T1049 System Network Connections Discovery

Monitor executed commands and arguments that may attempt to get a listing of network connections to or from the compromised system they are currently accessing or from remote systems by querying for information over the network. Information may also be acquired through Windows system management tools such as Windows Management Instrumentation and PowerShell.

For network devices, monitor executed commands in AAA logs, especially those run by unexpected or unauthorized users.

Enterprise T1033 System Owner/User Discovery

Monitor executed commands and arguments that may attempt to dump credentials to obtain account login and credential material, normally in the form of a hash or a clear text password, from the operating system and software. Look for command-lines that invoke AuditD or the Security Accounts Manager (SAM). Remote access tools may contain built-in features or incorporate existing tools like Mimikatz. PowerShell scripts also exist that contain credential dumping functionality, such as PowerSploit's Invoke-Mimikatz module, [48] which may require additional logging features to be configured in the operating system to collect necessary information for analysis.

Note: Event ID 4104 (from the Microsoft-Windows-Powershell/Operational log) captures Powershell script blocks, which can be analyzed and used to detect on abuse of CMSTP.

Enterprise T1216 System Script Proxy Execution

Monitor executed commands and arguments for scripts like PubPrn.vbs that may be used to proxy execution of malicious files.

.001 PubPrn

Monitor executed commands and arguments for scripts like PubPrn.vbs that may be used to proxy execution of malicious files.

.002 SyncAppvPublishingServer

Monitor executed commands and arguments for scripts like Syncappvpublishingserver.vbs that may be used to proxy execution of malicious files.

Enterprise T1007 System Service Discovery

Monitor executed commands and arguments that could be taken to gather system information related to services. Remote access tools with built-in features may interact directly with the Windows API to gather information. Information may also be acquired through Windows system management tools such as Windows Management Instrumentation and PowerShell.

Enterprise T1569 System Services

Monitor command-line invocations for tools capable of creating or modifying system services (e.g., systemctl on Linux, sc.exe on Windows, launchctl on macOS).

Analytic 1 - Unusual service modification tools.

sourcetype=command_logs| search command IN ("systemctl", "sc", "launchctl")

.001 Launchctl

Monitor the execution of the launchctl command, focusing on subcommands such as load, unload, and start that may be used by adversaries to load Launch Agents or Launch Daemons.

Note: This analytic monitors the execution of the launchctl command and its key subcommands. Exclude known administrative users to minimize false positives.

Analytic 1 - Suspicious Launchctl

sourcetype=macOS:unified OR sourcetype=osquery OR sourcetype=auditd| search command IN ("launchctl load", "launchctl unload", "launchctl start")

.002 Service Execution

Monitor executed commands and arguments that may abuse the Windows service control manager to execute malicious commands or payloads.

Analytic 1- Commands abusing Windows service control manager.

sourcetype=WinEventLog:Security OR sourcetype=Powershell OR sourcetype=Sysmon EventCode IN (1,4688,4104) | search command_line IN ("sc.exe", "net start", "net stop", "psexec.exe")| where user!="SYSTEM" // Exclude common system-level activities

Enterprise T1529 System Shutdown/Reboot

Monitor executed commands and arguments of binaries involved in shutting down or rebooting systems. For network devices, monitor executed commands in AAA logs, especially those run by unexpected or unauthorized users.

Enterprise T1124 System Time Discovery

Monitor executed commands and arguments for actions that may gather the system time and/or time zone from a local or remote system.

Enterprise T1127 Trusted Developer Utilities Proxy Execution

Monitor executed commands and arguments used before and after invocation of the utilities may also be useful in determining the origin and purpose of the binary being executed.

.001 MSBuild

Monitor executed commands and arguments used before and after invocation of the utilities may also be useful in determining the origin and purpose of the binary being executed.

.002 ClickOnce

When executed from the command line, rundll32 is used to call the ClickOnce API functions (ex: rundll32.exe dfshim.dll,ShOpenVerbApplication file.appref-ms).

Enterprise T1552 Unsecured Credentials

While detecting adversaries accessing credentials may be difficult without knowing they exist in the environment, it may be possible to detect adversary use of credentials they have obtained. Monitor the command-line arguments of executing processes for suspicious words or regular expressions that may indicate searching for a password (for example: password, pwd, login, secure, or credentials). See Valid Accounts for more information.

Analytic 1 - Suspicious commands or regular expressions indicating credential search.

(index=security sourcetype="Powershell" EventCode=4104) OR(index=os sourcetype="linux_secure" action="execve") OR(index=os sourcetype="macos_secure" event_type="execve") | where match(CommandLine, "(?i)(password|credential|secret|key|token|login|passwd|passphrase)")

.001 Credentials In Files

Monitor executed commands and arguments of executing processes for suspicious words or regular expressions that may indicate searching for a password (for example: password, pwd, login, secure, or credentials).

Analytic 1 - Commands indicating credential searches in files.

(index=security sourcetype="Powershell" EventCode=4104 CommandLine="password" OR CommandLine="credential") OR(index=sysmon sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1 CommandLine="password" OR CommandLine="credential") OR(index=os sourcetype="linux_audit" action="execve" CommandLine="password" OR CommandLine="credential" OR CommandLine="passwd" OR CommandLine="secret") OR(index=os sourcetype="macos_secure" event_type="execve" CommandLine="password" OR CommandLine="credential" OR CommandLine="passwd" OR CommandLine="secret")

.002 Credentials in Registry

Monitor executed commands and arguments that may search the Registry on compromised systems for insecurely stored credentials.

Analytic 1 - Commands indicating credential searches in the registry.

(index=security sourcetype="powershell" EventCode=4104 ScriptBlockText="reg query /f password /t REG_SZ /s*")

.003 Bash History

While users do typically rely on their history of commands, they often access this history through other utilities like "history" instead of commands like cat ~/.bash_history.

Analytic 1 - Commands accessing .bash_historythrough unexpected means.

(index=os sourcetype="linux_secure" action="open" filepath="/home//.bash_history") OR(index=os sourcetype="macos_secure" event_type="open" file_path="/Users//.bash_history")

.004 Private Keys

Monitor executed commands and arguments that may search for private key certificate files on compromised systems for insecurely stored credentials.

Analytic 1 - Commands indicating searches for private keys.

(index=security sourcetype="WinEventLog:Security" EventCode=4688 CommandLine="private key" OR CommandLine="certificate" OR CommandLine IN (".key", ".pgp", ".gpg", ".ppk", ".p12", ".pem", ".pfx", ".cer", ".p7b", ".asc")) OR(index=sysmon sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1 CommandLine="private key" OR CommandLine="certificate" OR CommandLine IN (".key", ".pgp", ".gpg", ".ppk", ".p12", ".pem", ".pfx", ".cer", ".p7b", ".asc")) OR(index=os sourcetype="linux_secure" action="execve" CommandLine="private key" OR CommandLine="certificate" OR CommandLine IN (".key", ".pgp", ".gpg", ".ppk", ".p12", ".pem", ".pfx", ".cer", ".p7b", ".asc")) OR(index=os sourcetype="macos_secure" event_type="execve" CommandLine="private key" OR CommandLine="certificate" OR CommandLine IN (".key", ".pgp", ".gpg", ".ppk", ".p12", ".pem", ".pfx", ".cer", ".p7b", ".asc"))

.006 Group Policy Preferences

Monitor executed commands and arguments that may search for SYSVOL data and/or GPP XML files, especially on compromised domain controllers.

Analytic 1 - Commands indicating searches for GPP XML files.

(index=security sourcetype="Powershell" EventCode=4104 CommandLine="dir /s .xml*")

.007 Container API

Establish centralized logging for the activity of container and Kubernetes cluster components. Monitor logs for actions that could be taken to gather credentials to container and cloud infrastructure, including the use of discovery API calls by new or unexpected users and APIs that access Docker logs.

Analytic 1 - Unexpected API calls or access to Docker logs indicating credential access.

index=containers sourcetype IN ("docker:events", "kubernetes:api", "kubernetes:container") | search Command IN ("docker logs", "kubectl get secrets", "kubectl describe secret", "kubectl exec", "curl http[:]//169.254.169[.]254/latest/meta-data/iam/security-credentials/", "aws iam list-access-keys", "az ad sp list")

Enterprise T1204 User Execution

Detect commands triggered by users, especially related to decompression tools (e.g., zip files) that may unpack malicious payloads. This includes compression applications, such as those for zip files, that can be used to Deobfuscate/Decode Files or Information in payloads.

Analytic 1 - Command lines showing decompression or decoding actions.

sourcetype=WinEventLog:Powershell EventCode=4104| search process_name IN ("powershell.exe", "cmd.exe", "zip.exe", "winrar.exe")| stats count by process_name command_line user| where command_line LIKE "%unzip%" OR command_line LIKE "%decode%"

.003 Malicious Image

Monitor for suspicious commands related to image or container manipulation, especially commands run from users not typically associated with these tasks.

Analytic 1 - Unexpected command execution related to image files.

sourcetype=command_execution| search command IN ("docker pull", "docker run", "docker exec", "kubectl run", "gcloud container images list-tags", "aws ec2 run-instances")

ICS T0863 User Execution

Monitor for newly executed processes that depend on user interaction, especially for applications that can embed programmatic capabilities (e.g., Microsoft Office products with scripts, installers, zip files). This includes compression applications, such as those for zip files, that can be used to Deobfuscate/Decode Files or Information in payloads. For added context on adversary procedures and background see User Execution and applicable sub-techniques.

Enterprise T1125 Video Capture

Monitor executed commands and arguments that can leverage a computer's peripheral devices (e.g., integrated cameras or webcams) or applications (e.g., video call services) to capture video recordings for the purpose of gathering information.

Enterprise T1497 Virtualization/Sandbox Evasion

Monitor executed commands and arguments that may employ various means to detect and avoid virtualization and analysis environments. Detecting actions related to virtualization and sandbox identification may be difficult depending on the adversary's implementation and monitoring required.

.001 System Checks

Monitor executed commands and arguments that may employ various means to detect and avoid virtualization and analysis environments. Detecting actions related to virtualization and sandbox identification may be difficult depending on the adversary's implementation and monitoring required.

.002 User Activity Based Checks

Monitor executed commands and arguments that may employ various means to detect and avoid virtualization and analysis environments. Detecting actions related to virtualization and sandbox identification may be difficult depending on the adversary's implementation and monitoring required.

.003 Time Based Evasion

Monitor executed commands and arguments that may employ various time-based methods to detect and avoid virtualization and analysis environments. Detecting actions related to virtualization and sandbox identification may be difficult depending on the adversary's implementation and monitoring required.

Enterprise T1047 Windows Management Instrumentation

Monitor executed commands and arguments for actions that are used to perform remote behavior.

Analytic 1 - Look for wmic.exeexecution with arguments indicative of remote process creation.

index=windows_logs sourcetype=WinEventLog:Security OR sourcetype=WinEventLog:Microsoft-Windows-Sysmon/Operational| eval CommandLine=coalesce(CommandLine, ParentCommandLine)| eval ProcessName=lower(ProcessName), CommandLine=lower(CommandLine)| search ProcessName IN ("wmic.exe", "powershell.exe", "wbemtool.exe", "wmiprvse.exe", "wmiadap.exe", "scrcons.exe")| search CommandLine IN ("process call create", "shadowcopy delete", "process start", "createobject")| stats count by _time, ComputerName, User, ProcessName, CommandLine, ParentProcessName, ParentCommandLine, dest, src_ip, dest_ip| eval alert_message="Suspicious WMI activity detected: " + ProcessName + " executed by " + User + " on " + ComputerName + " with command: " + CommandLine| where NOT (User="SYSTEM" OR ProcessName="wmiprvse.exe" OR CommandLine="wmic shadowcopy delete" AND src_ip="trusted_ip_range")| table _time, ComputerName, User, ProcessName, CommandLine, ParentProcessName, ParentCommandLine, src_ip, dest_ip, alert_message

References

  1. Confluence Support. (2021, September 8). How to enable command line audit logging in linux. Retrieved September 23, 2021.
  2. Gagliardi, R. (n.d.). Audit in a OS X System. Retrieved September 23, 2021.
  3. Mathers, B. (2017, March 7). Command line process auditing. Retrieved April 21, 2017.
  4. Microsoft. (n.d.). Background Intelligent Transfer Service. Retrieved January 12, 2018.
  5. French, D., Murphy, B. (2020, March 24). Adversary tradecraft 101: Hunting for persistence using Elastic Security (Part 1). Retrieved December 21, 2020.
  6. Counter Threat Unit Research Team. (2016, June 6). Malware Lingers with BITS. Retrieved January 12, 2018.
  7. Henderson, B. (2006, September 24). How To Insert And Remove LKMs. Retrieved April 9, 2018.
  8. Chuvakin, A. (2003, February). An Overview of Rootkits. Retrieved September 12, 2024.
  9. Remillano, A., Urbanec, J. (2019, September 19). Skidmap Linux Malware Uses Rootkit Capabilities to Hide Cryptocurrency-Mining Payload. Retrieved June 4, 2020.
  10. Pikeralpha. (2017, August 29). User Approved Kernel Extension Loading…. Retrieved September 23, 2021.
  11. Richard Purves. (2017, November 9). MDM and the Kextpocalypse . Retrieved September 23, 2021.
  12. Apple. (2019, May 3). Configuration Profile Reference. Retrieved September 23, 2021.
  13. Chrome Enterprise and Education Help. (n.d.). Use Chrome Browser with Roaming User Profiles. Retrieved March 28, 2023.
  14. Adrien Bataille, Anders Vejlby, Jared Scott Wilson, and Nader Zaveri. (2021, December 14). Azure Run Command for Dummies. Retrieved March 13, 2023.
  15. Malware Archaeology. (2016, June). WINDOWS POWERSHELL LOGGING CHEAT SHEET - Win 7/Win 2008 or later. Retrieved June 24, 2016.
  16. Dunwoody, M. (2016, February 11). GREATER VISIBILITY THROUGH POWERSHELL LOGGING. Retrieved February 16, 2016.
  17. Cisco. (n.d.). Cisco IOS Software Integrity Assurance - Command History. Retrieved October 21, 2020.
  18. Dennis German. (2020, November 20). launchd Keywords for plists. Retrieved October 7, 2021.
  19. Mercer, W. and Rascagneres, P. (2018, February 12). Olympic Destroyer Takes Aim At Winter Olympics. Retrieved March 14, 2019.
  20. Arntz, P. (2016, March 30). The Windows Vault . Retrieved November 23, 2020.
  21. ise. (2019, February 19). Password Managers: Under the Hood of Secrets Management. Retrieved January 22, 2021.
  22. Russinovich, M. & Garnier, T. (2017, May 22). Sysmon v6.20. Retrieved December 13, 2017.
  23. Microsoft. (2020, December). Azure Sentinel Detections. Retrieved December 30, 2020.
  24. Microsoft 365 Defender Team. (2020, December 28). Using Microsoft 365 Defender to protect against Solorigate. Retrieved January 7, 2021.
  25. Microsoft. (2020, September 14). Update or repair the settings of a federated domain in Office 365, Azure, or Intune. Retrieved December 30, 2020.
  26. Carr, N., Sellmer, S. (2021, June 14). Behind the scenes of business email compromise: Using cross-domain threat data to disrupt a large BEC campaign. Retrieved June 15, 2021.
  27. Microsoft. (2023, February 22). Manage mail flow rules in Exchange Online. Retrieved March 13, 2023.
  28. Microsoft. (n.d.). Retrieved January 24, 2020.
  29. Github. (n.d.). Receiving webhooks with the GitHub CLI. Retrieved August 4, 2023.
  30. Microsoft . (n.d.). Create subscription. Retrieved August 4, 2023.
  31. Phil Stokes. (2021, February 16). 20 Common Tools & Techniques Used by macOS Threat Actors & Malware. Retrieved August 23, 2021.
  32. Pravs. (2009, May 25). What you need to know about alternate data streams in windows? Is your Data secure? Can you restore that?. Retrieved March 21, 2018.
  1. Arntz, P. (2015, July 22). Introduction to Alternate Data Streams. Retrieved March 21, 2018.
  2. Marlin, J. (2013, March 24). Alternate Data Streams in NTFS. Retrieved March 21, 2018.
  3. Johann Rehberger. (2020, September 23). Beware of the Shadowbunny - Using virtual machines to persist and evade detections. Retrieved September 22, 2021.
  4. Pany, D. & Hanley, C. (2023, May 3). Cloudy with a Chance of Bad Logs: Cloud Platform Log Configurations to Consider in Investigations. Retrieved October 16, 2023.
  5. Chandel, R. (2021, April 22). Defense Evasion: Windows Event Logging (T1562.002). Retrieved September 14, 2021.
  6. svch0st. (2020, September 30). Event Log Tampering Part 1: Disrupting the EventLog Service. Retrieved September 14, 2021.
  7. Heiligenstein, L. (n.d.). REP-25: Disable Windows Event Logging. Retrieved April 7, 2022.
  8. Microsoft. (2021, May 27). bcdedit. Retrieved June 23, 2021.
  9. Gerend, J. et al. (2017, October 16). bootcfg. Retrieved August 30, 2021.
  10. Sophos. (2019, December 9). Snatch ransomware reboots PCs into Safe Mode to bypass protection. Retrieved June 23, 2021.
  11. Johann Rehberger. (2021, April 18). Spoofing credential dialogs on macOS Linux and Windows. Retrieved August 19, 2021.
  12. Carr, N.. (2018, October 25). Nick Carr Status Update Masquerading. Retrieved September 12, 2024.
  13. Fox, C., Vangel, D. (2018, April 22). Detect and Remediate Outlook Rules and Custom Forms Injections Attacks in Office 365. Retrieved February 4, 2019.
  14. SensePost. (2017, September 21). NotRuler - The opposite of Ruler, provides blue teams with the ability to detect Ruler usage against Exchange. Retrieved February 4, 2019.
  15. Damian Pfammatter. (2018, September 17). Hidden Inbox Rules in Microsoft Exchange. Retrieved October 12, 2021.
  16. PowerSploit. (n.d.). Retrieved December 4, 2014.
  17. Microsoft. (2016, August 21). Cached and Stored Credentials Technical Overview. Retrieved February 21, 2020.
  18. Atomic Red Team. (2023, November). T1003.007 - OS Credential Dumping: Proc Filesystem. Retrieved March 28, 2024.
  19. Gregal, Hunter. (2019, September 17). MimiPenguin 2.0. Retrieved March 28, 2024.
  20. French, D. (2018, October 9). Detecting & Removing an Attacker’s WMI Persistence. Retrieved October 11, 2019.
  21. French, D. (2018, September 30). Detecting Lateral Movement Using Sysmon and Splunk. Retrieved October 11, 2019.
  22. Microsoft. (2007, November 24). IIS Modules Overview. Retrieved June 17, 2021.
  23. Falcone, R. (2018, January 25). OilRig uses RGDoor IIS Backdoor on Targets in the Middle East. Retrieved July 6, 2018.
  24. Hromcová, Z., Cherepanov, A. (2021). Anatomy of Native IIS Malware. Retrieved September 9, 2021.
  25. Schroeder, W. & Christensen, L. (2021, June 22). Certified Pre-Owned - Abusing Active Directory Certificate Services. Retrieved August 2, 2022.
  26. Graeber, M. (2017, December 22). Code Signing Certificate Cloning Attacks and Defenses. Retrieved April 3, 2018.
  27. Russinovich, M. et al.. (2017, May 22). Sigcheck. Retrieved April 3, 2018.
  28. Microsoft. (2021, February 15). Enable Loading of Test Signed Drivers. Retrieved April 22, 2021.
  29. Lambert, J. (2020, December 13). Important steps for customers to protect themselves from recent nation-state cyberattacks. Retrieved December 17, 2020.
  30. Mercês, F. (2014, January 27). CPL Malware - Malicious Control Panel Items. Retrieved January 18, 2018.
  31. Nolen, R. et al.. (2016, April 28). Threat Advisory: “Squiblydoo” Continues Trend of Attackers Using Native OS Tools to “Live off the Land”. Retrieved April 9, 2018.