Security Software Discovery via Grep
Identifies the use of the grep command to discover known third-party macOS and Linux security tools, such as Antivirus or Host Firewall details.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2020/12/20"
3integration = ["endpoint"]
4maturity = "production"
5min_stack_comments = "New fields added: required_fields, related_integrations, setup"
6min_stack_version = "8.3.0"
7updated_date = "2023/06/22"
8
9[rule]
10author = ["Elastic"]
11description = """
12Identifies the use of the grep command to discover known third-party macOS and Linux security tools, such as Antivirus
13or Host Firewall details.
14"""
15false_positives = ["Endpoint Security installers, updaters and post installation verification scripts."]
16from = "now-9m"
17index = ["logs-endpoint.events.*", "auditbeat-*"]
18language = "eql"
19license = "Elastic License v2"
20name = "Security Software Discovery via Grep"
21note = """## Triage and analysis
22
23### Investigating Security Software Discovery via Grep
24
25After successfully compromising an environment, attackers may try to gain situational awareness to plan their next steps. This can happen by running commands to enumerate network resources, users, connections, files, and installed security software.
26
27This rule looks for the execution of the `grep` utility with arguments compatible to the enumeration of the security software installed on the host. Attackers can use this information to decide whether or not to infect a system, disable protections, use bypasses, etc.
28
29#### Possible investigation steps
30
31- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence and whether they are located in expected locations.
32- Investigate other alerts associated with the user/host during the past 48 hours.
33- Investigate any abnormal account behavior, such as command executions, file creations or modifications, and network connections.
34- Investigate any abnormal behavior by the subject process such as network connections, file modifications, and any spawned child processes.
35- Inspect the host for suspicious or abnormal behavior in the alert timeframe.
36- Validate the activity is not related to planned patches, updates, network administrator activity, or legitimate software installations.
37
38### False positive analysis
39
40- Discovery activities are not inherently malicious if they occur in isolation. As long as the analyst did not identify suspicious activity related to the user or host, such alerts can be dismissed.
41
42### Response and remediation
43
44- Initiate the incident response process based on the outcome of the triage.
45- Isolate the involved hosts to prevent further post-compromise behavior.
46- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
47- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
48- Determine the initial vector abused by the attacker and take action to prevent reinfection via the same vector.
49- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
50
51## Setup
52
53If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2, events will not define `event.ingested` and default fallback for EQL rules was not added until 8.2, so you will need to add a custom pipeline to populate `event.ingested` to @timestamp for this rule to work.
54"""
55risk_score = 47
56rule_id = "870aecc0-cea4-4110-af3f-e02e9b373655"
57severity = "medium"
58tags = ["Domain: Endpoint", "OS: macOS", "OS: Linux", "Use Case: Threat Detection", "Tactic: Discovery", "Resources: Investigation Guide", "Data Source: Elastic Defend"]
59timestamp_override = "event.ingested"
60type = "eql"
61
62query = '''
63process where event.type == "start" and
64process.name : "grep" and user.id != "0" and
65 not process.parent.executable : "/Library/Application Support/*" and
66 process.args :
67 ("Little Snitch*",
68 "Avast*",
69 "Avira*",
70 "ESET*",
71 "BlockBlock*",
72 "360Sec*",
73 "LuLu*",
74 "KnockKnock*",
75 "kav",
76 "KIS",
77 "RTProtectionDaemon*",
78 "Malware*",
79 "VShieldScanner*",
80 "WebProtection*",
81 "webinspectord*",
82 "McAfee*",
83 "isecespd*",
84 "macmnsvc*",
85 "masvc*",
86 "kesl*",
87 "avscan*",
88 "guard*",
89 "rtvscand*",
90 "symcfgd*",
91 "scmdaemon*",
92 "symantec*",
93 "sophos*",
94 "osquery*",
95 "elastic-endpoint*"
96 ) and
97 not (process.args : "Avast" and process.args : "Passwords")
98'''
99
100
101[[rule.threat]]
102framework = "MITRE ATT&CK"
103[[rule.threat.technique]]
104id = "T1518"
105name = "Software Discovery"
106reference = "https://attack.mitre.org/techniques/T1518/"
107[[rule.threat.technique.subtechnique]]
108id = "T1518.001"
109name = "Security Software Discovery"
110reference = "https://attack.mitre.org/techniques/T1518/001/"
111
112
113
114[rule.threat.tactic]
115id = "TA0007"
116name = "Discovery"
117reference = "https://attack.mitre.org/tactics/TA0007/"
Triage and analysis
Investigating Security Software Discovery via Grep
After successfully compromising an environment, attackers may try to gain situational awareness to plan their next steps. This can happen by running commands to enumerate network resources, users, connections, files, and installed security software.
This rule looks for the execution of the grep
utility with arguments compatible to the enumeration of the security software installed on the host. Attackers can use this information to decide whether or not to infect a system, disable protections, use bypasses, etc.
Possible investigation steps
- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence and whether they are located in expected locations.
- Investigate other alerts associated with the user/host during the past 48 hours.
- Investigate any abnormal account behavior, such as command executions, file creations or modifications, and network connections.
- Investigate any abnormal behavior by the subject process such as network connections, file modifications, and any spawned child processes.
- Inspect the host for suspicious or abnormal behavior in the alert timeframe.
- Validate the activity is not related to planned patches, updates, network administrator activity, or legitimate software installations.
False positive analysis
- Discovery activities are not inherently malicious if they occur in isolation. As long as the analyst did not identify suspicious activity related to the user or host, such alerts can be dismissed.
Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Isolate the involved hosts to prevent further post-compromise behavior.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
- Determine the initial vector abused by the attacker and take action to prevent reinfection via the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
Setup
If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2, events will not define event.ingested
and default fallback for EQL rules was not added until 8.2, so you will need to add a custom pipeline to populate event.ingested
to @timestamp for this rule to work.
Related rules
- Hosts File Modified
- Potential Reverse Shell Activity via Terminal
- Suspicious JAVA Child Process
- Virtual Machine Fingerprinting via Grep
- Account Discovery Command via SYSTEM Account