File

A computer resource object, managed by the I/O system, for storing data (such as images, text, videos, computer programs, or any wide variety of other media).[1]

ID: DS0022
Platforms: ESXi, Linux, Network Devices, Windows, macOS
Collection Layer: Host
Contributors: Center for Threat-Informed Defense (CTID)
Version: 1.1
Created: 20 October 2021
Last Modified: 18 April 2025

Data Components

File: File Access

To events where a file is opened or accessed, making its contents available to the requester. This includes reading, executing, or interacting with files by authorized or unauthorized entities. Examples include logging file access events (e.g., Windows Event ID 4663), monitoring file reads, and detecting unusual file access patterns. Examples:

  • File Read Operations: A user opens a sensitive document (e.g., financial_report.xlsx) on a shared drive.
  • File Execution: A script or executable file is accessed and executed (e.g., malware.exe is run from a temporary directory).
  • Unauthorized File Access: An unauthorized user attempts to access a protected configuration file (e.g., /etc/passwd on Linux or System32 files on Windows).
  • File Access Patterns: Bulk access to multiple files in a short time (e.g., mass access to documents on a file server).
  • File Access via Network: Files on a network share are accessed remotely (e.g., logs of SMB file access).

This data component can be collected through the following measures:

Windows

  • Windows Event Logs: Event ID 4663: Captures file system auditing details, including who accessed the file, access type, and file name.
  • Sysmon:
    • Event ID 11: Logs file creation time changes.
    • Event ID 1 (process creation): Can provide insight into files executed.
  • PowerShell: Commands to monitor file access in real-time: Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4663}

Linux

  • Auditd: Monitor file access events using audit rules: auditctl -w /path/to/file -p rwxa -k file_access
  • View logs: ausearch -k file_access
  • Inotify: Use inotify to track file access on Linux: inotifywait -m /path/to/watch -e access

macOS

  • Unified Logs: Monitor file access using the macOS Unified Logging System.
  • FSEvents: File System Events can track file accesses: fs_usage | grep open

Network Devices

  • SMB/CIFS Logs: Monitor file access over network shares using logs from SMB or CIFS protocol.
  • NAS Logs: Collect logs from network-attached storage systems for file access events.

SIEM Integration

  • Collect file access logs from all platforms (Windows, Linux, macOS) and centralize in a SIEM for correlation and analysis.

File: File Access

To events where a file is opened or accessed, making its contents available to the requester. This includes reading, executing, or interacting with files by authorized or unauthorized entities. Examples include logging file access events (e.g., Windows Event ID 4663), monitoring file reads, and detecting unusual file access patterns. Examples:

  • File Read Operations: A user opens a sensitive document (e.g., financial_report.xlsx) on a shared drive.
  • File Execution: A script or executable file is accessed and executed (e.g., malware.exe is run from a temporary directory).
  • Unauthorized File Access: An unauthorized user attempts to access a protected configuration file (e.g., /etc/passwd on Linux or System32 files on Windows).
  • File Access Patterns: Bulk access to multiple files in a short time (e.g., mass access to documents on a file server).
  • File Access via Network: Files on a network share are accessed remotely (e.g., logs of SMB file access).

This data component can be collected through the following measures:

Windows

  • Windows Event Logs: Event ID 4663: Captures file system auditing details, including who accessed the file, access type, and file name.
  • Sysmon:
    • Event ID 11: Logs file creation time changes.
    • Event ID 1 (process creation): Can provide insight into files executed.
  • PowerShell: Commands to monitor file access in real-time: Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4663}

Linux

  • Auditd: Monitor file access events using audit rules: auditctl -w /path/to/file -p rwxa -k file_access
  • View logs: ausearch -k file_access
  • Inotify: Use inotify to track file access on Linux: inotifywait -m /path/to/watch -e access

macOS

  • Unified Logs: Monitor file access using the macOS Unified Logging System.
  • FSEvents: File System Events can track file accesses: fs_usage | grep open

Network Devices

  • SMB/CIFS Logs: Monitor file access over network shares using logs from SMB or CIFS protocol.
  • NAS Logs: Collect logs from network-attached storage systems for file access events.

SIEM Integration

  • Collect file access logs from all platforms (Windows, Linux, macOS) and centralize in a SIEM for correlation and analysis.
Domain ID Name Detects
Enterprise T1087 Account Discovery

Monitor access to file resources that contain local accounts and groups information such as /etc/passwd, /Users directories, and the SAM database.

If access requires high privileges, look for non-admin objects (such as users or processes) attempting to access restricted file resources.

.001 Local Account

Monitor access to file resources that contain local accounts and groups information such as /etc/passwd, /Users directories, and the Windows SAM database.

If access requires high privileges, look for non-admin objects (such as users or processes) attempting to access restricted file resources.

Enterprise T1119 Automated Collection

Monitor for unexpected files (e.g., .pdf, .docx, .jpg, etc.) viewed for collecting internal data.

ICS T0802 Automated Collection

Monitor for unexpected files (e.g., .pdf, .docx, .jpg) viewed for collecting internal data.

Enterprise T1020 Automated Exfiltration

Monitor for abnormal access to files (i.e. .pdf, .docx, .jpg, etc.), especially sensitive documents, through the use of automated processing after being gathered during Collection.

Analytic 1 - Detecting File Access Before Automated Exfiltration

(EventCode=11 OR EventCode=4663 OR source="/var/log/audit/audit.log" type="open")| where (file_path IN ("/var/tmp/", "/home//Downloads/", "/media/exfil/", "C:\Users\\Documents\exfil"))| eval risk_score=case( file_path IN ("/media/exfil/"), 9, file_path IN ("/var/tmp/*"), 8)| where risk_score >= 8| stats count by _time, host, user, file_path, risk_score

Enterprise T1217 Browser Information Discovery

Monitor for unusual access to stored browser data, such as local files and databases (e.g., %APPDATA%/Google/Chrome).[2] Rather than viewing these events in isolation, this activity may highlight a chain of behavior that could lead to other activities, such as Collection and Exfiltration.

Enterprise T1555 Credentials from Password Stores

Monitor for files being accessed that may search for common password storage locations to obtain user credentials.

Analytic 1 - Unauthorized access to files containing credentials.

index=security sourcetype IN ("WinEventLog:Security", "WinEventLog:Microsoft-Windows-Sysmon/Operational", "linux_secure", "macos_secure")((sourcetype="WinEventLog:Security" EventCode=4663 ObjectName IN ("passwords", "creds", "credentials", "secrets")) OR (sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=11 TargetObject IN ("passwords", "creds", "credentials", "secrets")) OR (sourcetype="linux_secure" action="open" filepath IN ("/etc/shadow", "/etc/passwd", "/.aws/credentials", "/.ssh/id_rsa")) OR (sourcetype="macos_secure" event_type="open" file_path IN ("/Library/Keychains/", "/Users//Library/Keychains/", "/Users//.ssh/id_rsa")))

.001 Keychain

Monitor for Keychain files being accessed that may be related to malicious credential collection.

Analytic 1 - Unauthorized access to Keychain files.

index=security sourcetype="macos_secure"(event_type="file_open" AND file_path IN ("~/Library/Keychains/", "/Library/Keychains/", "/Network/Library/Keychains/*"))

.003 Credentials from Web Browsers

Identify web browser files that contain credentials such as Google Chrome’s Login Data database file: AppData\Local\Google\Chrome\User Data\Default\Login Data. Monitor file read events of web browser files that contain credentials, especially when the reading process is unrelated to the subject web browser.

Analytic 1 - Unauthorized access to web browser credential files.

index=security sourcetype IN ("WinEventLog:Microsoft-Windows-Sysmon/Operational", "linux_secure", "macos_secure") event_type="file_open"((file_path IN ("\AppData\Local\Google\Chrome\User Data\Default\Login Data", "\AppData\Local\Microsoft\Edge\User Data\Default\Login Data", "\AppData\Roaming\Mozilla\Firefox\Profiles\\logins.json") AND Platform="Windows") OR (file_path IN ("/home//.mozilla/firefox//logins.json", "/home//.config/google-chrome/Default/Login Data") AND Platform="Linux") OR (file_path IN ("/Users//Library/Application Support/Google/Chrome/Default/Login Data", "/Users//Library/Application Support/Firefox/Profiles//logins.json") AND Platform="macOS"))

.004 Windows Credential Manager

Consider monitoring file reads to Vault locations, %Systemdrive%\Users\\[Username]\AppData\Local\Microsoft\\[Vault/Credentials]\, for suspicious activity.[3]

Analytic 1 - Unauthorized access to Windows Vault credential files.

index=security sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" event_type="file_access"(file_path IN ("%SystemDrive%\Users\\AppData\Local\Microsoft\Vault\\.vcrd", "%SystemDrive%\Users\\AppData\Local\Microsoft\Credentials\\.vcrd", "%SystemDrive%\Users\\AppData\Local\Microsoft\Vault\\Policy.vpol", "%SystemDrive%\Users\\AppData\Local\Microsoft\Credentials\\Policy.vpol"))

.005 Password Managers

Monitor file reads that may acquire user credentials from third-party password managers.[4]

Analytic 1 - Unauthorized access to password manager files.

index=security sourcetype IN ("WinEventLog:Microsoft-Windows-Sysmon/Operational", "linux_secure", "macos_secure") EventCode IN (1, 4663)(file_path IN ("\AppData\Local\Keepass\.kdbx", "\AppData\Local\LastPass\.lpvault", "\AppData\Local\1Password\.agilekeychain", "\AppData\Local\Bitwarden\.json", "\AppData\Local\Dashlane\.db", "\AppData\Local\PasswordSafe\.psafe3", "/home//.keepass/.kdbx", "/home//.lastpass/.lpvault", "/home//.1password/.agilekeychain", "/home//.bitwarden/.json", "/home//.dashlane/.db", "/home//.passwordsafe/.psafe3"))

Enterprise T1005 Data from Local System

Monitor for unexpected/abnormal access to files that may be malicious collection of local data, such as user files (pdf, .docx, .jpg, etc.) or local databases. On ESXi servers, this may include .vmdk and .vmsn files in the /vmfs/volumes directory.

ICS T0893 Data from Local System

Monitor for unexpected/abnormal access to files that may be malicious collection of local data, such as user files (e.g., .pdf, .docx, .jpg, .dwg ) or local databases.

Enterprise T1039 Data from Network Shared Drive

Monitor for unexpected files (i.e. .pdf, .docx, .jpg, etc.) interacting with network shares.

Enterprise T1025 Data from Removable Media

Monitor for unexpected/abnormal file accesses to removable media (optical disk drive, USB memory, etc.) connected to the compromised system.

Enterprise T1074 Data Staged

Monitor processes that appear to be reading files from disparate locations and writing them to the same directory or file may be an indication of data being staged, especially if they are suspected of performing encryption or compression on the files, such as 7zip, RAR, ZIP, or zlib.

.001 Local Data Staging

Monitor processes that appear to be reading files from disparate locations and writing them to the same directory or file may be an indication of data being staged, especially if they are suspected of performing encryption or compression on the files, such as 7zip, RAR, ZIP, or zlib.

.002 Remote Data Staging

Monitor processes that appear to be reading files from disparate locations and writing them to the same directory or file may be an indication of data being staged, especially if they are suspected of performing encryption or compression on the files, such as 7zip, RAR, ZIP, or zlib.

Enterprise T1114 Email Collection

Monitor for unusual processes access of local system email files for Exfiltration, unusual processes connecting to an email server within a network, or unusual access patterns or authentication attempts on a public-facing webmail server may all be indicators of malicious activity.

.001 Local Email Collection

Monitor for unusual processes accessing local email files that may target user email on local systems to collect sensitive information.

Enterprise T1048 Exfiltration Over Alternative Protocol

Monitor for suspicious files (i.e. .pdf, .docx, .jpg, etc.) viewed in isolation 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 for files being encrypted before transfer, temporary storage of encrypted files before exfiltration, or files with unusual extensions indicative of encryption (.aes, .enc, .bin).

Analytic 1 - Detecting Encrypted Files Before Exfiltration

(EventCode=11 OR EventCode=4663 OR source="/var/log/audit/audit.log" type="open")| where (file_path IN ("/tmp/", "/var/tmp/", "/home//Downloads/", "C:\Users\*\Documents\exfil") AND file_extension IN ("aes", "enc", "bin"))| eval risk_score=case( file_extension="aes" OR file_extension="enc", 9, file_extension="bin", 8)| where risk_score >= 8| stats count by _time, host, user, file_path, file_extension, risk_score

.002 Exfiltration Over Asymmetric Encrypted Non-C2 Protocol

Monitor files being encrypted before transmission, temporary storage of encrypted files in staging areas before exfiltration, or presence of public/private key files in suspicious locations.

Analytic 1 - Detecting Encrypted Files Before Exfiltration

(EventCode=11 OR EventCode=4663 OR source="/var/log/audit/audit.log" type="open")| where (file_path IN ("/tmp/", "/var/tmp/", "/home//Downloads/", "C:\Users\*\Documents\exfil") AND file_extension IN ("gpg", "rsa", "pem", "p12"))| eval risk_score=case( file_extension="gpg" OR file_extension="rsa", 9, file_extension="pem" OR file_extension="p12", 8)| where risk_score >= 8| stats count by _time, host, user, file_path, file_extension, risk_score

.003 Exfiltration Over Unencrypted Non-C2 Protocol

Monitor files being accessed and staged before unencrypted exfiltration, creation of compressed archives before network transmission, or presence of encoded file formats that indicate obfuscation (.b64, .zip, .tar).

Analytic 1 - Detecting File Access Before Unencrypted Exfiltration

(EventCode=11 OR EventCode=4663 OR source="/var/log/audit/audit.log" type="open")| where (file_path IN ("/tmp/", "/var/tmp/", "/home//Downloads/", "C:\Users\*\Documents\exfil") AND file_extension IN ("b64", "tar", "zip"))| eval risk_score=case( file_extension="b64" OR file_extension="tar", 9, file_extension="zip", 8)| where risk_score >= 8| stats count by _time, host, user, file_path, file_extension, risk_score

Enterprise T1041 Exfiltration Over C2 Channel

Monitor for suspicious files (i.e. .pdf, .docx, .jpg, etc.) viewed in isolation that may steal data by exfiltrating it over an existing command and control channel.

Analytic 1 - Detecting File Access Before C2 Exfiltration

(EventCode=11 OR EventCode=4663 OR source="/var/log/audit/audit.log" type="open")| where (file_path IN ("/tmp/", "/var/tmp/", "/home//Downloads/", "C:\Users\\Documents\exfil"))| eval risk_score=case( file_path IN ("/tmp/", "/var/tmp/"), 9, file_path IN ("/home//Downloads/*"), 8)| where risk_score >= 8| stats count by _time, host, user, file_path, risk_score

Enterprise T1011 Exfiltration Over Other Network Medium

Monitor for access to sensitive files before potential exfiltration, files being staged in locations accessible to alternate networks, or usage of USB storage, external disks, or wireless file transfer.

Analytic 1 - Detecting File Access Before Alternate Network Exfiltration

(EventCode=11 OR EventCode=4663 OR source="/var/log/audit/audit.log" type="open")| where (file_path IN ("/media/usb/", "/mnt/usb/", "/var/tmp/exfil/", "C:\Users\\Documents\exfil"))| eval risk_score=case( file_path IN ("/media/usb/", "/mnt/usb/"), 9, file_path IN ("/var/tmp/exfil/*"), 8)| where risk_score >= 8| stats count by _time, host, user, file_path, risk_score

.001 Exfiltration Over Bluetooth

Monitor file access events in directories commonly used for data staging (/tmp, C:\Users\Public), files copied to Bluetooth shared folders, or high-volume file reads or writes before network activity.

Analytic 1 - Detecting File Access Before Bluetooth Exfiltration

(EventCode=11 OR EventCode=4663 OR source="/var/log/audit/audit.log" type="open")| where (file_path IN ("/var/tmp/", "/home//Downloads/", "/media/bluetooth/", "C:\Users\\Documents\exfil"))| eval risk_score=case( file_path IN ("/media/bluetooth/"), 9, file_path IN ("/var/tmp/*"), 8)| where risk_score >= 8| stats count by _time, host, user, file_path, risk_score

Enterprise T1052 Exfiltration Over Physical Medium

Monitor file access on removable media that may attempt to exfiltrate data via a physical medium, such as a removable drive.

Analytic 1 - Detecting File Access to Removable Media

(EventCode=11 OR EventCode=4663 OR source="/var/log/audit/audit.log" type="open")| where (file_path IN ("/media/usb/", "/mnt/usb/", "D:\USB\", "E:\USB\"))| eval risk_score=case( file_path LIKE "%/media/usb/%", 9, file_path LIKE "%D:\USB\%", 8)| where risk_score >= 8| stats count by _time, host, user, file_path, risk_score

.001 Exfiltration over USB

Monitor file access on removable media that may attempt to exfiltrate data over a USB connected physical device.

Analytic 1 - Detecting File Transfers to USB Storage

(EventCode=11 OR EventCode=4663 OR source="/var/log/audit/audit.log" type="open")| where (file_path IN ("/media/usb/", "/mnt/usb/", "D:\USB\", "E:\USB\"))| eval risk_score=case( file_path LIKE "%/media/usb/%", 9, file_path LIKE "%D:\USB\%", 8)| where risk_score >= 8| stats count by _time, host, user, file_path, risk_score

Enterprise T1567 Exfiltration Over Web Service

Monitor for files being accessed by an existing, legitimate external Web service to exfiltrate data rather than their primary command and control channel.

Analytic 1 - Detecting File Staging Before Web Service Upload

(EventCode=11 OR EventCode=4663 OR source="/var/log/audit/audit.log" type="open")| where (file_path IN ("/tmp/", "/var/tmp/", "/home//Downloads/", "C:\Users\\Documents\exfil"))| eval risk_score=case( file_path LIKE "/tmp/%", 9, file_path LIKE "C:\Users\\Documents\exfil", 8)| where risk_score >= 8| stats count by _time, host, user, file_path, risk_score

.001 Exfiltration to Code Repository

Monitor for files being accessed to exfiltrate data to a code repository rather than over their primary command and control channel.

Analytic 1 - Detecting File Staging for Exfiltration to Code Repositories

(EventCode=11 OR EventCode=4663 OR source="/var/log/audit/audit.log" type="open")| where (file_path IN ("/home//repos/", "C:\Users\\Documents\git_repos\", "/var/tmp/repos/"))| eval risk_score=case( file_path LIKE "/home//repos/%", 9, file_path LIKE "C:\Users\\Documents\git_repos\%", 8)| where risk_score >= 8| stats count by _time, host, user, file_path, risk_score

.002 Exfiltration to Cloud Storage

Monitor for files being accessed to exfiltrate data to a cloud storage service rather than over their primary command and control channel.

Analytic 1 - Detecting File Staging Before Cloud Storage Upload

(EventCode=11 OR EventCode=4663 OR source="/var/log/audit/audit.log" type="open")| where (file_path IN ("/tmp/", "/var/tmp/", "/home//Downloads/", "C:\Users\\Documents\exfil"))| eval risk_score=case( file_path LIKE "/tmp/%", 9, file_path LIKE "C:\Users\\Documents\exfil", 8)| where risk_score >= 8| stats count by _time, host, user, file_path, risk_score

.004 Exfiltration Over Webhook

Monitor for files being accessed to exfiltrate data to a webhook as a malicious command and control channel.

Analytic 1 - Detecting File Staging Before Webhook Upload

(EventCode=11 OR EventCode=4663 OR source="/var/log/audit/audit.log" type="open")| where (file_path IN ("/tmp/", "/var/tmp/", "/home//Downloads/", "C:\Users\\Documents\exfil"))| eval risk_score=case( file_path LIKE "/tmp/%", 9, file_path LIKE "C:\Users\\Documents\exfil", 8)| where risk_score >= 8| stats count by _time, host, user, file_path, risk_score

Enterprise T1187 Forced Authentication

Monitor for access to files that may indicate attempts to coerce a user into providing authentication information.

Analytic 1 - Suspicious access to files known to be used for forced authentication attacks.

index=security sourcetype="WinEventLog:Security" EventCode=4663 ObjectName="\path\to\suspicious\file" | where match(ObjectName, "(?i)\(.*\.)?(lnk|scf|url|doc|dot|xls|ppt|pdf|scf|html)$")

Enterprise T1654 Log Enumeration

Monitor for access to system and service log files, especially from unexpected and abnormal users.

Enterprise T1003 OS Credential Dumping

Monitor file accesses that may indicate attempts to dump credential data from various storage locations such as LSASS memory, SAM, NTDS.dit, LSA secrets, cached domain credentials, proc filesystem, /etc/passwd, and /etc/shadow.

Analytic 1 - Unauthorized access to credential storage files.

(index=security sourcetype="WinEventLog:Security" EventCode=4663 ObjectName IN ("\config\SAM", "\ntds.dit", "\policy\secrets", "\cache"))OR (index=security sourcetype="auditd" (key="path" (value IN ("/etc/passwd", "/etc/shadow")) OR key="proctitle" value IN ("cat", "strings", "grep", "awk", "cut", "sed", "sort", "uniq", "head", "tail", "less", "more")))OR(index=security sourcetype="macOS:UnifiedLog" (process IN ("cat", "grep", "awk", "cut", "sed", "sort", "uniq", "head", "tail", "less", "more") OR message IN ("/etc/passwd", "/etc/shadow", "/var/db/shadow/hash/*", "/private/etc/master.passwd")))

.002 Security Account Manager

Monitor for hash dumpers opening the Security Accounts Manager (SAM) on the local file system (%SystemRoot%/system32/config/SAM). Some hash dumpers will open the local file system as a device and parse to the SAM table to avoid file access defenses. Others will make an in-memory copy of the SAM table before reading hashes. Detection of compromised Valid Accounts in-use by adversaries may help as well.

Analytic 1 - Unauthorized access to SAM database.

index=security sourcetype="WinEventLog:Security" EventCode=4663 ObjectName="*\config\SAM" | where ProcessName IN ("reg.exe", "powershell.exe", "wmic.exe", "schtasks.exe", "cmd.exe", "rundll32.exe", "mimikatz.exe", "procdump.exe")

.003 NTDS

Monitor for access or copy of the NTDS.dit.

Note: Events 4656 and 4663 (Microsoft Windows Security Auditing) provide context of processes and users requesting access or accessing file objects (ObjectType = File) such as C:\Windows\NTDS\ntds.dit. It is important to note that, in order to generate these events, a System Access Control List (SACL) must be defined for the ntds.dit file. Access rights that allow read operations on file objects and its attributes are %%4416 Read file data, %%4419 Read extended file attributes, %%4423 Read file attributes. If you search for just the name of the file and not the entire directory, you may get access events related to the ntds.dit file within a snapshot or volume shadow copy.

Events 4656 and 4663 (Microsoft Windows Security Auditing) provide context of processes and users creating or copying file objects (ObjectType = File) such as C:\Windows\NTDS\ntds.dit. It is important to note that, in order to generate these events, a System Access Control List (SACL) must be defined for the ntds.dit file. In order to filter file creation events, filter access rigths %%4417 Write data to the file and %%4424 Write file attributes.

Event 11 (Microsoft Windows Sysmon) provide context of processes and users creating or copying files. Unfortunately, this event provides context of the file being created or copied, but not the file being copied. A good starting point would be to look for new files created or copied with extension .dit.

Analytic 1 - Active Directory Dumping via NTDSUtil

(sourcetype=WinEventLog:Security EventCode IN (4656, 4663)) OR (sourcetype=WinEventLog:Microsoft-Windows-Sysmon/Operational EventCode="11") ANDObjectType="File" AND TargetFilename="*ntds.dit" AND (AccessList="%%4416" OR AccessList="%%4419" OR AccessList="%%4417" OR AccessList="%%4424")

.007 Proc Filesystem

Monitor for unexpected access to passwords and hashes stored in memory, processes must open a maps file in the /proc filesystem for the process being analyzed. This file is stored under the path /proc/\/maps, where the \ directory is the unique pid of the program being interrogated for such authentication data. The AuditD monitoring tool, which ships stock in many Linux distributions, can be used to watch for hostile processes opening this file in the proc file system, alerting on the pid, process name, and arguments of such programs.

Analytic 1 - Unauthorized access to /proc filesystem.

index=os sourcetype="linux_audit" command IN ("grep -E '^[0-9a-f-] r' /proc//maps")

.008 /etc/passwd and /etc/shadow

Monitor for files being accessed that may attempt to dump the contents of /etc/passwd and /etc/shadow to enable offline password cracking. The AuditD monitoring tool, which ships stock in many Linux distributions, can be used to watch for hostile processes attempting to access /etc/passwd and /etc/shadow, alerting on the pid, process name, and arguments of such programs.

Analytic 1 - Unauthorized access to /etc/passwd and /etc/shadow.

index=os sourcetype="linux_audit" file IN ("/etc/passwd", "/etc/shadow")

Enterprise T1018 Remote System Discovery

Monitor for files (such as /etc/hosts) being accessed 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 Windows, Event ID 4663 (An Attempt Was Made to Access An Object) can be used to alert on access attempts of local files that store host data, including C:\Windows\System32\Drivers\etc\hosts.

For Linux, auditing frameworks such as the audit daemon (auditd) can be used to alert on access attempts of local files that store host data, including /etc/hosts.

ICS T0846 Remote System Discovery

Monitor for files (such as /etc/hosts) being accessed 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.

ICS T0888 Remote System Information Discovery

Monitor for files (such as /etc/hosts) being accessed 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.

Enterprise T1091 Replication Through Removable Media

Monitor for unexpected files accessed on removable media.

Analytic 1 - File read events from removable media

index=windows sourcetype="WinEventLog:Security" EventID=4663Accesses="ReadData (or ListDirectory)" AND ObjectType="File"| stats count by ObjectName, Account_Name, ProcessName, ComputerName, _time| where match(ObjectName, ".:\\RemovableMedia\\.") OR match(ObjectName, ".:\\USB.")| table _time, ObjectName, Account_Name, ProcessName, ComputerName

ICS T0847 Replication Through Removable Media

Monitor for files accessed on removable media, particularly those with executable content.

Enterprise T1649 Steal or Forge Authentication Certificates

Monitor for attempts to access files that store information about certificates and their associated private keys. For example, personal certificates for users may be stored on disk in folders such as %APPDATA%\Microsoft\SystemCertificates\My\Certificates\.[5][6]

Enterprise T1558 Steal or Forge Kerberos Tickets

Monitor for unexpected processes interacting with lsass.exe.[7] Common credential dumpers such as Mimikatz access the LSA Subsystem Service (LSASS) process by opening the process, locating the LSA secrets key, and decrypting the sections in memory where credential details, including Kerberos tickets, are stored.

.005 Ccache Files

Monitor for abnormal read access to ccache files located in the /tmp directory of a system from non-user processes.

Enterprise T1539 Steal Web Session Cookie

Monitor for an attempt by a user to gain access to a network or computing resource, often by providing credentials to cloud service management consoles. Some cloud providers, such as AWS, provide distinct log events for login attempts to the management console.

Analytic 1 - Unexpected access to web session cookies files.

(index=security sourcetype="WinEventLog:Security" EventCode=4663 ObjectName="\AppData\Roaming\\Cookies\" OR ObjectName="\AppData\Local\\Cookies\") OR(index=sysmon sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=11 TargetObject="\AppData\Roaming\\Cookies\" OR TargetObject="\AppData\Local\\Cookies\") OR(index=os sourcetype="linux_audit" (filepath="/home//.mozilla/firefox/.default-release/cookies.sqlite" OR filepath="/home//.config/google-chrome/Default/Cookies")) OR(index=os sourcetype="macos_secure" file_path="/Users//Library/Application Support/Google/Chrome/Default/Cookies") OR(index=gsuite sourcetype="gsuite:admin" event_name="LOGIN" event_type="cookie_auth") OR(index=o365 sourcetype="o365:management:activity" Operation="UserLoginViaCookie")

Enterprise T1033 System Owner/User Discovery

Monitor for hash dumpers opening the Security Accounts Manager (SAM) on the local file system (%SystemRoot%/system32/config/SAM). Some hash dumpers will open the local file system as a device and parse to the SAM table to avoid file access defenses. Others will make an in-memory copy of the SAM table before reading hashes. Detection of compromised Valid Accounts in-use by adversaries may help as well.

Enterprise T1552 Unsecured Credentials

Monitor for suspicious file access activity, specifically indications that a process is reading multiple files in a short amount of time and/or using command-line arguments indicative of searching for credential material (ex: regex patterns). These may be indicators of automated/scripted credential access behavior. Monitoring when the user's .bash_history is read can help alert to suspicious activity. 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 - Multiple file reads in a short period or searching for credential material.

(index=security sourcetype="WinEventLog:Security" EventCode=4663 ObjectName="password" OR ObjectName="credential") OR(index=sysmon sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=11 TargetObject="password" OR TargetObject="credential") OR(index=os sourcetype="linux_audit" action="open" filepath IN ("password", "credential", "passwd", "shadow", ".pem", ".key")) OR(index=os sourcetype="macos_secure" event_type="open" file_path IN ("password", "credential", "passwd", "shadow", ".pem", ".key"))

.001 Credentials In Files

Monitor for files being accessed that may search local file systems and remote file shares for files containing insecurely stored credentials. While detecting adversaries accessing these files may be difficult without knowing they exist in the first place, it may be possible to detect adversary use of credentials they have obtained.

Analytic 1 - Unauthorized access to files containing credentials.

(index=security sourcetype="WinEventLog:Security" EventCode=4663 ObjectName IN ("password", "credential", "secret", "token")) OR(index=sysmon sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=11 TargetObject IN ("password", "credential", "secret", "token")) OR(index=os sourcetype="linux_audit" action="open" filepath IN ("password", "credential", "passwd", "shadow", ".pem", ".key", "secret", "token")) OR(index=os sourcetype="macos_secure" event_type="open" file_path IN ("password", "credential", "passwd", "shadow", ".pem", ".key", "secret", "token"))

.003 Bash History

Monitoring when the user's .bash_history is read can help alert to suspicious activity.

Analytic 1 - Unauthorized access to .bash_history.

(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") | where User NOT IN ("root", "daemon", "bin", "nobody", "_spotlight", "_mbsetupuser")| where NOT match(User, "^[a-z]+$") # Filter out common service accounts

.004 Private Keys

Monitor access to files and directories related to cryptographic keys and certificates as a means for potentially detecting access patterns that may indicate collection and exfiltration activity.

Analytic 1 - Unauthorized access to cryptographic key files.

(index=security sourcetype="WinEventLog:Security" EventCode=4663 ObjectName IN (".key", ".pgp", ".gpg", ".ppk", ".p12", ".pem", ".pfx", ".cer", ".p7b", ".asc", "private key", "certificate")) OR(index=sysmon sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=11 TargetObject IN (".key", ".pgp", ".gpg", ".ppk", ".p12", ".pem", ".pfx", ".cer", ".p7b", ".asc", "private key", "certificate")) OR(index=os sourcetype="linux_secure" action="open" filepath IN (".key", ".pgp", ".gpg", ".ppk", ".p12", ".pem", ".pfx", ".cer", ".p7b", ".asc", "private key", "certificate")) OR(index=os sourcetype="macos_secure" event_type="open" file_path IN (".key", ".pgp", ".gpg", ".ppk", ".p12", ".pem", ".pfx", ".cer", ".p7b", ".asc", "private key", "certificate"))

.006 Group Policy Preferences

Monitor for attempts to access SYSVOL that involve searching for XML files.

Analytic 1 - Unauthorized access to SYSVOL XML files.

index=security sourcetype="WinEventLog:Security" EventCode=4663 ObjectName="SYSVOL" ObjectName="*.xml"| eval AccessType=case( AccessMask="0x1", "Read", AccessMask="0x2", "Write", AccessMask="0x3", "Read/Write", AccessMask="0x4", "Delete", true(), "Unknown")

ICS T0863 User Execution

Anti-virus can potentially detect malicious documents and files that are downloaded and executed on the user's computer. Endpoint sensing or network sensing can potentially detect malicious events once the file is opened (such as a Microsoft Word document or PDF reaching out to the internet or spawning PowerShell).

File: File Creation

A new file is created on a system or network storage. This action often signifies an operation such as saving a document, writing data, or deploying a file. Logging these events helps identify legitimate or potentially malicious file creation activities. Examples include logging file creation events (e.g., Sysmon Event ID 11 or Linux auditd logs).

This data component can be collected through the following measures:

Windows

  • Sysmon: Event ID 11: Logs file creation events, capturing details like the file path, hash, and creation time.
  • Windows Event Log: Enable "Object Access" auditing in Group Policy to track file creation under Event ID 4663.
  • PowerShell: Real-time monitoring of file creation:Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4663}

Linux

  • Auditd: Use audit rules to monitor file creation: auditctl -w /path/to/directory -p w -k file_creation
  • View logs: ausearch -k file_creation
  • Inotify: Monitor file creation with inotifywait: inotifywait -m /path/to/watch -e create

macOS

  • Unified Logs: Use the macOS Unified Logging System to capture file creation events.
  • FSEvents: Use File System Events to monitor file creation: fs_usage | grep create

Network Devices

  • NAS Logs: Monitor file creation events on network-attached storage devices.
  • SMB Logs: Collect logs of file creation activities over SMB/CIFS protocols.

SIEM Integration

  • Forward logs from all platforms (Windows, Linux, macOS) to a SIEM for central analysis and alerting.

File: File Creation

A new file is created on a system or network storage. This action often signifies an operation such as saving a document, writing data, or deploying a file. Logging these events helps identify legitimate or potentially malicious file creation activities. Examples include logging file creation events (e.g., Sysmon Event ID 11 or Linux auditd logs).

This data component can be collected through the following measures:

Windows

  • Sysmon: Event ID 11: Logs file creation events, capturing details like the file path, hash, and creation time.
  • Windows Event Log: Enable "Object Access" auditing in Group Policy to track file creation under Event ID 4663.
  • PowerShell: Real-time monitoring of file creation:Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4663}

Linux

  • Auditd: Use audit rules to monitor file creation: auditctl -w /path/to/directory -p w -k file_creation
  • View logs: ausearch -k file_creation
  • Inotify: Monitor file creation with inotifywait: inotifywait -m /path/to/watch -e create

macOS

  • Unified Logs: Use the macOS Unified Logging System to capture file creation events.
  • FSEvents: Use File System Events to monitor file creation: fs_usage | grep create

Network Devices

  • NAS Logs: Monitor file creation events on network-attached storage devices.
  • SMB Logs: Collect logs of file creation activities over SMB/CIFS protocols.

SIEM Integration

  • Forward logs from all platforms (Windows, Linux, macOS) to a SIEM for central analysis and alerting.
Domain ID Name Detects
Enterprise T1560 Archive Collected Data

Monitor newly constructed files being written with extensions and/or headers associated with compressed or encrypted file types. Detection efforts may focus on follow-on exfiltration activity, where compressed or encrypted files can be detected in transit with a network intrusion detection or data loss prevention system analyzing file headers.

.001 Archive via Utility

Monitor newly constructed files being written with extensions and/or headers associated with compressed or encrypted file types. Detection efforts may focus on follow-on exfiltration activity, where compressed or encrypted files can be detected in transit with a network intrusion detection or data loss prevention system analyzing file headers.

.002 Archive via Library

Monitor newly constructed files being written with extensions and/or headers associated with compressed or encrypted file types. Detection efforts may focus on follow-on exfiltration activity, where compressed or encrypted files can be detected in transit with a network intrusion detection or data loss prevention system analyzing file headers.

.003 Archive via Custom Method

Monitor newly constructed files being written with extensions and/or headers associated with compressed or encrypted file types. Detection efforts may focus on follow-on exfiltration activity, where compressed or encrypted files can be detected in transit with a network intrusion detection or data loss prevention system analyzing file headers.

Enterprise T1547 Boot or Logon Autostart Execution

Monitor for newly constructed files 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.

.006 Kernel Modules and Extensions

Monitor for newly constructed files that may modify the kernel to automatically execute programs on system boot.

.008 LSASS Driver

Monitor newly constructed files that may modify or add LSASS drivers to obtain persistence on compromised systems.

.009 Shortcut Modification

Monitor for LNK files created with a Zone Identifier value greater than 1, which may indicate that the LNK file originated from outside of the network.[8] Analysis should attempt to relate shortcut creation events to other potentially suspicious events based on known adversary behavior such as process launches of unknown executables that make network connections.

.010 Port Monitors

Monitor newly constructed files that may use port monitors to run an attacker supplied DLL during system boot for persistence or privilege escalation.

.012 Print Processors

Monitor for newly constructed files that may abuse print processors to run malicious DLLs during system boot for persistence and/or privilege escalation.

.013 XDG Autostart Entries

Malicious XDG autostart entries may be detected by auditing file creation events within the /etc/xdg/autostart and ~/.config/autostart directories. Depending on individual configurations, defenders may need to query the environment variables $XDG_CONFIG_HOME or $XDG_CONFIG_DIRS to determine the paths of Autostart entries. Autostart entry files not associated with legitimate packages may be considered suspicious. Suspicious entries can also be identified by comparing entries to a trusted system baseline.

.015 Login Items

All login items created via shared file lists are viewable by using the System Preferences GUI or in the ~/Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm file.[9][10][11][12] These locations should be monitored and audited.

Enterprise T1037 Boot or Logon Initialization Scripts

Monitor for newly constructed files that may use scripts automatically executed at boot or logon initialization to establish persistence.

.002 Login Hook

Monitor for the creation of and/or changes to login hook files (/Library/Preferences/com.apple.loginwindow.plist), especially by unusual accounts outside of normal administration duties.

.003 Network Logon Script

Monitor for newly constructed files by unusual accounts outside of normal administration duties

.004 RC Scripts

Monitor for newly constructed /etc/rc.local files.

.005 Startup Items

Monitor for newly constructed files by unusual accounts outside of normal administration duties

Enterprise T1554 Compromise Host Software Binary

Monitor for newly constructed files that may modify client software binaries to establish persistent access to systems.

Enterprise T1659 Content Injection

Monitor for unexpected and abnormal file creations that may indicate malicious content injected through online network communications.

Analytic 1 - Detecting Malicious File Creation via Content Injection

(EventCode=11 OR source="/var/log/audit/audit.log" type="open")| where (file_type IN ("exe", "dll", "js", "vbs", "ps1", "sh", "php"))| where (process_path="C:\Users\\AppData\Local\Temp\" OR process_path="/tmp/" OR process_path="/var/tmp/")| eval risk_score=case( like(file_name, "%.exe"), 8, like(file_name, "%.js"), 9, like(file_name, "%.sh"), 7)| where risk_score >= 7| stats count by _time, host, user, file_name, process_path, risk_score

Enterprise T1543 Create or Modify System Process

Monitor for newly constructed files that may create or modify system-level processes to repeatedly execute malicious payloads as part of persistence.

.001 Launch Agent

Monitor for newly constructed files that may create or modify launch agents to repeatedly execute malicious payloads as part of persistence.

.002 Systemd Service

Systemd service unit files may be detected by auditing file creation and modification events within the /etc/systemd/system, /usr/lib/systemd/system/, and /home/$username/.config/systemd/user/ directories, as well as associated symbolic links. Systemd generators may be placed in system-wide directories such as /run/systemd/system-generators/, /etc/systemd/system-generators or user-specific directories such as /run/systemd/user-generators/.

.004 Launch Daemon

Monitor for new files added to the /Library/LaunchDaemons/ folder. The System LaunchDaemons are protected by SIP.

Enterprise T1486 Data Encrypted for Impact

Monitor for newly constructed files in user directories.

Enterprise T1565 Data Manipulation

Monitor for newly constructed files in order to manipulate external outcomes or hide activity

.001 Stored Data Manipulation

Monitor for newly constructed files in order to manipulate external outcomes or hide activity

.003 Runtime Data Manipulation

Monitor for newly constructed files in order to manipulate external outcomes or hide activity

Enterprise T1074 Data Staged

Monitor publicly writeable directories, central locations, and commonly used staging directories (recycle bin, temp folders, etc.) to regularly check for compressed or encrypted data that may be indicative of staging.

.001 Local Data Staging

Monitor publicly writeable directories, central locations, and commonly used staging directories (recycle bin, temp folders, etc.) to regularly check for compressed or encrypted data that may be indicative of staging.

.002 Remote Data Staging

Monitor publicly writeable directories, central locations, and commonly used staging directories (recycle bin, temp folders, etc.) to regularly check for compressed or encrypted data that may be indicative of staging.

Enterprise T1491 Defacement

Monitor for newly constructed visual content for internal or external enterprise networks.

.001 Internal Defacement

Monitor for newly constructed files that may deface systems internal to an organization in an attempt to intimidate or mislead users.

.002 External Defacement

Monitor for newly constructed files that may deface systems external to an organization in an attempt to deliver messaging, intimidate, or otherwise mislead an organization or users.

Enterprise T1006 Direct Volume Access

Monitor for the creation of volume shadow copy and backup files, especially unexpected and irregular activity (relative to time, user, etc.).

Enterprise T1189 Drive-by Compromise

Monitor for newly constructed files written to disk to gain access to a system through a user visiting a website over the normal course of browsing. Detect browser process dropping files in suspicious locations (AppData, Temp, /tmp, /var/tmp). Identify exploit payloads (DLLs, JavaScript, shell scripts) written by the browser process.

(sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=11 Image="C:\Program Files\Mozilla Firefox\firefox.exe" OR Image="C:\Program Files\Google\Chrome\Application\chrome.exe")OR (sourcetype="/var/log/audit/audit.log" SYSCALL="open" path="/tmp/%" process="firefox" OR process="chrome")| eval risk_score = case( like(path, "%\Temp\%"), 5, like(path, "%AppData%"), 4, like(path, "%/var/tmp%"), 6)| where risk_score >= 5| table _time, host, process, path, risk_score

ICS T0817 Drive-by Compromise

Monitor for newly constructed files written to disk through a user visiting a website over the normal course of browsing.

Enterprise T1667 Email Bombing

Monitor for - Attachment creation events with excessive or repetitive file creation- Unusual file size from email messages (e.g., base64-encoded attachments dumped locally)- Burst of .eml, .msg, .tmp file extensions in mail client folders

Analytic 1 - Email file creations

EventCode=11 (file_name=".eml" OR file_name=".msg" OR file_name="*.tmp")| stats count avg(file_size) max(file_size) by user, file_path, process_name, _time| where count > 100 OR max(file_size) > 1000000| table _time, user, process_name, file_path, file_name, count, max(file_size)

Enterprise T1546 Event Triggered Execution

Monitor newly constructed files that may establish persistence and/or elevate privileges using system mechanisms that trigger execution based on specific events.

.002 Screensaver

Monitor newly constructed files that may establish persistence by executing malicious content triggered by user inactivity.

Analytic 1 - Created on disk that are being used as Screensaver files

(sourcetype=WinEventLog:Microsoft-Windows-Sysmon/Operational EventCode="11") TargetObject="*\Software\Policies\Microsoft\Windows\Control Panel\Desktop\SCRNSAVE.EXE"

.003 Windows Management Instrumentation Event Subscription

Monitor for MOF files outside of the HKLM\SOFTWARE\Microsoft\WBEM folder, as almost all legitimate MOF files will be stored in the WBEM folder.[13] Adversaries may create modified MOF files to be complied into WMI event subscriptions.

.004 Unix Shell Configuration Modification

Monitor for newly constructed files that may establish persistence through executing malicious commands triggered by a user’s shell. For most Linux and macOS systems, a list of file paths for valid shell options available on a system are located in the /etc/shells file.

.005 Trap

Monitor for newly constructed files that may establish persistence by executing malicious content triggered by an interrupt signal.

.008 Accessibility Features

Monitor newly constructed files that may establish persistence and/or elevate privileges by executing malicious content triggered by accessibility features.

.013 PowerShell Profile

Locations where profile.ps1 can be stored should be monitored for new profiles. [14] Example profile locations include:* $PsHome\Profile.ps1* $PsHome\Microsoft.{HostProgram}_profile.ps1* $Home\My Documents\PowerShell\Profile.ps1* $Home\My Documents\PowerShell\Microsoft.{HostProgram}_profile.ps1

.014 Emond

Monitor emond rules creation by checking for files created in /etc/emond.d/rules/ and /private/var/db/emondClients.

.016 Installer Packages

Monitor creation of files associated with installer packages that may be abused for malicious execution.

Enterprise T1480 .002 Execution Guardrails: Mutual Exclusion

Monitor for the suspicious creation of lock files – for example, in shared memory directories such as /var/run.[15]

Enterprise T1187 Forced Authentication

Monitor for newly constructed .LNK, .SCF, or any other files on systems and within virtual environments that contain resources that point to external network resources.

Analytic 1 - Creation of suspicious files in locations used for forced authentication attacks.

(index=security sourcetype="WinEventLog:Security" EventCode=4663) OR (index=sysmon sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=11) | where match(ObjectName, "(?i)\(.*\.)?(lnk|scf|url|doc|dot|xls|ppt|pdf|html)$")| where match(ObjectName, "(?i)(desktop|public|downloads|temp|cache|start menu|startup)")

Enterprise T1564 Hide Artifacts

Monitor for newly constructed files 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 "."

.006 Run Virtual Instance

Monitor for newly constructed files associated with running a virtual instance, such as binary files associated with common virtualization technologies (ex: VirtualBox, VMware, QEMU, Hyper-V). On ESXi servers, this includes new .vmx files in the /vmfs/volumes/ directory.

.009 Resource Forking

Monitor for newly constructed files that may abuse resource forks to hide malicious code or executables to evade detection and bypass security applications.

.012 File/Path Exclusions

Monitor for newly constructed files, especially those that are unexpectedly created in folders associated with or spoofing that of trusted applications. Also, consider prioritizing monitoring and analyzing file activity in known file/path exclusions.

.013 Bind Mounts

Monitor for the creation of PID directories under /proc with unusual characteristics. For example, these directories should typically be read-only; the creation of a directory with write permissions may indicate unusual activity.[16]

Enterprise T1574 Hijack Execution Flow

Monitor for newly constructed files that may execute their own malicious payloads by hijacking the way operating systems run programs.

.001 DLL

Monitor newly constructed .manifest and .local redirection files that do not correlate with software updates. Monitor for the creation of phantom DLL files.

.004 Dylib Hijacking

Monitor for newly constructed dylibs

.005 Executable Installer File Permissions Weakness

Monitor for newly constructed files to match an existing service executable, it could be detected and correlated with other suspicious behavior.

.006 Dynamic Linker Hijacking

Monitor for newly constructed files that are added to absolute paths of shared libraries such as LD_PRELOAD on Linux (such as /etc/ld.so.preload) and DYLD_INSERT_LIBRARIES on macOS.

.007 Path Interception by PATH Environment Variable

Monitor for newly constructed files for files named after partial directories and in locations that may be searched for common processes through the environment variable, or otherwise should not be user writable. Also, monitor file creation for programs that are named after Windows system programs or programs commonly executed without a path (such as "findstr," "net," and "python"). If this activity occurs outside of known administration activity, upgrades, installations, or patches, then it may be suspicious.

.008 Path Interception by Search Order Hijacking

Monitor file creation for files named after partial directories and in locations that may be searched for common processes through the environment variable, or otherwise should not be user writable. Also, monitor file creation for programs that are named after Windows system programs or programs commonly executed without a path (such as "findstr," "net," and "python"). If this activity occurs outside of known administration activity, upgrades, installations, or patches, then it may be suspicious.

.009 Path Interception by Unquoted Path

Monitor file creation for files named after partial directories and in locations that may be searched for common processes through the environment variable, or otherwise should not be user writable. Also, monitor file creation for programs that are named after Windows system programs or programs commonly executed without a path (such as "findstr," "net," and "python"). If this activity occurs outside of known administration activity, upgrades, installations, or patches, then it may be suspicious.

.010 Services File Permissions Weakness

Monitor for creation of binaries and service executables that do not occur during a regular software update or an update scheduled by the organization. This behavior also considers files that are overwritten.

.014 AppDomainManager

Monitor for newly constructed files, especially unknown .NET assemblies and configuration files in user writable folder paths.

Enterprise T1105 Ingress Tool Transfer

Monitor for file creation and files transferred into the network.

Enterprise T1056 Input Capture

Monitor for newly constructed files that are added to absolute paths of shared libraries such as LD_PRELOAD on Linux (such as /etc/ld.so.preload) and DYLD_INSERT_LIBRARIES on macOS.

.004 Credential API Hooking

Monitor for newly constructed files that are added to absolute paths of shared libraries such as LD_PRELOAD on Linux (such as /etc/ld.so.preload) and DYLD_INSERT_LIBRARIES on macOS.

Enterprise T1570 Lateral Tool Transfer

Monitor newly constructed files to/from a lateral tool transfer

ICS T0867 Lateral Tool Transfer

Monitor for file creation in conjunction with other techniques (e.g., file transfers using Remote Services).

Enterprise T1036 .007 Masquerading: Double File Extension

Monitor for files written to disk that contain two file extensions, particularly when the second is an executable.

Enterprise T1556 Modify Authentication Process

Monitor for suspicious additions to the /Library/Security/SecurityAgentPlugins directory.[17]

Monitor for newly created files that may be used to register malicious network provider dynamic link libraries (DLLs).

Analytic 1 - Unauthorized file creation in critical directories.

index=security sourcetype IN ("WinEventLog:Security", "wineventlog:sysmon", "linux_audit", "macos_secure")(EventCode=4663 OR EventCode=11 OR EventCode=13 OR (sourcetype="linux_audit" AND (syscall="creat" OR syscall="open" OR syscall="openat")) OR (sourcetype="macos_secure" AND action="file_write"))| eval TargetFile=coalesce(ObjectName, FileName, target_file)| search TargetFile IN ( "C:\Windows\System32\config\SAM", "C:\Windows\System32\config\system", "C:\Windows\System32\config\security", "C:\Windows\System32\lsass.exe", "/etc/passwd", "/etc/shadow", "/etc/pam.d/", "/Library/Preferences/com.apple.loginwindow.plist")

.002 Password Filter DLL

Monitor for newly constructed files that may register malicious password filter dynamic link libraries (DLLs) into the authentication process to acquire user credentials as they are validated.

Analytic 1 - Unauthorized DLL registration.

index=windows_logs sourcetype="WinEventLog:Security" OR sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational"| search (EventCode=4688 AND (CommandLine="regsvr32" OR CommandLine="rundll32") AND CommandLine="password.dll")| join type=left Host [ search index=windows_logs sourcetype="WinEventLog:System" | eval File_Creation_Time=strftime(_time, "%Y-%m-%d %H:%M:%S") | where EventCode=7045 OR EventCode=2 | fields Host, File_Creation_Time, FileName, FilePath ]| eval suspected_dll=if(match(FilePath, ".\System32\.") OR match(FilePath, ".\SysWOW64\."), "High", "Low")

.008 Network Provider DLL

Monitor for newly created files that may be used to register malicious network provider dynamic link libraries (DLLs).

Enterprise T1027 Obfuscated Files or Information

Detection of file obfuscation is difficult unless artifacts are left behind by the obfuscation process that are uniquely detectable with a signature. If detection of the obfuscation itself is not possible, it may be possible to detect the malicious activity that caused the obfuscated file (for example, the method that was used to write, read, or modify the file on the file system).

.004 Compile After Delivery

Monitor for newly constructed files for payloads

.006 HTML Smuggling

Monitor for newly constructed files via JavaScript, developing rules for the different variants, with a combination of different encoding and/or encryption schemes, may be very challenging. Consider monitoring files downloaded from the Internet, possibly by HTML Smuggling, for suspicious activities. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities.

.009 Embedded Payloads

Monitor for newly constructed files containing large amounts of data. Abnormal file sizes may be an indicator of embedded content.

.012 LNK Icon Smuggling

Monitor for downloaded malicious files, though developing rules for the different variants, with a combination of different encoding and/or encryption schemes, may be very challenging. Consider monitoring files downloaded from the Internet, possibly by LNK Icon Smuggling, for suspicious activities. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities.

.013 Encrypted/Encoded File

Monitor for files with large entropy which don’t match what is normal/expected given the file type and location.

.014 Polymorphic Code

Monitor for files with large entropy which don’t match what is normal/expected given the file type and location.

.015 Compression

Monitor for files with large entropy which don’t match what is normal/expected given the file type and location.

.017 SVG Smuggling

Monitor for newly constructed files via JavaScript. Developing rules for the different variants, with a combination of different encoding and/or encryption schemes, may be very challenging. Consider monitoring files downloaded from the Internet, possibly by SVG Smuggling, for suspicious activities. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities.

SVG Smuggling is often chained:

  • .svg downloaded → parsed or executed by browser/email client
  • Drops or references a secondary payload (HTML/JS/Payload)
  • Follow-on execution with powershell, cmd, wscript, etc.

Analytic 1 - Detect malicious use of SVG files embedded with script tags to assemble, download, or redirect to payloads.

index= (sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" OR sourcetype="linux_audit" OR sourcetype="osquery")(file_name=".svg" OR file_path="\Downloads\.svg" OR file_path="/tmp/.svg" OR file_path="/Users//Downloads/.svg")| join type=inner file_path [ search index= process_name IN ("powershell.exe", "wscript.exe", "cmd.exe", "mshta.exe", "bash", "curl", "wget") | stats min(_time) as proc_time by file_path, process_name, host]| eval time_diff=proc_time - _time| where time_diff >= 0 AND time_diff < 120| table _time, host, user, file_path, file_name, process_name, command_line, time_diff| sort _time

Analytic 2 - Suspicious JavaScript or Obfuscation in SVG

file_name=".svg"| rex field=_raw ""| search js_payload="eval" OR js_payload="atob" OR js_payload="window.location" OR js_payload="document.write"| table _time, file_name, js_payload

Enterprise T1137 Office Application Startup

Monitor for newly constructed files that may leverage Microsoft Office-based applications for persistence between startups.

.001 Office Template Macros

Monitor for newly constructed files that may abuse Microsoft Office templates to obtain persistence on a compromised system.

.002 Office Test

Monitor for newly constructed files that may abuse the Microsoft Office "Office Test" Registry key to obtain persistence on a compromised system.

.006 Add-ins

Monitor for newly constructed files that may abuse Microsoft Office add-ins to obtain persistence on a compromised system.

Enterprise T1003 OS Credential Dumping

Monitor for the unexpected creation of memory dump files for processes that may contain credentials.

Analytic 1 - Unexpected memory dump file creation.

(index=security sourcetype="WinEventLog:Security" EventCode=4663 ObjectName IN ("lsass.dmp", "\config\SAM", "\ntds.dit", "\policy\secrets", "\cache"))OR (index=security sourcetype="linux_secure" (key="path" value IN ("/etc/passwd", "/etc/shadow")))OR (index=security sourcetype="macOS:UnifiedLog" message IN ("/var/db/shadow/hash/*", "/private/etc/master.passwd"))

.001 LSASS Memory

Monitor for the unexpected creation of memory dump files for the LSASS process (e.g., lsass{*}.dmp).

Analytic 1 - Unexpected creation of LSASS dump files.

index=security sourcetype="WinEventLog:Security" EventCode=4663 ObjectName="\lsass.dmp" | where ProcessName IN ("procdump.exe", "rundll32.exe", "taskmgr.exe", "powershell.exe", "wmic.exe", "schtasks.exe", "cmd.exe", "comsvcs.dll")

.002 Security Account Manager

Monitor newly constructed files being written with default names that have extracted credentials from the Security Account Manager.

Analytic 1 - Creation of files with extracted SAM credentials.

index=security sourcetype="WinEventLog:Security" EventCode=4663 ObjectName IN ("\config\SAM", "\config\system", "\config\security", "\system32\config\sam", "\system32\config\system", "\system32\config\security") | where ProcessName IN ("reg.exe", "powershell.exe", "wmic.exe", "schtasks.exe", "cmd.exe", "rundll32.exe", "mimikatz.exe", "procdump.exe")

Enterprise T1566 Phishing

Monitor for creation of suspicious email attachments in download directories, execution of phishing attachments (e.g., .docm, .lnk, .hta, .vbs), or files extracted from .zip, .rar, .iso containers that execute scripts.

Analytic 1 - Detecting Malicious File Creation from Phishing Emails

(EventCode=11 OR EventCode=1116)OR (source="/var/log/audit/audit.log" SYSCALL="open" path IN ("/home/user/Downloads", "C:\Users\Public\Downloads"))| eval risk_score=case( like(path, "%.vbs"), 8, like(path, "%.lnk"), 7, like(path, "%.exe"), 6)| where risk_score >= 6| stats count by _time, host, path, user, risk_score

.001 Spearphishing Attachment

Monitor for newly constructed files from a spearphishing emails with a malicious attachment in an attempt to gain access to victim systems.

Analytic 1 - Detecting Malicious Email Attachments Creating Files

(EventCode=11 OR source="/var/log/audit/audit.log" type="open")| where (file_type IN ("exe", "vbs", "js", "docm", "lnk"))| where (process_path="C:\Users\\Downloads\" OR process_path="/home//Downloads/")| eval risk_score=case( like(file_name, "%.exe"), 8, like(file_name, "%.js"), 9, like(file_name, "%.vbs"), 7)| where risk_score >= 7| stats count by _time, host, user, file_name, process_path, risk_score

Enterprise T1542 Pre-OS Boot

On UEFI boot systems, monitor for newly created files in the ESP.

.003 Bootkit

On UEFI boot systems, monitor for newly created files in the ESP.

Enterprise T1219 .001 Remote Access Tools: IDE Tunneling

Monitor for the creation of the file code_tunnel.json within the .vscode-cli directory in a user's home profile (~/.vscode-cli/code_tunnel.json on Linux/macOS or %UserProfile%\.vscode-cli\code_tunnel.json on Windows), which signals a Visual Studio Code tunnel has been established.[18]

Analytic 1 - Monitor for active or persistent VS Code Tunnel

sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=11(file_path="\.vscode-cli\code_tunnel.json" OR file_path="/.vscode-cli/code_tunnel.json")| stats min(_time) as creation_time by host, user, file_path| sort creation_time

Enterprise T1091 Replication Through Removable Media

Monitor for newly constructed files on removable media

Analytic 1 - File creation events on removable media

index=windows sourcetype="WinEventLog:Security" EventID=4663Accesses="WriteData (or AddFile)" AND ObjectType="File"| stats count by ObjectName, Account_Name, ProcessName, ComputerName, _time| where match(ObjectName, ".:\\RemovableMedia\\.") OR match(ObjectName, ".:\\USB.")| table _time, ObjectName, Account_Name, ProcessName, ComputerName

ICS T0847 Replication Through Removable Media

Monitor for newly constructed files copied to or from removable media.

Enterprise T1496 Resource Hijacking

Monitor for common cryptomining or proxyware files on local systems that may indicate compromise and resource usage.

.001 Compute Hijacking

Monitor for common cryptomining files on local systems that may indicate compromise and resource usage.

.002 Bandwidth Hijacking

Monitor for common proxyware files on local systems that may indicate compromise and resource usage.

Enterprise T1053 Scheduled Task/Job

Monitor newly constructed files that may abuse task scheduling functionality to facilitate initial or recurring execution of malicious code.

Analytic 1 - Look for new task files with unusual parameters.

index=security_logs OR index=system_logs(sourcetype="docker_events" OR sourcetype="kubernetes_events" OR sourcetype="wineventlog:security" OR sourcetype="linux_secure" OR sourcetype="syslog" OR sourcetype="file_monitoring")| eval platform=case( sourcetype=="docker_events" OR sourcetype=="kubernetes_events", "Containers", sourcetype=="wineventlog:security", "Windows", sourcetype=="linux_secure" OR sourcetype=="syslog", "Linux", sourcetype=="mac_os_events", "macOS")| search ( (platform="Containers" AND (event_type="file_create" AND (file_path="/etc/cron.d/" OR file_path="/etc/systemd/system/"))) OR (platform="Windows" AND EventCode=4663 AND (ObjectName="C:\Windows\System32\Tasks\" OR ObjectName="C:\Windows\Tasks\")) OR (platform="Linux" AND (file_path="/etc/cron.d/" OR file_path="/etc/systemd/system/")) OR (platform="macOS" AND (file_path="/Library/LaunchDaemons/" OR file_path="/Library/LaunchAgents/")))

.005 Scheduled Task

Monitor Windows Task Scheduler stores in %systemroot%\System32\Tasks for change entries related to scheduled tasks that do not correlate with known software, patch cycles, etc. In order to gain persistence, privilege escalation, or remote execution, an adversary may use the Windows Task Scheduler to schedule a command to be run at a specified time, date, and even host. Task Scheduler stores tasks as files in two locations - C:\Windows\Tasks (legacy) or C:\Windows\System32\Tasks. Accordingly, this analytic looks for the creation of task files in these two locations.

Analytic 1 - Look for new task files in %systemroot%\System32\Tasks.

((source="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode="11") OR (sourcetype=WinEventLog:Security EventCode=4663)) (TargetFilename= "C:\Windows\System32\Tasks\" OR TargetFilename "C:\Windows\Tasks\*") AND Image!= "C:\WINDOWS\system32\svchost.exe"

.007 Container Orchestration Job

Monitor for newly constructed files by using the logging agents on Kubernetes nodes and retrieve logs from sidecar proxies for application and resource pods to monitor malicious container orchestration job deployments.

Note: This query monitors for .yaml configuration files that are used to define jobs and container behaviors within Kubernetes. Changes or creations of these files should be closely watched.

Analytic 1 - Look for new file creation events with unusual parameters.

sourcetype=kubernetes:file_creation file_path="/etc/kubernetes/manifests/*.yaml"

Enterprise T1505 Server Software Component

Consider monitoring file locations associated with the installation of new application software components such as paths from which applications typically load such extensible components.

.002 Transport Agent

Consider monitoring file locations associated with the installation of new application software components such as paths from which applications typically load such extensible components.

.003 Web Shell

File monitoring may be used to detect changes to files in the Web directory of a Web server that do not match with updates to the Web server's content and may indicate implantation of a Web shell script.[19]

.004 IIS Components

Monitor for creation of files (especially DLLs on webservers) that could be abused as malicious ISAPI extensions/filters or IIS modules.

Enterprise T1176 Software Extensions

Monitor for newly constructed files in directories associated with software extensions. Ensure all listed files are in alignment with approved extensions

.001 Browser Extensions

Monitor for - Newly written .crx, .xpi, or .mobileconfig files- Modified .plist files under /Library/Managed Preferences// (macOS)- Creation of extensions under: - Chrome: AppData\Local\Google\Chrome\User Data\Default\Extensions - Firefox: %APPDATA%\Mozilla\Firefox\Profiles*.default\extensions

Analytic 1 - Detect newly written config files

sourcetype=WinEventLog:Sysmon EventCode=11(TargetFilename="\Extensions\" OR TargetFilename=".crx" OR TargetFilename=".xpi" OR TargetFilename="*.mobileconfig")| stats count by TargetFilename, Image, User, Computer, _time| sort -_time

ICS T0865 Spearphishing Attachment

Monitor for newly constructed files from a spearphishing emails with a malicious attachment in an attempt to gain access to victim systems.

Enterprise T1553 .005 Subvert Trust Controls: Mark-of-the-Web Bypass

Monitor compressed/archive and image files downloaded from the Internet as the contents may not be tagged with the MOTW. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities.

Enterprise T1218 System Binary Proxy Execution

Monitor for file activity (creations, downloads, modifications, etc.), especially for file types that are not typical within an environment and may be indicative of adversary activity.

.001 Compiled HTML File

Monitor presence and use of CHM files, especially if they are not typically used within an environment.

.002 Control Panel

Monitor for newly constructed files that may forge web cookies that can be used to gain access to web applications or Internet services.

.005 Mshta

Monitor use of HTA files. If they are not typically used within an environment then execution of them may be suspicious

.014 MMC

Monitor for creation and use of .msc files. MMC may legitimately be used to call Microsoft-created .msc files, such as services.msc or eventvwr.msc. Invoking non-Microsoft .msc files may be an indicator of malicious activity.

Enterprise T1080 Taint Shared Content

Monitor for newly constructed files from files that write or overwrite many files to a network shared directory may be suspicious. Monitor for the creation of hidden files and directories that may be used to conceal malicious files or scripts on shared network locations.

sourcetype="WinEventLog:Security" EventCode=4663 OR sourcetype="linux:audit" syscall IN ("creat", "open")| search ObjectType="File" AccessMask="0x2" // 0x2 indicates write access| stats count by ObjectName, AccountName, ProcessName, SourceIPAddress, _time| eval suspicious=if(match(ObjectName, "\.exe$|\.lnk$|\.scr$|\.bat$|\.vbs$") AND AccountName!="known_admin_user", "suspicious", "normal")

Enterprise T1204 User Execution

Anti-virus can potentially detect malicious documents and files that are downloaded and executed on the user's computer. Endpoint sensing or network sensing can potentially detect malicious events once the file is opened (such as a Microsoft Word document or PDF reaching out to the internet or spawning powershell.exe).

.001 Malicious Link

Monitor for files created on a system after a user clicks on a malicious link. Look for common download paths and suspicious files with executable extensions.

Analytic 1 - Files downloaded from links and then executed.

sourcetype=Sysmon EventCode=11| search file_path IN ("/Downloads/", "/Temp/")| stats count by file_name file_path user| where file_name LIKE "%.exe" OR file_name LIKE "%.zip" OR file_name LIKE "%.js" OR file_name LIKE "%.docm"

.002 Malicious File

Monitor for files created in unusual directories or files with suspicious extensions. Focus on common locations like the Downloads folder, Temp directories, or the user’s Desktop, especially files that would be of interest from spearphishing attachments.

While batch files are not inherently malicious, it is uncommon to see them created after OS installation, especially in the Windows directory. This analytic looks for the suspicious activity of a batch file being created within the C:\Windows\System32 directory tree. There will be only occasional false positives due to administrator actions.

For MacOS, utilities that work in concert with Apple’s Endpoint Security Framework such as File Monitor can be used to track file creation events.

Analytic 1 - Batch File Write to System32

(sourcetype=WinEventLog:Microsoft-Windows-Sysmon/Operational EventCode="11") file_path="system32" AND file_extension=".bat"

Analytic 2 - New file creation in unusual directories.

sourcetype=WinEventLog:Microsoft-Windows-Sysmon/Operational EventCode=11| search file_path IN ("/Downloads/", "/Temp/", "/Desktop/")| stats count by file_name file_extension file_path user| where file_extension IN ("doc", "docx", "pdf", "xls", "rtf", "exe", "scr", "lnk", "pif", "cpl", "zip")

.004 Malicious Copy and Paste

Monitor for files created on a system after a user executes an unusual command. Look for common download paths and suspicious files with executable extensions.

File: File Deletion

Refers to events where files are removed from a system or storage device. These events can indicate legitimate housekeeping activities or malicious actions such as attackers attempting to cover their tracks. Monitoring file deletions helps organizations identify unauthorized or suspicious activities.

This data component can be collected through the following measures:

Windows

  • Sysmon: Event ID 23: Logs file deletion events, including details such as file paths and responsible processes.
  • Windows Event Log: Enable "Object Access" auditing to monitor file deletions.
  • PowerShell: Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4663} | Where-Object {$_.Message -like '*DELETE*'}

Linux

  • Auditd: Use audit rules to capture file deletion events: auditctl -a always,exit -F arch=b64 -S unlink -S rename -S rmdir -k file_deletion
  • Query logs: ausearch -k file_deletion
  • Inotify: Use inotifywait to monitor file deletions: inotifywait -m /path/to/watch -e delete

macOS

  • Endpoint Security Framework (ESF): Monitor events like ES_EVENT_TYPE_AUTH_UNLINK to capture file deletion activities.
  • FSEvents: Track file deletion activities in real-time: fs_usage | grep unlink

SIEM Integration

  • Forward file deletion logs to a SIEM for centralized monitoring and correlation with other events.

File: File Deletion

Refers to events where files are removed from a system or storage device. These events can indicate legitimate housekeeping activities or malicious actions such as attackers attempting to cover their tracks. Monitoring file deletions helps organizations identify unauthorized or suspicious activities.

This data component can be collected through the following measures:

Windows

  • Sysmon: Event ID 23: Logs file deletion events, including details such as file paths and responsible processes.
  • Windows Event Log: Enable "Object Access" auditing to monitor file deletions.
  • PowerShell: Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4663} | Where-Object {$_.Message -like '*DELETE*'}

Linux

  • Auditd: Use audit rules to capture file deletion events: auditctl -a always,exit -F arch=b64 -S unlink -S rename -S rmdir -k file_deletion
  • Query logs: ausearch -k file_deletion
  • Inotify: Use inotifywait to monitor file deletions: inotifywait -m /path/to/watch -e delete

macOS

  • Endpoint Security Framework (ESF): Monitor events like ES_EVENT_TYPE_AUTH_UNLINK to capture file deletion activities.
  • FSEvents: Track file deletion activities in real-time: fs_usage | grep unlink

SIEM Integration

  • Forward file deletion logs to a SIEM for centralized monitoring and correlation with other events.
Domain ID Name Detects
Enterprise T1554 Compromise Host Software Binary

Monitor for unexpected deletion of client software binaries to establish persistent access to systems.

Enterprise T1485 Data Destruction

Monitor for unexpected deletion to a file (ex: Sysmon EID 23)

ICS T0809 Data Destruction

Monitor for unexpected deletion of files.

Enterprise T1565 Data Manipulation

Monitor for unexpected deletion of a file in order to manipulate external outcomes or hide activity

.001 Stored Data Manipulation

Monitor for unexpected deletion of a file in order to manipulate external outcomes or hide activity

.003 Runtime Data Manipulation

Monitor for unexpected deletion of a file in order to manipulate external outcomes or hide activity

Enterprise T1562 Impair Defenses

Monitor for missing log files hosts and services with known active periods.

.012 Disable or Modify Linux Audit System

Monitor for missing log files from machines with known active periods.

Enterprise T1070 Indicator Removal

Monitor for a file 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 for unexpected deletion of Windows event logs (via native binaries) and may also generate an alterable event (Event ID 1102: "The audit log was cleared"). When an eventlog is cleared, a new event is created that alerts that the eventlog was cleared. For Security logs, its event code 1100 and 1102. For System logs, it is event code 104.

It is unlikely that event log data would be cleared during normal operations, and it is likely that malicious attackers may try to cover their tracks by clearing an event log. When an event log gets cleared, it is suspicious.

  1. This is often done using wevtutil, a legitimate tool provided by Microsoft. This action interferes with event collection and notification, and may lead to a security event going undetected, thereby potentially leading to further compromise of the network.

  2. Alerting when a Clear Event Log is generated could point to this intruder technique. Centrally collecting events has the added benefit of making it much harder for attackers to cover their tracks. Event Forwarding permits sources to forward multiple copies of a collected event to multiple collectors, thus enabling redundant event collection. Using a redundant event collection model can minimize the single point of failure risk.

  3. Attackers may set the option of the sources of events with Limit-EventLog -LogName Security -OverflowAction DoNotOverwrite to not delete old Evenlog when the .evtx is full. By default the Security Log size is configured with the minimum value of 20 480KB (~23 000 EventLog). So if this option is enabled, all the new EventLogs will be automatically deleted. We can detect this behavior with the Security EventLog 1104.

  4. Attackers may delete .evtx with del C:\Windows\System32\winevt\logs\Security.evtx or Remove-Item C:\Windows\System32\winevt\logs\Security.evtx after having disabled and stopped the Eventlog service. As the EventLog service is disabled and stopped, the .evtx files are no longer used by this service and can be deleted. The new EventLog will be Unavailable until the configuration is reset.

  5. Attackers may use the powershell command Remove-EventLog -LogName Security to unregister source of events that are part of Windows (Application, Security…). This command deletes the security EventLog (which also generates EventId 1102) but the new Eventlogs are still recorded until the system is rebooted . After the System is rebooted, the Security log is unregistered and doesn’t log any new Eventlog. However logs generated between the command and the reboot are still available in the .evtx file.

Analytic 1 - User Activity from Clearing Event Logs

(source="WinEventLog:Security" EventCode IN (1100, 1102, 1104)) OR (source="WinEventLog:System" EventCode IN (104))

.002 Clear Linux or Mac System Logs

Monitor for unexpected deletion of a system log file, typically stored in /var/logs or /Library/Logs.

.003 Clear Command History

Monitor for unexpected deletion of a command history file, such as ConsoleHost_history.txt, ~/.zsh_history, ~/.bash_history, or /var/log/shell.log.

Analytic 1 - Deletion of command history files

(source="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode="23") OR (source="WinEventLog:Security" EventCode="4663") FilePath LIKE '%ConsoleHost_history.txt%' AND ObjectType == "File" AND (UserAccessList LIKE '%1537%' OR UserAccessList LIKE '%DELETE%'))

.004 File Deletion

Monitor for unexpected deletion of files from the system

.008 Clear Mailbox Data

Monitor for deletion of generated artifacts on a host system, including logs or captured files such as quarantined emails.

On Windows 10, mail application data is stored in C:\Users\Username\AppData\Local\Comms\Unistore\data. On Linux, mail data is stored in /var/spool/mail or /var/mail. On macOS, mail data is stored in ~/Library/Mail.

.009 Clear Persistence

Monitor for a file that may delete or alter generated artifacts associated with persistence on a host system.

ICS T0872 Indicator Removal on Host

Monitor for a file that may delete or alter generated artifacts on a host system, including logs or captured files such as quarantined malware.

Enterprise T1490 Inhibit System Recovery

The Windows event logs, ex. Event ID 524 indicating a system catalog was deleted, may contain entries associated with suspicious activity.

File: File Metadata

contextual information about a file, including attributes such as the file's name, size, type, content (e.g., signatures, headers, media), user/owner, permissions, timestamps, and other related properties. File metadata provides insights into a file's characteristics and can be used to detect malicious activity, unauthorized modifications, or other anomalies. Examples:

  • File Ownership and Permissions: Checking the owner and permissions of a critical configuration file like /etc/passwd on Linux or C:\Windows\System32\config\SAM on Windows.
  • Timestamps: Analyzing the creation, modification, and access timestamps of a file.
  • File Content and Signatures: Extracting the headers of an executable file to verify its signature or detect packing/obfuscation.
  • File Attributes: Analyzing attributes like hidden, system, or read-only flags in Windows.
  • File Hashes: Generating MD5, SHA-1, or SHA-256 hashes of files to compare against threat intelligence feeds.
  • File Location: Monitoring files located in unusual directories or paths, such as temporary or user folders.

This data component can be collected through the following measures:

Windows

  • Sysinternals Tools: Use AccessEnum or PSFile to retrieve metadata about file access and permissions.
  • Windows Event Logs: Enable object access auditing and monitor events like 4663 (Object Access) and 5140 (A network share object was accessed).
  • PowerShell: Use Get-Item or Get-ChildItem cmdlets: Get-ChildItem -Path "C:\Path\To\Directory" -Recurse | Select-Object Name, Length, LastWriteTime, Attributes

Linux

  • File System Commands: Use ls -l or stat to retrieve file metadata: stat /path/to/file
  • Auditd: Configure audit rules to log metadata access: auditctl -w /path/to/file -p wa -k file_metadata
  • Filesystem Integrity Tools: Tools like tripwire or AIDE (Advanced Intrusion Detection Environment) can monitor file metadata changes.

macOS

  • FSEvents: Use FSEvents to track file metadata changes.
  • Endpoint Security Framework (ESF): Capture metadata-related events via ESF APIs.
  • Command-Line Tools: Use ls -l or xattr for file attributes: ls -l@ /path/to/file

SIEM Integration

  • Forward file metadata logs from endpoint or network devices to a SIEM for centralized analysis.

File: File Metadata

contextual information about a file, including attributes such as the file's name, size, type, content (e.g., signatures, headers, media), user/owner, permissions, timestamps, and other related properties. File metadata provides insights into a file's characteristics and can be used to detect malicious activity, unauthorized modifications, or other anomalies. Examples:

  • File Ownership and Permissions: Checking the owner and permissions of a critical configuration file like /etc/passwd on Linux or C:\Windows\System32\config\SAM on Windows.
  • Timestamps: Analyzing the creation, modification, and access timestamps of a file.
  • File Content and Signatures: Extracting the headers of an executable file to verify its signature or detect packing/obfuscation.
  • File Attributes: Analyzing attributes like hidden, system, or read-only flags in Windows.
  • File Hashes: Generating MD5, SHA-1, or SHA-256 hashes of files to compare against threat intelligence feeds.
  • File Location: Monitoring files located in unusual directories or paths, such as temporary or user folders.

This data component can be collected through the following measures:

Windows

  • Sysinternals Tools: Use AccessEnum or PSFile to retrieve metadata about file access and permissions.
  • Windows Event Logs: Enable object access auditing and monitor events like 4663 (Object Access) and 5140 (A network share object was accessed).
  • PowerShell: Use Get-Item or Get-ChildItem cmdlets: Get-ChildItem -Path "C:\Path\To\Directory" -Recurse | Select-Object Name, Length, LastWriteTime, Attributes

Linux

  • File System Commands: Use ls -l or stat to retrieve file metadata: stat /path/to/file
  • Auditd: Configure audit rules to log metadata access: auditctl -w /path/to/file -p wa -k file_metadata
  • Filesystem Integrity Tools: Tools like tripwire or AIDE (Advanced Intrusion Detection Environment) can monitor file metadata changes.

macOS

  • FSEvents: Use FSEvents to track file metadata changes.
  • Endpoint Security Framework (ESF): Capture metadata-related events via ESF APIs.
  • Command-Line Tools: Use ls -l or xattr for file attributes: ls -l@ /path/to/file

SIEM Integration

  • Forward file metadata logs from endpoint or network devices to a SIEM for centralized analysis.
Domain ID Name Detects
Enterprise T1548 Abuse Elevation Control Mechanism

Monitor the file system for files that have the setuid or setgid bits set. On Linux, auditd can alert every time a user's actual ID and effective ID are different (this is what happens when you sudo).

.001 Setuid and Setgid

Monitor the file system for files that have the setuid or setgid bits set.

Enterprise T1554 Compromise Host Software Binary

Collect and analyze signing certificate metadata and check signature validity on software that executes within the environment

Enterprise T1543 .003 Create or Modify System Process: Windows Service

Adversaries may modify the binary file for an existing service to achieve Persistence while potentially Defense Evasion. If a newly created or modified runs as a service, it may indicate APT activity. However, services are frequently installed by legitimate software. A well-tuned baseline is essential to differentiating between benign and malicious service modifications. Look for events where a file was created and then later run as a service. In these cases, a new service has been created or the binary has been modified. Many programs, such as msiexec.exe, do these behaviors legitimately and can be used to help validate legitimate service creations/modifications.

Enterprise T1565 Data Manipulation

Monitor for contextual data about a file, which may include information such as name, the content (ex: signature, headers, or data/media), user/owner, permissions, etc that would aid in the manipulation of data to hide activity

.003 Runtime Data Manipulation

Monitor for contextual data about a file, which may include information such as name, the content (ex: signature, headers, or data/media), user/owner, permissions, etc that would aid in the manipulation of data to hide activity

Enterprise T1546 Event Triggered Execution

Monitor for contextual data about a file, which may include information such as name, the content (ex: signature, headers, or data/media), user/owner, permissions, etc.

.006 LC_LOAD_DYLIB Addition

Changes to binaries that do not line up with application updates or patches are also extremely suspicious.

Enterprise T1222 File and Directory Permissions Modification

Monitor and investigate attempts to modify ACLs and file/directory ownership.

.001 Windows File and Directory Permissions Modification

Consider enabling file/directory permission change auditing on folders containing key binary/configuration files. For example, Windows Security Log events (Event ID 4670) are created when DACLs are modified.

Adversaries sometimes modify object access rights at the operating system level. There are varying motivations behind this action - they may not want some files/objects to be changed on systems for persistence reasons and therefore provide admin only rights; also, they may want files to be accessible with lower levels of permissions.

Windows environment logs can be noisy, so we take the following into consideration:

  • We need to exclude events generated by the local system (subject security ID "NT AUTHORITY\SYSTEM") and focus on actual user events.
  • When a permission modification is made for a folder, a new event log is generated for each subfolder and file under that folder. It is advised to group logs based on handle ID or user ID.
  • The Windows security log (event ID 4670) also includes information about the process that modifies the file permissions. It is advised to focus on uncommon process names, and it is also uncommon for real-users to perform this task without a GUI.
  • Pseudocode Event ID is for Windows Security Log (Event ID 4670 - Permissions on an object were changed).
  • Windows Event ID 4719 (An Attempt Was Made to Access An Object) can also be used to alert on changes to Active Directory audit policy for a system.

Analytic 1 - Access Permission Modification for Windows

(source="*WinEventLog:Security" EventCode IN (4670, 4719)) Object_Type="File" Security_ID!="NT AUTHORITY\SYSTEM"

.002 Linux and Mac File and Directory Permissions Modification

Monitor and investigate attempts to modify ACLs and file/directory ownership. Consider enabling file/directory permission change auditing on folders containing key binary/configuration files.

This looks for any invocations of chmod. Note that this is likely to be more noisy than the Windows-specific implementation, although Linux does not generate logs for system triggered activities like in Windows. In addition, it may be necessary to whitelist cron jobs that regularly run and execute chmod.

Linux environment logs can be more noisy than the Windows-specific implementation, although Linux does not generate logs for system triggered activities like in Windows. In addition, it may be necessary to whitelist cron jobs that regularly run and execute chmod.

Analytic 1 - Access Permission Modification for Linux

sourcetype=linux_logs CommandLine="chmod*"

Enterprise T1564 Hide Artifacts

Monitor for contextual data about a file, which may include information such as name, the content (ex: signature, headers, or data/media), user/owner, permissions that may attempt to hide artifacts associated with their behaviors to evade detection.

.001 Hidden Files and Directories

Monitor for contextual data about a file, which may include information such as name, the content (ex: signature, headers, or data/media), user/owner, permissions may set files and directories to be hidden to evade detection mechanisms.

.004 NTFS File Attributes

Monitor for contextual data about a file, which may include information such as name, the content (ex: signature, headers, or data/media), user/owner, permissions, may use NTFS file attributes to hide their malicious data in order to evade detection. Forensic techniques exist to identify information stored in NTFS EA. [20]

.007 VBA Stomping

If the document is opened with a Graphical User Interface (GUI) the malicious p-code is decompiled and may be viewed. However, if the PROJECT stream, which specifies the project properties, is modified in a specific way the decompiled VBA code will not be displayed. For example, adding a module name that is undefined to the PROJECT stream will inhibit attempts of reading the VBA source code through the GUI.[21]

.009 Resource Forking

Identify files with the com.apple.ResourceFork extended attribute and large data amounts stored in resource forks.

.014 Extended Attributes

Monitor for the presence of custom extended attributes not whitelisted based on developer workflows.

Enterprise T1070 Indicator Removal

Monitor for contextual file data that may show signs of deletion or alter generated artifacts on a host system, including logs or captured files such as quarantined malware.

.006 Timestomp

Monitor for modifications to file metadata. Compare the $STANDARD_INFORMATION and $FILE_NAME attributes in the Master File Table (MFT).[22] Additionally, look for nanoseconds in a timestamp matching "0000000". This often shows the use of an automated tool such as Metasploit.[22]

ICS T0872 Indicator Removal on Host

Monitor for contextual file data that may show signs of deletion or alter generated artifacts on a host system, including logs or captured files such as quarantined malware.

Enterprise T1570 Lateral Tool Transfer

Monitor for alike file hashes or characteristics (ex: filename) that are created on multiple hosts.

ICS T0867 Lateral Tool Transfer

Monitor for alike file hashes or characteristics (ex: filename) that are created on multiple hosts.

Enterprise T1036 Masquerading

Collect file hashes; file names that do not match their expected hash are suspect. Perform file monitoring; files with known names but in unusual locations are suspect. Look for indications of common characters that may indicate an attempt to trick users into misidentifying the file type, such as a space as the last character of a file name or the right-to-left override characters"\u202E", "[U+202E]", and "%E2%80%AE".

Check and ensure that file headers/signature and extensions match using magic bytes detection and/or file signature validation.[23] In Linux, the file command may be used to check the file signature.[24]

.001 Invalid Code Signature

Collect and analyze signing certificate metadata and check signature validity on software that executes within the environment, look for invalid signatures as well as unusual certificate characteristics and outliers.

.002 Right-to-Left Override

Monitor for common formats of RTLO characters within filenames such as \u202E, [U+202E], and %E2%80%AE. Defenders should also check their analysis tools to ensure they do not interpret the RTLO character and instead print the true name of the file containing it.

.003 Rename Legitimate Utilities

Collecting and comparing disk and resource filenames for binaries by looking to see if the InternalName, OriginalFilename, and/or ProductName match what is expected could provide useful leads, but may not always be indicative of malicious activity.

.005 Match Legitimate Resource Name or Location

Collect file hashes; file names that do not match their expected hash are suspect. Perform file monitoring; files with known names but in unusual locations are suspect. Likewise, files that are modified outside of an update or patch are suspect.

.006 Space after Filename

Monitor for spaces at the end of file names, that can easily be checked with file monitoring. From the user's perspective though, this is very hard to notice from within the Finder.app or on the command-line in Terminal.app. Processes executed from binaries containing non-standard extensions in the filename are suspicious.

.007 Double File Extension

Monitor for contextual data about a file, which may include information such as name, the content (ex: signature, headers, or data/media), user/owner, permissions, etc.

ICS T0849 Masquerading

Collect file hashes. Monitor for file names that do not match their expected hash. Perform file monitoring. Files with known names but in unusual locations are suspect. Look for indications of common characters that may indicate an attempt to trick users into misidentifying the file type, such as a space as the last character of a file name or the right-to-left override characters"\u202E", "[U+202E]", and "%E2%80%AE". For added context on adversary procedures and background see Masquerading Mitigation and applicable sub-techniques.

Enterprise T1027 Obfuscated Files or Information

Monitor for contextual data about a file, which may include information such as name, the content (ex: signature, headers, or data/media), user/owner, permissions, etc.

File-based signatures may be capable of detecting code obfuscation depending on the methods used.[25][26][27]

.001 Binary Padding

Depending on the method used to pad files, a file-based signature may be capable of detecting padding using a scanning or on-access based tool. When executed, the resulting process from padded files may also exhibit other behavior characteristics of being used to conduct an intrusion such as system and network information Discovery or Lateral Movement, which could be used as event indicators that point to the source file.

.002 Software Packing

Use file scanning to look for known software packers or artifacts of packing techniques. Packing is not a definitive indicator of malicious activity, because legitimate software may use packing techniques to reduce binary size or to protect proprietary code.

.003 Steganography

Detection of steganography is difficult unless artifacts are left behind by the obfuscation process that are detectable with a known signature. Look for strings or other signatures left in system artifacts related to decoding steganography.

.004 Compile After Delivery

Monitor for contextual data about a file, which may include information such as name, the content (ex: signature, headers, or data/media), user/owner, permissions, etc.

.007 Dynamic API Resolution

Depending on the method used to obfuscate API function calls, a file-based signature may be capable of detecting dynamical resolution.[25][26][27]

.008 Stripped Payloads

Detecting the presence of stripped payloads may be difficult and unwarranted in real-time, though analyzing contextual data about files (such as content and character entropy) may highlight attempts at obfuscation.

.009 Embedded Payloads

Monitor contextual data about a file that may highlight embedded payloads, which may include information such as name, the content (ex: signature, headers, or data/media), file size, etc.; correlate with other suspicious behavior to reduce false positives.

.010 Command Obfuscation

Scripts containing obfuscated content may have higher entropy of characters/strings.

.012 LNK Icon Smuggling

Monitor contextual data about a file that may highlight embedded malicious content, which may include information such as name, the content (ex: signature, headers, or data/media), file size, etc.; correlate with other suspicious behavior to reduce false positives.

.013 Encrypted/Encoded File

Monitor for and analyze files which contain content with large entropy, as this may indicate potentially malicious encrypted data.

.014 Polymorphic Code

Monitor for and analyze files which contain content with large entropy, as this may indicate potentially malicious compressed or encrypted data.

.015 Compression

Monitor data about archive files, such as the signatures and the filenames inside of ZIP archives. Files which contain content with large entropy may indicate potentially malicious compressed data.

.016 Junk Code Insertion

When executed, the resulting process from files containing dead code may exhibit other behavior characteristics of being used to conduct an intrusion such as system and network information Discovery or Lateral Movement, which could be used as event indicators that point to the source file.

Enterprise T1055 Process Injection

Monitor for contextual data about a file, which may include information such as name, the content (ex: signature, headers, or data/media), user/owner, permissions, etc.

.013 Process Doppelgänging

Scan file objects reported during the PsSetCreateProcessNotifyRoutine, [28] which triggers a callback whenever a process is created or deleted, specifically looking for file objects with enabled write access. [29] Also consider comparing file objects loaded in memory to the corresponding file on disk. [30]

Enterprise T1553 Subvert Trust Controls

Collect and analyze signing certificate metadata on software that executes within the environment to look for unusual certificate characteristics and outliers.

.001 Gatekeeper Bypass

Review false values under the LSFileQuarantineEnabled entry in an application's Info.plist file (required by every application). false under LSFileQuarantineEnabled indicates that an application does not use the quarantine flag. Unsandboxed applications with an unspecified LSFileQuarantineEnabled entry will default to not setting the quarantine flag.

QuarantineEvents is a SQLite database containing a list of all files assigned the com.apple.quarantine attribute, located at ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2. Each event contains the corresponding UUID, timestamp, application, Gatekeeper score, and decision if it was allowed. [31]

.002 Code Signing

Collect and analyze signing certificate metadata on software that executes within the environment to look for unusual certificate characteristics and outliers.

.005 Mark-of-the-Web Bypass

Monitor files (especially those downloaded from untrusted locations) for MOTW attributes. Also consider inspecting and scanning file formats commonly abused to bypass MOTW (ex: .arj, .gzip, .iso, .vhd).

Enterprise T1195 Supply Chain Compromise

Use verification of distributed binaries through hash checking or other integrity checking mechanisms. Scan downloads for malicious signatures and attempt to test software and updates prior to deployment while taking note of potential suspicious activity.

((sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=15) OR (sourcetype="WinEventLog:Security" EventCode=4663)) OR (source="/var/log/audit/audit.log" SYSCALL="open" path IN ("/bin", "/usr/bin", "/etc"))| eval risk_score=case( like(path, "%system32%"), 7, like(path, "%/usr/local/bin%"), 6, like(path, "%Program Files%"), 5)| where risk_score >= 5| stats count by host, user, path, process, risk_score| table _time, host, user, path, process, risk_score

.001 Compromise Software Dependencies and Development Tools

Use verification of distributed binaries through hash checking or other integrity checking mechanisms. Scan downloads for malicious signatures and attempt to test software and updates prior to deployment while taking note of potential suspicious activity.

(EventCode=15 OR EventCode=4663) OR (source="/var/log/audit/audit.log" SYSCALL="open" path IN ("/usr/bin/gcc", "/usr/bin/make", "/usr/local/bin/node", "/opt/build-tools/"))| eval risk_score=case( like(path, "%npm%"), 7, like(path, "%python%"), 6, like(path, "%gcc%"), 6, like(path, "%make%"), 5)| where risk_score >= 5| stats count by host, user, path, process, risk_score| table _time, host, user, path, process, risk_score

.002 Compromise Software Supply Chain

Use verification of distributed binaries through hash checking or other integrity checking mechanisms. Scan downloads for malicious signatures and attempt to test software and updates prior to deployment while taking note of potential suspicious activity.

ICS T0862 Supply Chain Compromise

Use verification of distributed binaries through hash checking or other integrity checking mechanisms. Scan downloads for malicious signatures.

Enterprise T1218 .011 System Binary Proxy Execution: Rundll32

Analyze contextual data about executed DLL files, which may include information such as name, the content (ex: signature, headers, or data/media), age, user/owner, permissions, etc.

File: File Modification

Changes made to a file, including updates to its contents, metadata, access permissions, or attributes. These modifications may indicate legitimate activity (e.g., software updates) or unauthorized changes (e.g., tampering, ransomware, or adversarial modifications). Examples:

  • Content Modifications: Changes to the content of a configuration file, such as modifying /etc/ssh/sshd_config on Linux or C:\Windows\System32\drivers\etc\hosts on Windows.
  • Permission Changes: Altering file permissions to allow broader access, such as changing a file from 644 to 777 on Linux or modifying NTFS permissions on Windows.
  • Attribute Modifications: Changing a file's attributes to hidden, read-only, or system on Windows.
  • Timestamp Manipulation: Adjusting a file's creation or modification timestamp using tools like touch in Linux or timestomping tools on Windows.
  • Software or System File Changes: Modifying system files such as boot.ini, kernel modules, or application binaries.

This data component can be collected through the following measures:

Windows

  • Event Logs: Enable file system auditing to monitor file modifications using Security Event ID 4670 (File System Audit) or Sysmon Event ID 2 (File creation time changed).
  • PowerShell: Use Get-ItemProperty or Get-Acl cmdlets to monitor file properties: Get-Item -Path "C:\path\to\file" | Select-Object Name, Attributes, LastWriteTime

Linux

  • File System Monitoring: Use tools like auditd with rules to monitor file modifications: auditctl -w /path/to/file -p wa -k file_modification
  • Inotify: Use inotifywait to watch for real-time changes to files or directories: inotifywait -m /path/to/file

macOS

  • Endpoint Security Framework (ESF): Monitor file modification events using ESF APIs.
  • Audit Framework: Configure audit rules to track file changes.
  • Command-Line Tools: Use fs_usage to monitor file activities: fs_usage -w /path/to/file

SIEM Tools

  • Collect logs from endpoint agents (e.g., Sysmon, Auditd) and file servers to centralize file modification event data.

File: File Modification

Changes made to a file, including updates to its contents, metadata, access permissions, or attributes. These modifications may indicate legitimate activity (e.g., software updates) or unauthorized changes (e.g., tampering, ransomware, or adversarial modifications). Examples:

  • Content Modifications: Changes to the content of a configuration file, such as modifying /etc/ssh/sshd_config on Linux or C:\Windows\System32\drivers\etc\hosts on Windows.
  • Permission Changes: Altering file permissions to allow broader access, such as changing a file from 644 to 777 on Linux or modifying NTFS permissions on Windows.
  • Attribute Modifications: Changing a file's attributes to hidden, read-only, or system on Windows.
  • Timestamp Manipulation: Adjusting a file's creation or modification timestamp using tools like touch in Linux or timestomping tools on Windows.
  • Software or System File Changes: Modifying system files such as boot.ini, kernel modules, or application binaries.

This data component can be collected through the following measures:

Windows

  • Event Logs: Enable file system auditing to monitor file modifications using Security Event ID 4670 (File System Audit) or Sysmon Event ID 2 (File creation time changed).
  • PowerShell: Use Get-ItemProperty or Get-Acl cmdlets to monitor file properties: Get-Item -Path "C:\path\to\file" | Select-Object Name, Attributes, LastWriteTime

Linux

  • File System Monitoring: Use tools like auditd with rules to monitor file modifications: auditctl -w /path/to/file -p wa -k file_modification
  • Inotify: Use inotifywait to watch for real-time changes to files or directories: inotifywait -m /path/to/file

macOS

  • Endpoint Security Framework (ESF): Monitor file modification events using ESF APIs.
  • Audit Framework: Configure audit rules to track file changes.
  • Command-Line Tools: Use fs_usage to monitor file activities: fs_usage -w /path/to/file

SIEM Tools

  • Collect logs from endpoint agents (e.g., Sysmon, Auditd) and file servers to centralize file modification event data.
Domain ID Name Detects
Enterprise T1548 Abuse Elevation Control Mechanism

On Linux, auditd can alert every time a user's actual ID and effective ID are different (this is what happens when you sudo). This technique is abusing normal functionality in macOS and Linux systems, but sudo has the ability to log all input and output based on the LOG_INPUT and LOG_OUTPUT directives in the /etc/sudoers file. Consider monitoring for /usr/libexec/security_authtrampoline executions which may indicate that AuthorizationExecuteWithPrivileges is being executed. MacOS system logs may also indicate when AuthorizationExecuteWithPrivileges is being called.

.001 Setuid and Setgid

Monitor for changes made to files that may perform shell escapes or exploit vulnerabilities in an application with the setsuid or setgid bits to get code running in a different user’s context.

.003 Sudo and Sudo Caching

On Linux, auditd can alert every time a user's actual ID and effective ID are different (this is what happens when you sudo). This technique is abusing normal functionality in macOS and Linux systems, but sudo has the ability to log all input and output based on the LOG_INPUT and LOG_OUTPUT directives in the /etc/sudoers file.

.006 TCC Manipulation

Monitor for changes to files associated with TCC settings, such as /Library/Application Support/com.apple.TCC/TCC.db and the overwrites file.

Enterprise T1098 Account Manipulation

Monitor for changes made to files related to account settings, such as /etc/ssh/sshd_config and the authorized_keys file for each user on a system.

.004 SSH Authorized Keys

Monitor for changes made to detect changes made to the authorized_keys file for each user on a system. Monitor for changes to and suspicious processes modifiying /etc/ssh/sshd_config.

Enterprise T1547 Boot or Logon Autostart Execution

Monitor for changes made to files 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 the start folder for additions or changes. Tools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including the startup folders. [32]

.006 Kernel Modules and Extensions

Monitor for changes made to files that may modify the kernel to automatically execute programs on system boot.

.007 Re-opened Applications

Monitoring the specific plist files associated with reopening applications can indicate when an application has registered itself to be reopened.

.008 LSASS Driver

Monitor for changes made to files that may modify or add LSASS drivers to obtain persistence on compromised systems.

.009 Shortcut Modification

Since a shortcut's target path likely will not change, modifications to shortcut files that do not correlate with known software changes, patches, removal, etc., may be suspicious. Analysis should attempt to relate shortcut file change events to other potentially suspicious events based on known adversary behavior such as process launches of unknown executables that make network connections.

.013 XDG Autostart Entries

Malicious XDG autostart entries may be detected by auditing file modification events within the /etc/xdg/autostart and ~/.config/autostart directories. Depending on individual configurations, defenders may need to query the environment variables $XDG_CONFIG_HOME or $XDG_CONFIG_DIRS to determine the paths of Autostart entries. Autostart entry files not associated with legitimate packages may be considered suspicious. Suspicious entries can also be identified by comparing entries to a trusted system baseline.

.015 Login Items

All login items created via shared file lists are viewable by using the System Preferences GUI or in the ~/Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm file.[9][10][11][12] These locations should be monitored and audited.

Enterprise T1037 Boot or Logon Initialization Scripts

Monitor for changes made to files that are modified by unusual accounts outside of normal administration duties.

.002 Login Hook

Monitor for changes to login hook files (/Library/Preferences/com.apple.loginwindow.plist), especially by unusual accounts outside of normal administration duties.

.003 Network Logon Script

Monitor for changes made to files for unexpected modifications to unusual accounts outside of normal administration duties

.004 RC Scripts

Monitor for changes made to files for unexpected modifications to RC scripts in the /etc/ directory. On ESXi servers, the /etc/rc.local.d/local.sh file should almost always be empty.[33]

.005 Startup Items

Monitor for changes made to files for unexpected modifications to /Library/StartupItem folder

Enterprise T1554 Compromise Host Software Binary

Monitor changes to client software that do not correlate with known software or patch cycles.

Enterprise T1543 Create or Modify System Process

Monitor for changes to files associated with system-level processes.

.001 Launch Agent

Launch Agents also require files on disk for persistence which can also be monitored via other file monitoring applications.

.002 Systemd Service

Systemd service unit files may be detected by auditing file creation and modification events within the /etc/systemd/system, /usr/lib/systemd/system/, and /home/$username/.config/systemd/user/ directories, as well as associated symbolic links. Systemd generators may be modified in system-wide directories such as /run/systemd/system-generators/, /etc/systemd/system-generators or user-specific directories such as /run/systemd/user-generators/.

.004 Launch Daemon

Monitor files for changes that may create or modify Launch Daemons to execute malicious payloads as part of persistence.

Enterprise T1485 Data Destruction

Monitor for changes made to a large quantity of files for unexpected modifications in user directories and under C:\Windows\System32.

ICS T0809 Data Destruction

Monitor for changes made to a large quantity of files for unexpected modifications in both user directories and directories used to store programs and OS components (e.g., C:\Windows\System32).

Enterprise T1486 Data Encrypted for Impact

Monitor for changes made to files in user directories.

Enterprise T1565 Data Manipulation

Monitor for unexpected files with manipulated data in order to manipulate external outcomes or hide activity

.001 Stored Data Manipulation

Monitor for unexpected files with manipulated data in order to manipulate external outcomes or hide activity

.003 Runtime Data Manipulation

Monitor for unexpected files with manipulated data in order to manipulate external outcomes or hide activity

Enterprise T1491 Defacement

Monitor for changes made to files for unexpected modifications to internal and external websites for unplanned content changes.

.001 Internal Defacement

Monitor internal and websites for unplanned content changes.

.002 External Defacement

Monitor external websites for unplanned content changes.

Enterprise T1140 Deobfuscate/Decode Files or Information

Monitor for changes made to files for unexpected modifications that attempt to hide artifacts. On Windows, Event ID 4663 (Security Log - An attempt was made to access an object) can be used to alert on suspicious file accesses (e.g., attempting to write to a file which shouldn’t be further modified) that may coincide with attempts to hide artifacts.

Enterprise T1546 Event Triggered Execution

Monitor for changes made to files that may establish persistence and/or elevate privileges using system mechanisms that trigger execution based on specific events.

.002 Screensaver

Monitor for changes made to files that may establish persistence by executing malicious content triggered by user inactivity.

Note: Although there are no standard events for file modification, Windows Event ID 4663 (An Attempt Was Made to Access An Object) can be used to alert on attempted accesses of screensaver files (typically ending in a file extension of .scr).

.004 Unix Shell Configuration Modification

Monitor for changes to /etc/profile and /etc/profile.d, these files should only be modified by system administrators. MacOS users can leverage Endpoint Security Framework file events monitoring these specific files.[34]

.005 Trap

Monitor for changes made to files that may establish persistence by executing malicious content triggered by an interrupt signal.

.006 LC_LOAD_DYLIB Addition

Monitor file systems for changes to application binaries and invalid checksums/signatures.

.008 Accessibility Features

Monitor for changes made to files that may establish persistence and/or elevate privileges by executing malicious content triggered by accessibility features. Changes to accessibility utility binaries or binary paths that do not correlate with known software, patch cycles, etc., are suspicious.

.011 Application Shimming

Monitor for changes made to files that may establish persistence and/or elevate privileges by executing malicious content triggered by application shims.

.013 PowerShell Profile

Locations where profile.ps1 can be stored should be monitored for modifications. [14] Example profile locations include:* $PsHome\Profile.ps1* $PsHome\Microsoft.{HostProgram}_profile.ps1* $Home\My Documents\PowerShell\Profile.ps1* $Home\My Documents\PowerShell\Microsoft.{HostProgram}_profile.ps1

.014 Emond

Monitor emond rules creation by checking for files modified in /etc/emond.d/rules/ and /private/var/db/emondClients.

.017 Udev Rules

Monitor the creation and modification of files in the directories where udev rules are located: /etc/udev/rules.d/, /run/udev/rules.d/, /lib/udev/rules.d/, /usr/lib/udev/rules.d/, and /usr/local/lib/udev/rules.d/. Analyze and monitor changes to RUN assignment key.[35][36]

Enterprise T1203 Exploitation for Client Execution

Monitor file system changes associated with exploitation, such as suspicious files dropped by browsers, Office apps, or third-party programs, which can be used for further stages of attack.

Analytic 1 - identifies file creations or modifications associated with commonly exploited software

sourcetype=linux_auditd| search file_path IN ("/Users//Library/", "C:\Users\\AppData\Roaming\", "/home/*/.config/", "/var/tmp/")| stats count by file_path process_name user| where process_name IN ("chrome.exe", "firefox.exe", "winword.exe", "excel.exe", "acrord32.exe", "flashplayer.exe")

Enterprise T1187 Forced Authentication

Monitor for changes made to the .LNK, .SCF, or any other files on systems and within virtual environments that contain resources that point to external network resources.

Analytic 1 - Modifications to files known to be used for forced authentication attacks.

(index=security sourcetype="WinEventLog:Security" EventCode=4663) | where match(ObjectName, "(?i)\(.*\.)?(lnk|scf|url|doc|dot|xls|ppt|pdf|html)$")| where match(ObjectName, "(?i)(desktop|public|downloads|temp|cache|start menu|startup)")

Enterprise T1564 Hide Artifacts

Monitor for changes made to files that may attempt to hide artifacts associated with their behaviors to evade detection.

.002 Hidden Users

Monitor for changes made to files that may use hidden users to mask the presence of user accounts they create or modify. Monitor for changes made to the /Library/Preferences/com.apple.loginwindow plist file for unexpected modifications to the Hide500Users key value on macOS.[37]

.003 Hidden Window

Monitor for changes made to files that may use hidden windows to conceal malicious activity from the plain sight of users. In MacOS, plist files are ASCII text files with a specific format, so they're relatively easy to parse. File monitoring can check for the apple.awt.UIElement or any other suspicious plist tag in plist files and flag them.

.004 NTFS File Attributes

There are many ways to create and interact with ADSs using Windows utilities. Monitor for operations (execution, copies, etc.) with file names that contain colons. This syntax (ex: file.ext:ads[.ext]) is commonly associated with ADSs. [38] [39] [40] For a more exhaustive list of utilities that can be used to execute and create ADSs, see https://gist.github.com/api0cradle/cdd2d0d0ec9abb686f0e89306e277b8f.

.005 Hidden File System

Detecting the use of a hidden file system may be exceptionally difficult depending on the implementation. Emphasis may be placed on detecting related aspects of the adversary lifecycle, such as how malware interacts with the hidden file system or how a hidden file system is loaded.

.008 Email Hiding Rules

On MacOS systems, monitor for modifications to the RulesActiveState.plist, SyncedRules.plist, UnsyncedRules.plist, and MessageRules.plist files.[41]

Enterprise T1574 Hijack Execution Flow

Monitor file systems for moving, renaming, replacing, or modifying DLLs. Changes in the set of DLLs that are loaded by a process (compared with past behavior) that do not correlate with known software, patches, etc., are suspicious. Modifications to or creation of .manifest and .local redirection files that do not correlate with software updates are suspicious.

.001 DLL

Monitor for changes made to .manifest / .local redirection files, or file systems for moving, renaming, replacing, or modifying DLLs. Changes in the set of DLLs that are loaded by a process (compared with past behavior) that do not correlate with known software, patches, etc., are suspicious. To detect DLL substitution, monitor for changes made to DLLs in trusted locations, such as C:\Windows\System32.

.004 Dylib Hijacking

Monitor file systems for moving, renaming, replacing, or modifying dylibs. Changes in the set of dylibs that are loaded by a process (compared to past behavior) that do not correlate with known software, patches, etc., are suspicious. Check the system for multiple dylibs with the same name and monitor which versions have historically been loaded into a process.

.005 Executable Installer File Permissions Weakness

Monitor for changes to binaries and service executables that may normally occur during software updates.

.006 Dynamic Linker Hijacking

Monitor for changes to files associated with loading shared libraries such as LD_PRELOAD on Linux (such as /etc/ld.so.preload) and DYLD_INSERT_LIBRARIES on macOS.

.008 Path Interception by Search Order Hijacking

Monitor for programs metadata modifications such as deletion of the path to an executable since it makes programs vulnerable to this type of technique. Also, monitor modifications of files such as renaming programs using Windows system utilities names.

.009 Path Interception by Unquoted Path

Monitor for changes made to files that may execute their own malicious payloads by hijacking vulnerable file path references.

.010 Services File Permissions Weakness

Monitor for modification of binaries and service executables that do not occur during a regular software update or an update scheduled by the organization. Modification of files considers actions such as renaming and directory moving.

Enterprise T1562 Impair Defenses

Monitor changes made to configuration files that contain settings for logging and defensive tools.

.012 Disable or Modify Linux Audit System

Monitor changes made to the /etc/audit/audit.rules file containing the sequence of auditctl commands loaded at boot time.

Enterprise T1070 Indicator Removal

Monitor for changes made to a file may delete or alter generated artifacts on a host system, including logs or captured files such as quarantined malware.

.002 Clear Linux or Mac System Logs

Monitor for changes made to system log files, typically stored in /var/log or /Library/Logs, for unexpected modifications to access permissions and attributes

.003 Clear Command History

Monitor for changes made to command history files, such as ConsoleHost_history.txt, ~/.zsh_history, ~/.bash_history, or /var/log/shell.log, for unexpected modifications to contents, access permissions, and attributes.

Analytic 1 : Modification of access rights to command history files

(source="WinEventLog:Security" EventCode IN (4663, 4670) AND Path="ConsoleHost_history.txt" AND ObjectType="File") AND (UserAccessList="1539" OR UserAccessList="WRITE_DAC") OR (ObjectNewSd=";FA" OR ObjectNewSd=";FW" OR ObjectNewSd=";BU*")

.006 Timestomp

Monitor for unexpected modifications to file timestamps.

.007 Clear Network Connection History and Configurations

Monitor changes to files that may be indicators of deleting or altering malicious network configuration settings as well as generated artifacts on a host system that highlight network connection history, such as Default.rdp or /var/log/.

.008 Clear Mailbox Data

Monitor for changes made to generated artifacts on a host system, including logs or captured files such as quarantined emails.

On Windows 10, mail application data is stored in C:\Users\Username\AppData\Local\Comms\Unistore\data. On Linux, mail data is stored in /var/spool/mail or /var/mail. On macOS, mail data is stored in ~/Library/Mail.

.009 Clear Persistence

Monitor for changes made to a file may delete or alter generated artifacts associated with persistence on a host system.

.010 Relocate Malware

Monitor for changes to files that may highlight malware or otherwise potentially malicious payloads being copied between different file/folder locations on a host.

ICS T0872 Indicator Removal on Host

Monitor for changes made to a file may delete or alter generated artifacts on a host system, including logs or captured files such as quarantined malware.

Enterprise T1056 Input Capture

Monitor for changes made to files for unexpected modifications to access permissions and attributes. Monitor for changes to files associated with loading shared libraries such as LD_PRELOAD on Linux (such as /etc/ld.so.preload) and DYLD_INSERT_LIBRARIES on macOS.

Analytic 1 - Unexpected file modifications.

index=security sourcetype="WinEventLog:Security" EventCode=4663 | where Object_Type="File" AND Access_Mask IN ("0x2", "0x4", "0x20", "0x80", "0x100")

.003 Web Portal Capture

Monitor for changes made to detect changes to files in the Web directory for organization login pages that do not match with authorized updates to the Web server's content.

.004 Credential API Hooking

Monitor for changes to files associated with loading shared libraries such as LD_PRELOAD on Linux (such as /etc/ld.so.preload) and DYLD_INSERT_LIBRARIES on macOS.

Enterprise T1036 Masquerading

Monitor for changes made to files outside of an update or patch that may attempt to manipulate features of their artifacts to make them appear legitimate or benign to users and/or security tools. Windows Event ID 4663 (An Attempt Was Made to Access An Object) can be used to alert on attempted file accesses that may be associate with Masquerading.

.003 Rename Legitimate Utilities

Monitor for unexpected modifications to file names that are mismatched between the file name on disk and that of the binary's PE metadata. This is a likely indicator that a binary was renamed after it was compiled.

Note: There are no standard Windows events for file modification. However, Event ID 4663 (An attempt was made to access an object) can be used to audit and alert on attempts to access system utility binaries; the "Accesses" field can be used to filter by type of access (e.g., MODIFY vs DELETE).

.008 Masquerade File Type

Check and ensure that file headers/signature and extensions match using magic bytes detection and/or file signature validation.[23] In Linux, the file command may be used to check the file signature.[24]

ICS T0849 Masquerading

Monitor for changes made to files outside of an update or patch that may attempt to manipulate features of their artifacts to make them appear legitimate or benign to users and/or security tools.

Enterprise T1556 Modify Authentication Process

Monitor for suspicious modification of files associated with authentication processes, such as configuration files and module paths (e.g. /etc/pam.d/). Use system-integrity tools such as AIDE and monitoring tools such as auditd to monitor PAM files. Also monitor for access to certificates and cryptographic keys material.

Analytic 1 - Unauthorized modifications to authentication-related files.

index=security sourcetype IN ("WinEventLog:Security", "WinEventLog:Microsoft-Windows-Sysmon/Operational", "linux_audit", "macos_secure")(EventCode=4663 OR EventCode=11 OR EventCode=13 OR (sourcetype="linux_audit" AND (syscall IN ("creat", "open", "openat", "write", "chmod", "chown", "unlink"))) OR (sourcetype="macos_secure" AND action="file_write"))| eval TargetFile=coalesce(ObjectName, FileName, target_file)| search TargetFile IN ( "C:\Windows\System32\config\SAM", "C:\Windows\System32\config\system", "C:\Windows\System32\config\security", "C:\Windows\System32\lsass.exe", "C:\Windows\System32\Drivers\etc\hosts", "/etc/passwd", "/etc/shadow", "/etc/pam.d/", "/etc/security/", "/etc/sshd_config", "/etc/ssh/sshd_config", "/Library/Preferences/com.apple.loginwindow.plist", "/Library/Security/authorization", "/etc/krb5.conf", "/etc/krb5.keytab", "/etc/pam.conf", "/etc/security/access.conf", "/etc/security/limits.conf", "/etc/security/namespace.conf", "/etc/security/sepermit.conf", "/etc/security/time.conf")| eval User=coalesce(Account_Name, user, uid, user_name)| eval Platform=case( sourcetype=="WinEventLog:Security", "Windows", sourcetype=="wineventlog:sysmon", "Windows", sourcetype=="linux_audit", "Linux", sourcetype=="macos_secure", "macOS", true(), "Unknown")

.001 Domain Controller Authentication

Monitor for changes to functions exported from authentication-related system DLLs (such as cryptdll.dll and samsrv.dll).[42]

Analytic 1 - Unauthorized changes to authentication-related DLLs.

index=windows sourcetype=WinEventLog:Security ( (EventCode=4663 AND Object_Type="File" AND Object_Name IN ("C:\Windows\System32\lsass.exe", "C:\Windows\System32\samlib.dll", "C:\Windows\System32\cryptdll.dll", "C:\Windows\System32\samsrv.dll")) OR (EventCode=4662 AND Object_Type="File" AND Object_Name IN ("C:\Windows\System32\lsass.exe", "C:\Windows\System32\samlib.dll", "C:\Windows\System32\cryptdll.dll", "C:\Windows\System32\samsrv.dll")) OR (EventCode=4670 AND Object_Name IN ("C:\Windows\System32\lsass.exe", "C:\Windows\System32\samlib.dll", "C:\Windows\System32\cryptdll.dll", "C:\Windows\System32\samsrv.dll")))

.003 Pluggable Authentication Modules

Monitor PAM configuration and module paths (ex: /etc/pam.d/) for changes. Use system-integrity tools such as AIDE and monitoring tools such as auditd to monitor PAM files.

Analytic 1 - Unauthorized changes to PAM configuration and module paths.

index=os sourcetype="linux_audit" OR sourcetype="auditd" (type="MODIFY" OR type="CREATE" OR type="DELETE") (file="/etc/pam.d/" OR file="/usr/lib/security/" OR file="/lib/security/*")

.004 Network Device Authentication

Monitor for changes made to the checksum of the operating system file and verifying the image of the operating system in memory.[43][44] Detection of this behavior may be difficult, detection efforts may be focused on closely related adversary behaviors, such as Modify System Image.

.007 Hybrid Identity

Monitor for suspicious modification of files associated with hybrid identity authentication processes, such as configuration files. Monitor for access to certificates and cryptographic keys material.

Enterprise T1601 Modify System Image

Most embedded network devices provide a command to print the version of the currently running operating system. Use this command to query the operating system for its version number and compare it to what is expected for the device in question. Because this method may be used in conjunction with  Patch System Image, it may be appropriate to also verify the integrity of the vendor provided operating system image file.

Compare the checksum of the operating system file with the checksum of a known good copy from a trusted source. Some embedded network device platforms may have the capability to calculate the checksum of the file, while others may not. Even for those platforms that have the capability, it is recommended to download a copy of the file to a trusted computer to calculate the checksum with software that is not compromised. [43]

Many vendors of embedded network devices can provide advanced debugging support that will allow them to work with device owners to validate the integrity of the operating system running in memory. If a compromise of the operating system is suspected, contact the vendor technical support and seek such services for a more thorough inspection of the current running system.  [44]

.001 Patch System Image

Compare the checksum of the operating system file with the checksum of a known good copy from a trusted source. Some embedded network device platforms may have the capability to calculate the checksum of the file, while others may not. Even for those platforms that have the capability, it is recommended to download a copy of the file to a trusted computer to calculate the checksum with software that is not compromised.https://tools.cisco.com/security/center/resources/integrity_assurance.html#7

Many vendors of embedded network devices can provide advanced debugging support that will allow them to work with device owners to validate the integrity of the operating system running in memory. If a compromise of the operating system is suspected, contact the vendor technical support and seek such services for a more thorough inspection of the current running system. https://tools.cisco.com/security/center/resources/integrity_assurance.html#13

.002 Downgrade System Image

Monitor for changes made to the operating system of a network device because image downgrade may be used in conjunction with  Patch System Image, it may be appropriate to also verify the integrity of the vendor provided operating system image file.

Enterprise T1137 Office Application Startup

Monitor for changes made to files that may leverage Microsoft Office-based applications for persistence between startups.

.001 Office Template Macros

Monitor for changes made to files that may abuse Microsoft Office templates to obtain persistence on a compromised system. Modification to base templates, like Normal.dotm, should also be investigated since the base templates should likely not contain VBA macros. Changes to the Office macro security settings should also be investigated

.002 Office Test

Monitor for changes made to files that may abuse the Microsoft Office "Office Test" Registry key to obtain persistence on a compromised system.

.006 Add-ins

Monitor for changes made to files that may abuse Microsoft Office add-ins to obtain persistence on a compromised system.

Enterprise T1647 Plist File Modification

Monitor for plist file modification, especially if immediately followed by other suspicious events such as code execution from \~/Library/Scripts or \~/Library/Preferences. Also, monitor for significant changes to any path pointers in a modified plist.

Enterprise T1653 Power Settings

Monitor for unexpected changes to configuration files associated with the power settings of a system.

Enterprise T1542 Pre-OS Boot

On UEFI boot systems, monitor for newly modified files in the ESP, especially ones whose modification times do not match other files or files in C:\Windows\Boot\EFI.[45]

.003 Bootkit

On UEFI boot systems, monitor for newly modified files in the ESP, especially ones whose modification times do not match other files or files in C:\Windows\Boot\EFI.[45]

Enterprise T1055 Process Injection

Monitor for changes made to files that may inject code into processes in order to evade process-based defenses as well as possibly elevate privileges.

.009 Proc Memory

Monitor for changes made to /proc files that may inject malicious code into processes via the /proc filesystem in order to evade process-based defenses as well as possibly elevate privileges. Users should not have permission to modify these in most cases.

ICS T0873 Project File Infection

Monitor for unexpected changes to project files, although if the malicious modification occurs in tandem with legitimate changes it will be difficult to isolate the unintended changes by analyzing only file systems modifications.

Enterprise T1014 Rootkit

Monitor for changes and the existence of unrecognized DLLs, drivers, devices, services, and to the MBR. [46]

Enterprise T1053 Scheduled Task/Job

Monitor for changes made to files that may abuse task scheduling functionality to facilitate initial or recurring execution of malicious code.

Analytic 1 - Look for task file modifications with unusual parameters.

index=security_logs OR index=system_logs(sourcetype="docker_events" OR sourcetype="kubernetes_events" OR sourcetype="wineventlog:security" OR sourcetype="linux_secure" OR sourcetype="syslog" OR sourcetype="file_monitoring")| eval platform=case( sourcetype=="docker_events" OR sourcetype=="kubernetes_events", "Containers", sourcetype=="wineventlog:security", "Windows", sourcetype=="linux_secure" OR sourcetype=="syslog", "Linux", sourcetype=="mac_os_events", "macOS")| search ( (platform="Containers" AND (event_type="file_modify" AND (file_path="/etc/cron.d/" OR file_path="/etc/systemd/system/" OR file_path="/etc/crontab"))) OR (platform="Windows" AND EventCode=4663 AND (ObjectName="C:\Windows\System32\Tasks\" OR ObjectName="C:\Windows\Tasks\")) OR (platform="Linux" AND (file_path="/etc/cron.d/" OR file_path="/etc/systemd/system/" OR file_path="/etc/crontab")) OR (platform="macOS" AND (file_path="/Library/LaunchDaemons/" OR file_path="/Library/LaunchAgents/")))

.002 At

On Windows, monitor Windows Task Scheduler stores in %systemroot%\System32\Tasks for change entries related to scheduled tasks, especially those that do not correlate with known software, patch cycles, etc. On Linux and macOS, all at jobs are stored in /var/spool/cron/atjobs/.[47]

Analytic 1 - Look for task file modifications with unusual parameters. (Linux)

index=linux_logs sourcetype=syslog "at" "/var/spool/cron/atjobs/"| rex "user=(?\w+)"

Analytic 2 - Look for task file modifications with unusual parameters. (Windows)

index=windows_logs sourcetype=WinEventLog:System EventCode=4663 Object_Type="File"| rex field=_raw "Object_Name=(?[^\r\n]+)"| search file_path="at"| where NOT (user="SYSTEM" AND file_path="C:\Windows\Tasks\allowed_task.job")

.003 Cron

Monitor modifications to crontab files or system-wide cron directories. Monitor for changes made to files for unexpected modifications to access permissions and attributes.

Analytic 1 - Modified Files in Linux Cron Directories

index=linux sourcetype:cron_logs:scheduled_tasks" | search "modification" AND (file_path="/etc/crontab" OR file_path="/var/spool/cron/crontabs/" OR file_path="/etc/cron.d/")

.005 Scheduled Task

Monitor Windows Task Scheduler stores in %systemroot%\System32\Tasks for change entries related to scheduled tasks that do not correlate with known software, patch cycles, etc.

Analytic 1 - Look for task file modifications with unusual parameters.

sourcetype=WinEventLog:Security (EventCode=4663 OR file_path="C:\Windows\System32\Tasks\*")| stats count by user host file_path action| where action="Write" OR action="Create"

.006 Systemd Timers

Monitor for changes made to systemd timer unit files for unexpected modification events within the /etc/systemd/system, /usr/lib/systemd/system/, and ~/.config/systemd/user/ directories, as well as associated symbolic links.

Analytic 1 - Look for systemd timer file modifications with unusual parameters.

sourcetype=linux_file_audit (file_path="/etc/systemd/system/.timer" OR file_path="/etc/systemd/system/.service" OR file_path="~/.config/systemd/user/.timer" OR file_path="/usr/lib/systemd/system/.timer")| stats count by user host file_path action| where action="Create" OR action="Write"

Enterprise T1505 Server Software Component

Monitor for changes made to files that may abuse legitimate extensible development features of servers to establish persistent access to systems.

.003 Web Shell

Monitor for changes made to files that may backdoor web servers with web shells to establish persistent access to systems.

.004 IIS Components

Monitor for modification of files (especially DLLs on webservers) that could be abused as malicious ISAPI extensions/filters or IIS modules. Changes to %windir%\system32\inetsrv\config\applicationhost.config could indicate an IIS module installation.[48][49]

.005 Terminal Services DLL

Monitor unexpected changes and/or interactions with termsrv.dll, which is typically stored in %SystemRoot%\System32\.

Enterprise T1489 Service Stop

Monitor for changes made to files that may stop or disable services on a system to render those services unavailable to legitimate users.

ICS T0881 Service Stop

Monitor for changes made to files that may stop or disable services on a system to render those services unavailable to legitimate users.

Enterprise T1553 Subvert Trust Controls

Periodically baseline registered SIPs and trust providers (Registry entries and files on disk), specifically looking for new, modified, or non-Microsoft entries.[50] Also analyze Autoruns data for oddities and anomalies, specifically malicious files attempting persistent execution by hiding within auto-starting locations. Autoruns will hide entries signed by Microsoft or Windows by default, so ensure "Hide Microsoft Entries" and "Hide Windows Entries" are both deselected.[50]

On macOS, the removal of the com.apple.quarantine flag by a user instead of the operating system is a suspicious action and should be examined further. Also monitor software update frameworks that may strip this flag when performing updates.

.001 Gatekeeper Bypass

The removal of the com.apple.quarantine flag by a user instead of the operating system is a suspicious action and should be examined further. Also monitor software update frameworks that may strip this flag when performing updates.

.003 SIP and Trust Provider Hijacking

Periodically baseline registered SIPs and trust providers (Registry entries and files on disk), specifically looking for new, modified, or non-Microsoft entries.[50] Also analyze Autoruns data for oddities and anomalies, specifically malicious files attempting persistent execution by hiding within auto-starting locations. Autoruns will hide entries signed by Microsoft or Windows by default, so ensure "Hide Microsoft Entries" and "Hide Windows Entries" are both deselected.[50]

Enterprise T1569 System Services

Track changes to critical service-related files (e.g., /etc/systemd/system/, /etc/init.d/, and service binaries on Linux, C:\Windows\System32\services.exe on Windows, or /Library/LaunchDaemons on macOS).

Analytic 1 - Unusual file modifications related to system services.

sourcetype=file_monitor| search file_path IN ("/etc/systemd/system/", "/etc/init.d/", "/Library/LaunchDaemons/*", "C:\Windows\System32\services.exe")

.001 Launchctl

Every Launch Agent and Launch Daemon must have a corresponding plist file on disk which can be monitored. Plist files are located in the root, system, and users /Library/LaunchAgents or /Library/LaunchDaemons folders. Launch Agent or Launch Daemon with executable paths pointing to /tmp and /Shared folders locations are potentially suspicious.

Analytic 1 - Suspicious plist file modifications.

sourcetype=osquery OR sourcetype=FSEvents| search file_path IN ("/Library/LaunchAgents/", "/Library/LaunchDaemons/")| where file_action="modified" AND new_executable_path IN ("/tmp/", "/Shared/")

.003 Systemctl

Every systemd service must have a corresponding unit file on disk which can be monitored. Unit files are located in the /etc/systemd/system, /usr/lib/systemd/system/, and /home/$username/.config/systemd/user/ directories.

Analytic 1 - suspicious modification of service unit files

sourcetype=auditd(path IN ("/etc/systemd/system/", "/usr/lib/systemd/system/", "/home//.config/systemd/user/") AND (syscall="open" OR syscall="write"))| stats count by file_path, user, process_name, _time| where NOT match(file_path, "expected_admin_changes")| sort -_time

Enterprise T1080 Taint Shared Content

Monitor for files that write or overwrite many files to a network shared directory may be suspicious.Track file modification events in shared directories, especially modifications that alter executables or scripts. Monitor for signs of binary tampering, such as changes to .DLL or .EXE files that were previously trusted. Look for metadata changes, such as new authors or timestamps inconsistent with expected changes.

sourcetype="WinEventLog:Security" EventCode=4663 OR sourcetype="linux:audit" syscall="write"| search ObjectType="File" AccessMask="0x2"| stats count by ObjectName, AccountName, ProcessName, SourceIPAddress, _time| eval modification_suspicious=if(match(ObjectName, "\.exe$|\.dll$|\.lnk$") AND ProcessName!="approved_tool.exe", "suspicious", "normal")| where modification_suspicious="suspicious"

Enterprise T1600 Weaken Encryption

File Modification

.001 Reduce Key Space

There is no documented method for defenders to directly identify behaviors that reduce encryption key space. Detection efforts may be focused on closely related adversary behaviors, such as Modify System Image and Network Device CLI. Some detection methods require vendor support to aid in investigation.

.002 Disable Crypto Hardware

There is no documented method for defenders to directly identify behaviors that reduce encryption key space. Detection efforts may be focused on closely related adversary behaviors, such as Modify System Image and Network Device CLI. Some detection methods require vendor support to aid in investigation.

References

  1. Microsoft. (2018, May 31). File Management (Local File Systems). Retrieved September 28, 2021.
  2. Chrome Enterprise and Education Help. (n.d.). Use Chrome Browser with Roaming User Profiles. Retrieved March 28, 2023.
  3. Arntz, P. (2016, March 30). The Windows Vault . Retrieved November 23, 2020.
  4. ise. (2019, February 19). Password Managers: Under the Hood of Secrets Management. Retrieved January 22, 2021.
  5. Schroeder, W. & Christensen, L. (2021, June 22). Certified Pre-Owned - Abusing Active Directory Certificate Services. Retrieved August 2, 2022.
  6. Syynimaa, N. (2022, February 15). Stealing and faking Azure AD device identities. Retrieved August 3, 2022.
  7. French, D. (2018, October 2). Detecting Attempts to Steal Passwords from Memory. Retrieved October 11, 2019.
  8. French, D., Filar, B.. (2020, March 21). A Chain Is No Stronger Than Its Weakest LNK. Retrieved November 30, 2020.
  9. Apple. (n.d.). Open items automatically when you log in on Mac. Retrieved October 1, 2021.
  10. hoakley. (2021, September 16). How to run an app or tool at startup. Retrieved October 5, 2021.
  11. Patrick Wardle. (2018, July 23). Block Blocking Login Items. Retrieved October 1, 2021.
  12. Stokes, Phil. (2019, June 17). HOW MALWARE PERSISTS ON MACOS. Retrieved September 10, 2019.
  13. Chad Tilbury. (2023, May 22). Finding Evil WMI Event Consumers with Disk Forensics. Retrieved February 9, 2024.
  14. Malware Archaeology. (2016, June). WINDOWS POWERSHELL LOGGING CHEAT SHEET - Win 7/Win 2008 or later. Retrieved June 24, 2016.
  15. Elastic. (n.d.). Abnormal Process ID or Lock File Created. Retrieved September 19, 2024.
  16. DFIR. (2024, May 16). The 'Invisibility Cloak' - Slash-Proc Magic. Retrieved April 11, 2025.
  17. Chris Ross. (2018, October 17). Persistent Credential Theft with Authorization Plugins. Retrieved April 22, 2021.
  18. Truvis Thornton. (2023, September 25). Visual Studio Code: embedded reverse shell and how to block, create Sentinel Detection, and add Environment Prevention. Retrieved March 24, 2025.
  19. NSA Cybersecurity Directorate. (n.d.). Mitigating Web Shells. Retrieved July 22, 2021.
  20. Harrell, C. (2012, December 11). Extracting ZeroAccess from NTFS Extended Attributes. Retrieved June 3, 2016.
  21. Cole, R., Moore, A., Stark, G., Stancill, B. (2020, February 5). STOMP 2 DIS: Brilliance in the (Visual) Basics. Retrieved September 17, 2020.
  22. Lina Lau. (2022, April 28). Defence Evasion Technique: Timestomping Detection – NTFS Forensics. Retrieved September 30, 2024.
  23. Li, V. (2019, October 2). Polyglot Files: a Hacker’s best friend. Retrieved September 27, 2022.
  24. Kessler, G. (2022, December 9). GCK'S FILE SIGNATURES TABLE. Retrieved August 23, 2022.
  25. Brennan, M. (2022, February 16). Hackers No Hashing: Randomizing API Hashes to Evade Cobalt Strike Shellcode Detection. Retrieved August 22, 2022.
  1. Choi, S. (2015, August 6). Obfuscated API Functions in Modern Packers. Retrieved August 22, 2022.
  2. Jason (jxb5151). (2021, January 28). findapihash.py. Retrieved August 22, 2022.
  3. Microsoft. (n.d.). PsSetCreateProcessNotifyRoutine routine. Retrieved December 20, 2017.
  4. Liberman, T. & Kogan, E. (2017, December 7). Lost in Transaction: Process Doppelgänging. Retrieved December 20, 2017.
  5. hasherezade. (2017, December 18). Process Doppelgänging – a new way to impersonate a process. Retrieved December 20, 2017.
  6. hoakley. (2020, October 29). Quarantine and the quarantine flag. Retrieved September 13, 2021.
  7. Russinovich, M. (2016, January 4). Autoruns for Windows v13.51. Retrieved June 6, 2016.
  8. Asher Langton. (2022, December 9). A Custom Python Backdoor for VMWare ESXi Servers. Retrieved March 26, 2025.
  9. Patrick Wardle. (2019, September 17). Writing a File Monitor with Apple's Endpoint Security Framework. Retrieved December 17, 2020.
  10. Eder P. Ignacio. (2024, February 21). Leveraging Linux udev for persistence. Retrieved September 26, 2024.
  11. Ruben Groenewoud. (2024, August 29). Linux Detection Engineering - A Sequel on Persistence Mechanisms. Retrieved October 16, 2024.
  12. Amit Serper. (2016). Cybereason Lab Analysis OSX.Pirrit. Retrieved December 10, 2021.
  13. Marlin, J. (2013, March 24). Alternate Data Streams in NTFS. Retrieved March 21, 2018.
  14. Moe, O. (2018, January 14). Putting Data in Alternate Data Streams and How to Execute It. Retrieved June 30, 2018.
  15. Moe, O. (2018, April 11). Putting Data in Alternate Data Streams and How to Execute It - Part 2. Retrieved June 30, 2018.
  16. Apple. (n.d.). Use rules to manage emails you receive in Mail on Mac. Retrieved June 14, 2021.
  17. Dell SecureWorks. (2015, January 12). Skeleton Key Malware Analysis. Retrieved April 8, 2019.
  18. Cisco. (n.d.). Cisco IOS Software Integrity Assurance - Cisco IOS Image File Verification. Retrieved October 19, 2020.
  19. Cisco. (n.d.). Cisco IOS Software Integrity Assurance - Cisco IOS Run-Time Memory Integrity Verification. Retrieved October 19, 2020.
  20. Microsoft Incident Response. (2023, April 11). Guidance for investigating attacks using CVE-2022-21894: The BlackLotus campaign. Retrieved February 12, 2025.
  21. Wikipedia. (2016, June 1). Rootkit. Retrieved June 2, 2016.
  22. Craig Rowland. (2019, July 25). Getting an Attacker IP Address from a Malicious Linux At Job. Retrieved October 15, 2021.
  23. Microsoft. (2007, November 24). IIS Modules Overview. Retrieved June 17, 2021.
  24. Hromcová, Z., Cherepanov, A. (2021). Anatomy of Native IIS Malware. Retrieved September 9, 2021.
  25. Graeber, M. (2017, September). Subverting Trust in Windows. Retrieved January 31, 2018.