Persistence via PowerShell profile
Identifies the creation or modification of a PowerShell profile. PowerShell profile is a script that is executed when PowerShell starts to customize the user environment, which can be abused by attackers to persist in a environment where PowerShell is common.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2022/10/13"
3integration = ["endpoint", "windows"]
4maturity = "production"
5min_stack_comments = "New fields added: required_fields, related_integrations, setup"
6min_stack_version = "8.3.0"
7updated_date = "2023/03/06"
8
9[rule]
10author = ["Elastic"]
11description = """
12Identifies the creation or modification of a PowerShell profile. PowerShell profile is a script that is executed when
13PowerShell starts to customize the user environment, which can be abused by attackers to persist in a environment where
14PowerShell is common.
15"""
16from = "now-9m"
17index = ["winlogbeat-*", "logs-endpoint.events.*", "logs-windows.*", "endgame-*"]
18language = "eql"
19license = "Elastic License v2"
20name = "Persistence via PowerShell profile"
21references = [
22 "https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles",
23 "https://www.welivesecurity.com/2019/05/29/turla-powershell-usage/",
24]
25risk_score = 47
26rule_id = "5cf6397e-eb91-4f31-8951-9f0eaa755a31"
27severity = "medium"
28tags = ["Elastic", "Host", "Windows", "Threat Detection", "Persistence", "Elastic Endgame"]
29timestamp_override = "event.ingested"
30type = "eql"
31
32query = '''
33file where host.os.type == "windows" and event.type != "deletion" and
34 file.path : ("?:\\Users\\*\\Documents\\WindowsPowerShell\\*",
35 "?:\\Users\\*\\Documents\\PowerShell\\*",
36 "?:\\Windows\\System32\\WindowsPowerShell\\*") and
37 file.name : ("profile.ps1", "Microsoft.Powershell_profile.ps1")
38'''
39
40
41[[rule.threat]]
42framework = "MITRE ATT&CK"
43[[rule.threat.technique]]
44id = "T1546"
45name = "Event Triggered Execution"
46reference = "https://attack.mitre.org/techniques/T1546/"
47[[rule.threat.technique.subtechnique]]
48id = "T1546.013"
49name = "PowerShell Profile"
50reference = "https://attack.mitre.org/techniques/T1546/013/"
51
52
53
54[rule.threat.tactic]
55id = "TA0003"
56name = "Persistence"
57reference = "https://attack.mitre.org/tactics/TA0003/"