| ID | Technique | Tactic |
|---|---|---|
| T1059.005 | Visual Basic | Execution |
Detection: Vbscript Execution Using Wscript App
Description
The following analytic detects the execution of VBScript using the wscript.exe utility. It leverages data from Endpoint Detection and Response (EDR) agents, focusing on process and command-line telemetry. It excludes scripts launched from common trusted directories, including nested subdirectories under Program Files, Windows System32, and Windows SysWOW64.
Search
1
2| tstats `security_content_summariesonly`
3 count min(_time) as firstTime max(_time) as lastTime
4
5FROM datamodel=Endpoint.Processes WHERE
6
7(
8 Processes.parent_process_name = "wscript.exe"
9 Processes.parent_process = "*//e:vbscript*"
10)
11OR
12(
13 Processes.process_name = "wscript.exe"
14 Processes.process = "*//e:vbscript*"
15)
16OR
17(
18 Processes.process_name = "wscript.exe"
19 Processes.process = "*.vbs*"
20
21 NOT Processes.process IN (
22 "*:\\Program Files (x86)\\*.vbs*",
23 "*:\\Program Files\\*.vbs*",
24 "*:\\Windows\\System32\\*.vbs*",
25 "*:\\Windows\\SysWOW64\\*.vbs*"
26 )
27
28 NOT Processes.process_current_directory IN (
29 "*:\\Program Files (x86)\\*",
30 "*:\\Program Files\\*",
31 "*:\\Windows\\System32\\*",
32 "*:\\Windows\\SysWOW64\\*"
33 )
34)
35
36BY Processes.action Processes.dest Processes.original_file_name
37 Processes.parent_process Processes.parent_process_exec Processes.parent_process_guid
38 Processes.parent_process_id Processes.parent_process_name Processes.parent_process_path
39 Processes.process Processes.process_exec Processes.process_guid
40 Processes.process_hash Processes.process_id Processes.process_integrity_level
41 Processes.process_name Processes.process_path Processes.process_current_directory Processes.user
42 Processes.user_id Processes.vendor_product
43
44
45| `drop_dm_object_name(Processes)`
46
47| `security_content_ctime(firstTime)`
48
49| `security_content_ctime(lastTime)`
50
51| `vbscript_execution_using_wscript_app_filter`
Data Source
| Name | Platform | Sourcetype | Source |
|---|---|---|---|
| Sysmon EventID 1 | 'XmlWinEventLog' |
'XmlWinEventLog:Microsoft-Windows-Sysmon/Operational' |
Macros Used
| Name | Value |
|---|---|
| security_content_summariesonly | summariesonly=summariesonly_config allow_old_summaries=oldsummaries_config fillnull_value=fillnull_config`` |
| vbscript_execution_using_wscript_app_filter | search * |
vbscript_execution_using_wscript_app_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.
Annotations
Default Configuration
This detection is configured by default in Splunk Enterprise Security to run with the following settings:
| Setting | Value |
|---|---|
| Disabled | true |
| Cron Schedule | 0 * * * * |
| Earliest Time | -70m@m |
| Latest Time | -10m@m |
| Schedule Window | auto |
| Creates Finding (Notable) | No |
| Creates Intermediate Finding (Risk Event) | Yes |
Implementation
The detection is based on data that originates from Endpoint Detection and Response (EDR) agents. These agents are designed to provide security-related telemetry from the endpoints where the agent is installed. To implement this search, you must ingest logs that contain the process GUID, process name, parent process, and process current working directory. Additionally, you must ingest complete command-line executions. These logs must be processed using the appropriate Splunk Technology Add-ons that are specific to the EDR product. The logs must also be mapped to the Processes node of the Endpoint data model, including Processes.process_current_directory. Use the Splunk Common Information Model (CIM) to normalize the field names and speed up the data modeling process.
Known False Positives
False positives are expected when running scripts from user controlled directories such as the desktop, documents, or AppData directories, as well as when running scripts inline from non system directories directly. Apply additional path filtering to the detection to reduce false positives.
Associated Analytic Story
Intermediate Findings
| Message | Entity Field | Entity Type | Risk Score |
|---|---|---|---|
| [$parent_process_path$] executed [$process_path$] with CommandLine [$process$] on [$dest$] by [$user$] | user | user | 20 |
| [$parent_process_path$] executed [$process_path$] with CommandLine [$process$] on [$dest$] by [$user$] | dest | system | 20 |
References
Detection Testing
| Test Type | Status | Dataset | Source | Sourcetype |
|---|---|---|---|---|
| Validation | ✅ Passing | N/A | N/A | N/A |
| Unit | ✅ Passing | Dataset | XmlWinEventLog:Microsoft-Windows-Sysmon/Operational |
XmlWinEventLog |
| Integration | ✅ Passing | Dataset | XmlWinEventLog:Microsoft-Windows-Sysmon/Operational |
XmlWinEventLog |
Replay any dataset to Splunk Enterprise by using our replay.py tool or the UI.
Alternatively you can replay a dataset into a Splunk Attack Range
Source: GitHub |
Version: 15