Suspicious Powershell Script
A machine learning job detected a PowerShell script with unusual data characteristics, such as obfuscation, that may be a characteristic of malicious PowerShell script text blocks.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2020/03/25"
3integration = ["endpoint", "windows"]
4maturity = "production"
5updated_date = "2024/10/28"
6min_stack_version = "8.14.0"
7min_stack_comments = "Breaking change at 8.14.0 for the Windows Integration."
8
9[rule]
10anomaly_threshold = 50
11author = ["Elastic"]
12description = """
13A machine learning job detected a PowerShell script with unusual data characteristics, such as obfuscation, that may be
14a characteristic of malicious PowerShell script text blocks.
15"""
16false_positives = [
17 """
18 Certain kinds of security testing may trigger this alert. PowerShell scripts that use high levels of obfuscation or
19 have unusual script block payloads may trigger this alert.
20 """,
21]
22from = "now-45m"
23interval = "15m"
24license = "Elastic License v2"
25machine_learning_job_id = ["v3_windows_anomalous_script"]
26name = "Suspicious Powershell Script"
27setup = """## Setup
28
29This rule requires the installation of associated Machine Learning jobs, as well as data coming in from one of the following integrations:
30- Elastic Defend
31- Windows
32
33### Anomaly Detection Setup
34
35Once the rule is enabled, the associated Machine Learning job will start automatically. You can view the Machine Learning job linked under the "Definition" panel of the detection rule. If the job does not start due to an error, the issue must be resolved for the job to commence successfully. For more details on setting up anomaly detection jobs, refer to the [helper guide](https://www.elastic.co/guide/en/kibana/current/xpack-ml-anomalies.html).
36
37### Elastic Defend Integration Setup
38Elastic 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.
39
40#### Prerequisite Requirements:
41- Fleet is required for Elastic Defend.
42- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
43
44#### The following steps should be executed in order to add the Elastic Defend integration to your system:
45- Go to the Kibana home page and click "Add integrations".
46- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
47- Click "Add Elastic Defend".
48- Configure the integration name and optionally add a description.
49- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
50- 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).
51- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
52- 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.
53For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/current/agent-policy.html).
54- Click "Save and Continue".
55- 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.
56For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
57
58### Windows Integration Setup
59The Windows integration allows you to monitor the Windows OS, services, applications, and more.
60
61#### The following steps should be executed in order to add the Elastic Agent System integration "windows" to your system:
62- Go to the Kibana home page and click “Add integrations”.
63- In the query bar, search for “Windows” and select the integration to see more details about it.
64- Click “Add Windows”.
65- Configure the integration name and optionally add a description.
66- Review optional and advanced settings accordingly.
67- Add the newly installed “windows” to an existing or a new agent policy, and deploy the agent on your system from which windows log files are desirable.
68- Click “Save and Continue”.
69- For more details on the integration refer to the [helper guide](https://docs.elastic.co/integrations/windows).
70"""
71references = [
72 "https://www.elastic.co/guide/en/security/current/prebuilt-ml-jobs.html",
73 "https://www.elastic.co/security-labs/detecting-living-off-the-land-attacks-with-new-elastic-integration",
74]
75risk_score = 21
76rule_id = "1781d055-5c66-4adf-9d60-fc0fa58337b6"
77severity = "low"
78tags = [
79 "Domain: Endpoint",
80 "OS: Windows",
81 "Use Case: Threat Detection",
82 "Rule Type: ML",
83 "Rule Type: Machine Learning",
84 "Tactic: Execution",
85]
86type = "machine_learning"
87[[rule.threat]]
88framework = "MITRE ATT&CK"
89[[rule.threat.technique]]
90id = "T1059"
91name = "Command and Scripting Interpreter"
92reference = "https://attack.mitre.org/techniques/T1059/"
93[[rule.threat.technique.subtechnique]]
94id = "T1059.001"
95name = "PowerShell"
96reference = "https://attack.mitre.org/techniques/T1059/001/"
97
98
99
100[rule.threat.tactic]
101id = "TA0002"
102name = "Execution"
103reference = "https://attack.mitre.org/tactics/TA0002/"
References
Related rules
- Anomalous Process For a Windows Population
- Unusual Windows Path Activity
- Unusual Process For a Windows Host
- Unusual Windows Network Activity
- Unusual Windows Process Calling the Metadata Service