Discovery Command Output Written to Suspicious File
Detects when a discovery command is executed followed by the immediate modification of a suspicious file via the same process. Many types of malware execute discovery commands, save the output to a file, and then exfiltrate that file via their C2 channel.
Rule type: eql
Rule indices:
- logs-endpoint.events.process-*
- logs-endpoint.events.file-*
Rule Severity: medium
Risk Score: 47
Runs every:
Searches indices from: now-9m
Maximum alerts per execution: ?
References:
Tags:
- Domain: Endpoint
- OS: macOS
- Use Case: Threat Detection
- Tactic: Collection
- Tactic: Discovery
- Data Source: Elastic Defend
Version: ?
Rule authors:
- Elastic
Rule license: Elastic License v2
sequence by process.entity_id with maxspan=15s
[process where host.os.type == "macos" and event.type == "start" and event.action == "exec" and
process.parent.name in ("bash", "sh", "zsh") and
process.name in ("whoami", "ifconfig", "system_profiler", "dscl", "arch", "csrutil") and
process.args_count == 1]
[file where host.os.type == "macos" and event.action == "modification" and
file.path like ("/Users/Shared/*", "/tmp/*", "/private/tmp/*", "/Library/WebServer/*",
"/Library/Graphics/*", "/Library/Fonts/*", "/private/var/root/Library/HTTPStorages/*", "/*/.*") and
not file.path like ("/private/tmp/*.fifo", "/private/tmp/tcl-tk*")]
Framework: MITRE ATT&CK
Tactic:
- Name: Collection
- Id: TA0009
- Reference URL: https://attack.mitre.org/tactics/TA0009/
Technique:
- Name: Data Staged
- Id: T1074
- Reference URL: https://attack.mitre.org/techniques/T1074/
Sub Technique:
- Name: Local Data Staging
- Id: T1074.001
- Reference URL: https://attack.mitre.org/techniques/T1074/001/
Framework: MITRE ATT&CK
Tactic:
- Name: Discovery
- Id: TA0007
- Reference URL: https://attack.mitre.org/tactics/TA0007/
Technique:
- Name: System Information Discovery
- Id: T1082
- Reference URL: https://attack.mitre.org/techniques/T1082/