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/12/18"
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"""
51risk_score = 47
52rule_id = "870aecc0-cea4-4110-af3f-e02e9b373655"
53setup = """## Setup
54
55If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
56events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
57Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
58`event.ingested` to @timestamp.
59For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
60"""
61severity = "medium"
62tags = ["Domain: Endpoint",
63 "OS: macOS",
64 "OS: Linux",
65 "Use Case: Threat Detection",
66 "Tactic: Discovery",
67 "Resources: Investigation Guide",
68 "Data Source: Elastic Defend"
69 ]
70timestamp_override = "event.ingested"
71type = "eql"
72
73query = '''
74process where event.type == "start" and
75process.name : "grep" and user.id != "0" and
76 not process.parent.executable : ("/Library/Application Support/*", "/opt/McAfee/agent/scripts/ma") and
77 process.args :
78 ("Little Snitch*",
79 "Avast*",
80 "Avira*",
81 "ESET*",
82 "BlockBlock*",
83 "360Sec*",
84 "LuLu*",
85 "KnockKnock*",
86 "kav",
87 "KIS",
88 "RTProtectionDaemon*",
89 "Malware*",
90 "VShieldScanner*",
91 "WebProtection*",
92 "webinspectord*",
93 "McAfee*",
94 "isecespd*",
95 "macmnsvc*",
96 "masvc*",
97 "kesl*",
98 "avscan*",
99 "guard*",
100 "rtvscand*",
101 "symcfgd*",
102 "scmdaemon*",
103 "symantec*",
104 "sophos*",
105 "osquery*",
106 "elastic-endpoint*"
107 ) and
108 not (
109 (process.args : "Avast" and process.args : "Passwords") or
110 (process.parent.args : "/opt/McAfee/agent/scripts/ma" and process.parent.args : "checkhealth") or
111 (process.command_line : (
112 "grep ESET Command-line scanner, version %s -A2",
113 "grep -i McAfee Web Gateway Core version:",
114 "grep --color=auto ESET Command-line scanner, version %s -A2"
115 )
116 ) or
117 (process.parent.command_line : (
118 """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*""",
119 """bash -c perl -pe 's/[^ -~]/\n/g' < /opt/eset/esets/sbin/esets_scan | grep 'ESET Command-line scanner, version %s' -A2 | tail -1"""
120 )
121 )
122 )
123'''
124
125[[rule.threat]]
126framework = "MITRE ATT&CK"
127
128[[rule.threat.technique]]
129id = "T1518"
130name = "Software Discovery"
131reference = "https://attack.mitre.org/techniques/T1518/"
132
133[[rule.threat.technique.subtechnique]]
134id = "T1518.001"
135name = "Security Software Discovery"
136reference = "https://attack.mitre.org/techniques/T1518/001/"
137
138[rule.threat.tactic]
139id = "TA0007"
140name = "Discovery"
141reference = "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
- Hosts File Modified
- Potential Reverse Shell Activity via Terminal
- Suspicious JAVA Child Process
- Virtual Machine Fingerprinting via Grep
- Abnormal Process ID or Lock File Created