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"
5updated_date = "2024/10/18"
6
7[rule]
8author = ["Elastic"]
9description = """
10Identifies the use of the grep command to discover known third-party macOS and Linux security tools, such as Antivirus
11or Host Firewall details.
12"""
13false_positives = ["Endpoint Security installers, updaters and post installation verification scripts."]
14from = "now-9m"
15index = ["logs-endpoint.events.*", "auditbeat-*"]
16language = "eql"
17license = "Elastic License v2"
18name = "Security Software Discovery via Grep"
19note = """## Triage and analysis
20
21### Investigating Security Software Discovery via Grep
22
23After 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.
24
25This 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.
26
27#### Possible investigation steps
28
29- 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.
30- Investigate other alerts associated with the user/host during the past 48 hours.
31- Investigate any abnormal account behavior, such as command executions, file creations or modifications, and network connections.
32- Investigate any abnormal behavior by the subject process such as network connections, file modifications, and any spawned child processes.
33- Inspect the host for suspicious or abnormal behavior in the alert timeframe.
34- Validate the activity is not related to planned patches, updates, network administrator activity, or legitimate software installations.
35
36### False positive analysis
37
38- 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.
39
40### Response and remediation
41
42- Initiate the incident response process based on the outcome of the triage.
43- Isolate the involved hosts to prevent further post-compromise behavior.
44- 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.
45- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
46- Determine the initial vector abused by the attacker and take action to prevent reinfection via the same vector.
47- 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).
48"""
49risk_score = 47
50rule_id = "870aecc0-cea4-4110-af3f-e02e9b373655"
51setup = """## Setup
52
53If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
54events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
55Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
56`event.ingested` to @timestamp.
57For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
58"""
59severity = "medium"
60tags = [
61 "Domain: Endpoint",
62 "OS: macOS",
63 "OS: Linux",
64 "Use Case: Threat Detection",
65 "Tactic: Discovery",
66 "Resources: Investigation Guide",
67 "Data Source: Elastic Defend",
68]
69timestamp_override = "event.ingested"
70type = "eql"
71query = '''
72process where event.type == "start" and
73process.name : "grep" and user.id != "0" and
74 not process.parent.executable : ("/Library/Application Support/*", "/opt/McAfee/agent/scripts/ma") and
75 process.args :
76 ("Little Snitch*",
77 "Avast*",
78 "Avira*",
79 "ESET*",
80 "BlockBlock*",
81 "360Sec*",
82 "LuLu*",
83 "KnockKnock*",
84 "kav",
85 "KIS",
86 "RTProtectionDaemon*",
87 "Malware*",
88 "VShieldScanner*",
89 "WebProtection*",
90 "webinspectord*",
91 "McAfee*",
92 "isecespd*",
93 "macmnsvc*",
94 "masvc*",
95 "kesl*",
96 "avscan*",
97 "guard*",
98 "rtvscand*",
99 "symcfgd*",
100 "scmdaemon*",
101 "symantec*",
102 "sophos*",
103 "osquery*",
104 "elastic-endpoint*"
105 ) and
106 not (
107 (process.args : "Avast" and process.args : "Passwords") or
108 (process.args == "osquery.conf") or
109 (process.parent.args : "/opt/McAfee/agent/scripts/ma" and process.parent.args : "checkhealth") or
110 (process.command_line : (
111 "grep ESET Command-line scanner, version %s -A2",
112 "grep -i McAfee Web Gateway Core version:",
113 "grep --color=auto ESET Command-line scanner, version %s -A2"
114 )
115 ) or
116 (process.parent.command_line : (
117 """sh -c printf "command_start_%s"*; perl -pe 's/[^ -~]/\n/g' < /opt/eset/esets/sbin/esets_scan | grep 'ESET Command-line scanner, version %s' -A2 | tail -1; printf "command_done_%s*""",
118 """bash -c perl -pe 's/[^ -~]/\n/g' < /opt/eset/esets/sbin/esets_scan | grep 'ESET Command-line scanner, version %s' -A2 | tail -1"""
119 )
120 )
121 )
122'''
123
124[[rule.threat]]
125framework = "MITRE ATT&CK"
126
127[[rule.threat.technique]]
128id = "T1518"
129name = "Software Discovery"
130reference = "https://attack.mitre.org/techniques/T1518/"
131
132[[rule.threat.technique.subtechnique]]
133id = "T1518.001"
134name = "Security Software Discovery"
135reference = "https://attack.mitre.org/techniques/T1518/001/"
136
137[rule.threat.tactic]
138id = "TA0007"
139name = "Discovery"
140reference = "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).
Related rules
- Deprecated - Suspicious JAVA Child Process
- Potential Reverse Shell Activity via Terminal
- Virtual Machine Fingerprinting via Grep
- Elastic Agent Service Terminated
- Masquerading Space After Filename