Execution of Persistent Suspicious Program

Identifies execution of suspicious persistent programs (scripts, rundll32, etc.) by looking at process lineage and command line usage.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2020/11/19"
 3integration = ["endpoint", "windows"]
 4maturity = "production"
 5updated_date = "2024/10/15"
 6min_stack_version = "8.14.0"
 7min_stack_comments = "Breaking change at 8.14.0 for the Windows Integration."
 8
 9[rule]
10author = ["Elastic"]
11description = """
12Identifies execution of suspicious persistent programs (scripts, rundll32, etc.) by looking at process lineage and
13command line usage.
14"""
15from = "now-9m"
16index = ["winlogbeat-*", "logs-endpoint.events.process-*", "logs-windows.sysmon_operational-*", "endgame-*"]
17language = "eql"
18license = "Elastic License v2"
19name = "Execution of Persistent Suspicious Program"
20risk_score = 47
21rule_id = "e7125cea-9fe1-42a5-9a05-b0792cf86f5a"
22severity = "medium"
23tags = [
24    "Domain: Endpoint",
25    "OS: Windows",
26    "Use Case: Threat Detection",
27    "Tactic: Persistence",
28    "Data Source: Elastic Endgame",
29    "Data Source: Elastic Defend",
30    "Data Source: Sysmon",
31]
32type = "eql"
33
34query = '''
35/* userinit followed by explorer followed by early child process of explorer (unlikely to be launched interactively) within 1m */
36sequence by host.id, user.name with maxspan=1m
37  [process where host.os.type == "windows" and event.type == "start" and process.name : "userinit.exe" and process.parent.name : "winlogon.exe"]
38  [process where host.os.type == "windows" and event.type == "start" and process.name : "explorer.exe"]
39  [process where host.os.type == "windows" and event.type == "start" and process.parent.name : "explorer.exe" and
40   /* add suspicious programs here */
41   process.pe.original_file_name in ("cscript.exe",
42                                     "wscript.exe",
43                                     "PowerShell.EXE",
44                                     "MSHTA.EXE",
45                                     "RUNDLL32.EXE",
46                                     "REGSVR32.EXE",
47                                     "RegAsm.exe",
48                                     "MSBuild.exe",
49                                     "InstallUtil.exe") and
50    /* add potential suspicious paths here */
51    process.args : ("C:\\Users\\*", "C:\\ProgramData\\*", "C:\\Windows\\Temp\\*", "C:\\Windows\\Tasks\\*", "C:\\PerfLogs\\*", "C:\\Intel\\*")
52   ]
53'''
54
55
56[[rule.threat]]
57framework = "MITRE ATT&CK"
58[[rule.threat.technique]]
59id = "T1547"
60name = "Boot or Logon Autostart Execution"
61reference = "https://attack.mitre.org/techniques/T1547/"
62[[rule.threat.technique.subtechnique]]
63id = "T1547.001"
64name = "Registry Run Keys / Startup Folder"
65reference = "https://attack.mitre.org/techniques/T1547/001/"
66
67
68
69[rule.threat.tactic]
70id = "TA0003"
71name = "Persistence"
72reference = "https://attack.mitre.org/tactics/TA0003/"

Related rules

to-top