Unix Socket Connection

This rule monitors for inter-process communication via Unix sockets. Adversaries may attempt to communicate with local Unix sockets to enumerate application details, find vulnerabilities/configuration mistakes and potentially escalate privileges or set up malicious communication channels via Unix sockets for inter-process communication to attempt to evade detection.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2023/09/04"
 3integration = ["endpoint", "auditd_manager"]
 4maturity = "production"
 5updated_date = "2024/10/18"
 6
 7[rule]
 8author = ["Elastic"]
 9description = """
10This rule monitors for inter-process communication via Unix sockets. Adversaries may attempt to communicate with local
11Unix sockets to enumerate application details, find vulnerabilities/configuration mistakes and potentially escalate
12privileges or set up malicious communication channels via Unix sockets for inter-process communication to attempt to
13evade detection.
14"""
15from = "now-9m"
16index = ["logs-endpoint.events.*", "endgame-*", "auditbeat-*", "logs-auditd_manager.auditd-*"]
17language = "eql"
18license = "Elastic License v2"
19name = "Unix Socket Connection"
20risk_score = 21
21rule_id = "41284ba3-ed1a-4598-bfba-a97f75d9aba2"
22severity = "low"
23tags = [
24    "Domain: Endpoint",
25    "OS: Linux",
26    "Use Case: Threat Detection",
27    "Tactic: Execution",
28    "Data Source: Elastic Defend",
29    "Data Source: Elastic Endgame",
30    "Data Source: Auditd Manager",
31]
32timestamp_override = "event.ingested"
33type = "eql"
34query = '''
35process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event", "executed", "process_started")
36 and (
37  (process.name in ("nc", "ncat", "netcat", "nc.openbsd") and 
38   process.args == "-U" and process.args : ("/usr/local/*", "/run/*", "/var/run/*")) or
39  (process.name == "socat" and 
40   process.args == "-" and process.args : ("UNIX-CLIENT:/usr/local/*", "UNIX-CLIENT:/run/*", "UNIX-CLIENT:/var/run/*"))
41) and
42not process.args == "/var/run/libvirt/libvirt-sock"
43'''
44
45[[rule.threat]]
46framework = "MITRE ATT&CK"
47
48[[rule.threat.technique]]
49id = "T1559"
50name = "Inter-Process Communication"
51reference = "https://attack.mitre.org/techniques/T1559/"
52
53[rule.threat.tactic]
54id = "TA0002"
55name = "Execution"
56reference = "https://attack.mitre.org/tactics/TA0002/"

Related rules

to-top