Network Connection Initiated by SSHD Child Process
This rule identifies an egress internet connection initiated by an SSH Daemon child process. This behavior is indicative of the alteration of a shell configuration file or other mechanism that launches a process when a new SSH login occurs. Attackers can also backdoor the SSH daemon to allow for persistence, call out to a C2 or to steal credentials.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2024/06/06"
3integration = ["endpoint"]
4maturity = "production"
5updated_date = "2024/07/18"
6
7[rule]
8author = ["Elastic"]
9description = """
10This rule identifies an egress internet connection initiated by an SSH Daemon child process. This behavior is
11indicative of the alteration of a shell configuration file or other mechanism that launches a process when a
12new SSH login occurs. Attackers can also backdoor the SSH daemon to allow for persistence, call out to a C2
13or to steal credentials.
14"""
15from = "now-9m"
16index = ["logs-endpoint.events.*"]
17language = "eql"
18license = "Elastic License v2"
19name = "Network Connection Initiated by SSHD Child Process"
20references = ["https://hadess.io/the-art-of-linux-persistence/"]
21risk_score = 47
22rule_id = "63431796-f813-43af-820b-492ee2efec8e"
23severity = "medium"
24tags = [
25 "Domain: Endpoint",
26 "OS: Linux",
27 "Use Case: Threat Detection",
28 "Tactic: Persistence",
29 "Data Source: Elastic Defend"
30]
31type = "eql"
32query = '''
33sequence by host.id with maxspan=1s
34 [process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
35 process.parent.executable == "/usr/sbin/sshd"] by process.entity_id
36 [network where host.os.type == "linux" and event.type == "start" and event.action == "connection_attempted" and not (
37 destination.ip == null or destination.ip == "0.0.0.0" or cidrmatch(
38 destination.ip, "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.0.0/29",
39 "192.0.0.8/32", "192.0.0.9/32", "192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32", "192.0.2.0/24",
40 "192.31.196.0/24", "192.52.193.0/24", "192.168.0.0/16", "192.88.99.0/24", "224.0.0.0/4", "100.64.0.0/10",
41 "192.175.48.0/24","198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "240.0.0.0/4", "::1", "FE80::/10",
42 "FF00::/8", "172.31.0.0/16"
43 )
44 ) and not process.executable in ("/bin/yum", "/usr/bin/yum")
45 ] by process.parent.entity_id
46'''
47
48[[rule.threat]]
49framework = "MITRE ATT&CK"
50
51[[rule.threat.technique]]
52id = "T1546"
53name = "Event Triggered Execution"
54reference = "https://attack.mitre.org/techniques/T1546/"
55
56[[rule.threat.technique.subtechnique]]
57id = "T1546.004"
58name = "Unix Shell Configuration Modification"
59reference = "https://attack.mitre.org/techniques/T1546/004/"
60
61[rule.threat.tactic]
62id = "TA0003"
63name = "Persistence"
64reference = "https://attack.mitre.org/tactics/TA0003/"
65
66[[rule.threat]]
67framework = "MITRE ATT&CK"
68
69[[rule.threat.technique]]
70id = "T1021"
71name = "Remote Services"
72reference = "https://attack.mitre.org/techniques/T1021/"
73
74[[rule.threat.technique.subtechnique]]
75id = "T1021.004"
76name = "SSH"
77reference = "https://attack.mitre.org/techniques/T1021/004/"
78
79[[rule.threat.technique]]
80id = "T1563"
81name = "Remote Service Session Hijacking"
82reference = "https://attack.mitre.org/techniques/T1563/"
83
84[[rule.threat.technique.subtechnique]]
85id = "T1563.001"
86name = "SSH Hijacking"
87reference = "https://attack.mitre.org/techniques/T1563/001/"
88
89[rule.threat.tactic]
90id = "TA0008"
91name = "Lateral Movement"
92reference = "https://attack.mitre.org/tactics/TA0008/"
93
94[[rule.threat]]
95framework = "MITRE ATT&CK"
96
97[rule.threat.tactic]
98id = "TA0011"
99name = "Command and Control"
100reference = "https://attack.mitre.org/tactics/TA0011/"
References
Related rules
- Creation or Modification of Pluggable Authentication Module or Configuration
- Network Connections Initiated Through XDG Autostart Entry
- Shell Configuration Creation or Modification
- Systemd Service Created
- Systemd Timer Created