Unusual Interactive Shell Launched from System User

This rule detects interactive shells launched from system users. System users typically do not require interactive shells, and their presence may indicate malicious activity.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2024/11/04"
 3integration = ["endpoint"]
 4maturity = "production"
 5updated_date = "2024/11/04"
 6
 7[rule]
 8author = ["Elastic"]
 9description = """
10This rule detects interactive shells launched from system users. System users typically do not require interactive shells,
11and their presence may indicate malicious activity.
12"""
13from = "now-9m"
14index = ["logs-endpoint.events.process*"]
15language = "kuery"
16license = "Elastic License v2"
17name = "Unusual Interactive Shell Launched from System User"
18risk_score = 21
19rule_id = "9c5b2382-19d2-4b5d-8f14-9e1631a3acdb"
20setup = """## Setup
21
22This rule requires data coming in from Elastic Defend.
23
24### Elastic Defend Integration Setup
25Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
26
27#### Prerequisite Requirements:
28- Fleet is required for Elastic Defend.
29- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
30
31#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
32- Go to the Kibana home page and click "Add integrations".
33- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
34- Click "Add Elastic Defend".
35- Configure the integration name and optionally add a description.
36- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
37- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
38- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
39- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
40
41For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
42- Click "Save and Continue".
43- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
44
45For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
46"""
47severity = "low"
48tags = [
49        "Domain: Endpoint",
50        "OS: Linux",
51        "Use Case: Threat Detection",
52        "Tactic: Defense Evasion",
53        "Data Source: Elastic Defend"
54        ]
55timestamp_override = "event.ingested"
56type = "new_terms"
57query = '''
58event.category:process and host.os.type:linux and event.type:start and event.action:exec and user.name:(
59   daemon or bin or sys or sync or games or man or mail or news or uucp or proxy or backup or list or irc
60   or gnats or _apt or Debian-exim or systemd-timesync or messagebus or uuidd or _chrony or sshd or
61   gamer or shutdown or halt or dbus or polkitd or rtkit or pipewire or tcpdump or clevis or
62   libstoreagemgmt or geoclue or tss or sssd or gnome-initial-setup or pesign or dnsmasq or chrony 
63) and process.interactive:true and process.parent.executable:* and not (
64  process.parent.name:(
65    apt-key or apt-config or gpgv or gpgconf or man-db.postinst or sendmail or rpm or nullmailer-inject
66  ) or
67  process.args:(/etc/apt/trusted.gpg.d/* or /tmp/apt-key-gpg*) or
68  process.name:(awk or apt-config or dpkg or grep or gpgv or sed) or
69  (user.name:daemon and process.name:at)
70)
71'''
72[[rule.threat]]
73framework = "MITRE ATT&CK"
74
75[rule.threat.tactic]
76name = "Defense Evasion"
77id = "TA0005"
78reference = "https://attack.mitre.org/tactics/TA0005/"
79
80[[rule.threat.technique]]
81id = "T1564"
82name = "Hide Artifacts"
83reference = "https://attack.mitre.org/techniques/T1564/"
84
85[[rule.threat.technique.subtechnique]]
86id = "T1564.002"
87name = "Hidden Users"
88reference = "https://attack.mitre.org/techniques/T1564/002/"
89
90[rule.new_terms]
91field = "new_terms_fields"
92value = ["process.executable"]
93
94[[rule.new_terms.history_window_start]]
95field = "history_window_start"
96value = "now-14d"

Related rules

to-top