Detection: Windows LOLBAS Executed Outside Expected Path

Description

The following analytic identifies a LOLBAS process being executed outside of it's expected location. Processes being executed outside of expected locations may be an indicator that an adversary is attempting to evade defenses or execute malicious code. The LOLBAS project documents Windows native binaries that can be abused by threat actors to perform tasks like executing malicious code.

 1
 2| tstats `security_content_summariesonly`
 3  count min(_time) as firstTime
 4        max(_time) as lastTime
 5  FROM datamodel=Endpoint.Processes where
 6
 7  NOT Processes.process_path IN (
 8    "*\\PROGRA~*",
 9    "*\\Program Files \(x86\)\\",
10    "*\\Program Files\\",
11    "*:\\Windows\\System32\\*",
12    "*:\\Windows\\SysWOW64\\*",
13    "*:\\Windows\\WinSxS\\*"
14  )
15
16by Processes.action Processes.dest Processes.original_file_name Processes.parent_process
17   Processes.parent_process_exec Processes.parent_process_guid Processes.parent_process_id
18   Processes.parent_process_name Processes.parent_process_path Processes.process
19   Processes.process_exec Processes.process_guid Processes.process_hash
20   Processes.process_id Processes.process_integrity_level Processes.process_name
21   Processes.process_path Processes.user Processes.user_id Processes.vendor_product
22
23
24|`drop_dm_object_name(Processes)`
25
26| lookup lolbas_file_path lolbas_file_name as process_name OUTPUT description as desc
27
28| lookup lolbas_file_path lolbas_file_name as process_name lolbas_file_path as process_path OUTPUT description as is_lolbas_path
29
30| search desc!="false" AND is_lolbas_path="false"
31
32| `security_content_ctime(firstTime)`
33
34| `security_content_ctime(lastTime)`
35
36| `windows_lolbas_executed_outside_expected_path_filter`

Data Source

Name Platform Sourcetype Source
Sysmon EventID 1 Windows icon Windows 'XmlWinEventLog' 'XmlWinEventLog:Microsoft-Windows-Sysmon/Operational'
Windows Event Log Security 4688 Windows icon Windows 'XmlWinEventLog' 'XmlWinEventLog:Security'

Macros Used

Name Value
security_content_ctime convert timeformat="%Y-%m-%dT%H:%M:%S" ctime($field$)
windows_lolbas_executed_outside_expected_path_filter search *
windows_lolbas_executed_outside_expected_path_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 Risk Event True
This configuration file applies to all detections of type anomaly. These detections will use Risk Based Alerting.

Implementation

To implement this search, you must ingest logs that contain the process name and process path, such as with Sysmon EID 1.

Known False Positives

Vendors, third party software or update processes may use versions of the binaries listed in the lookup table from non-standard paths. It is recommended to tune this analytic to exclude any known legitimate software or paths in your environment

Associated Analytic Story

Risk Based Analytics (RBA)

Risk Message:

The user $user$ executed a LOLBAS [$process_name$] from an unexpected location [$process_path$] with CommandLine [$process$] on $dest$

Risk Object Risk Object Type Risk Score Threat Objects
user user 40 process_name
dest system 40 process_name

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: 7