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` latest(Processes.parent_process) as parent_process, latest(Processes.process) as process, latest(Processes.process_guid) as process_guid count, min(_time) AS firstTime, max(_time) AS lastTime FROM datamodel=Endpoint.Processes where Processes.process != "unknown" AND NOT Processes.process_path IN ("*\\Program Files*","*\\PROGRA~*","*\\Windows\\System32\\*","*\\Windows\\Syswow64\\*") BY Processes.user Processes.dest Processes.parent_process_name Processes.process_name Processes.process_path 
3|`drop_dm_object_name(Processes)` 
4| lookup lolbas_file_path lolbas_file_name as process_name OUTPUT description as desc 
5| lookup lolbas_file_path lolbas_file_name as process_name lolbas_file_path as process_path OUTPUT description as is_lolbas_path 
6| search desc!="false" AND is_lolbas_path="false" 
7| `security_content_ctime(firstTime)` 
8| `security_content_ctime(lastTime)` 
9| `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

- MITRE ATT&CK
+ Kill Chain Phases
+ NIST
+ CIS
- Threat Actors
ID Technique Tactic
T1036 Masquerading Defense Evasion
T1036.005 Match Legitimate Name or Location Defense Evasion
T1218.011 Rundll32 Defense Evasion
KillChainPhase.EXPLOITAITON
NistCategory.DE_CM
Cis18Value.CIS_10
APT28
APT32
Agrius
BRONZE BUTLER
Ember Bear
FIN13
LazyScripter
Nomadic Octopus
OilRig
PLATINUM
Sandworm Team
TA551
TeamTNT
Windshift
Winter Vivern
ZIRCONIUM
menuPass
APT1
APT28
APT29
APT32
APT39
APT41
APT5
Aoqin Dragon
Aquatic Panda
BRONZE BUTLER
BackdoorDiplomacy
Blue Mockingbird
Carbanak
Chimera
Darkhotel
Earth Lusca
Ember Bear
FIN13
FIN7
Ferocious Kitten
Fox Kitten
Gamaredon Group
INC Ransom
Indrik Spider
Ke3chang
Kimsuky
Lazarus Group
LuminousMoth
Machete
Magic Hound
MuddyWater
Mustang Panda
Mustard Tempest
Naikon
PROMETHIUM
Patchwork
Poseidon Group
RedCurl
Rocke
Sandworm Team
SideCopy
Sidewinder
Silence
Sowbug
TA2541
TeamTNT
ToddyCat
Transparent Tribe
Tropic Trooper
Turla
Volt Typhoon
WIRTE
Whitefly
admin@338
menuPass
APT19
APT28
APT3
APT32
APT38
APT41
Aquatic Panda
Blue Mockingbird
Carbanak
CopyKittens
Daggerfly
FIN7
Gamaredon Group
HAFNIUM
Kimsuky
Lazarus Group
LazyScripter
Magic Hound
MuddyWater
RedCurl
Sandworm Team
TA505
TA551
Wizard Spider

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 Notable Yes
Rule Title %name%
Rule Description %description%
Notable Event Fields user, dest
Creates Risk Event True
This configuration file applies to all detections of type TTP. These detections will use Risk Based Alerting and generate Notable Events.

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 will often copy system exectables to a different path for application usage.

Associated Analytic Story

Risk Based Analytics (RBA)

Risk Message Risk Score Impact Confidence
The user $user$ executed a LOLBAS [$process_name$] from an unexpected location on $dest$ 40 80 50
The Risk Score is calculated by the following formula: Risk Score = (Impact * Confidence/100). Initial Confidence and Impact is set by the analytic author.

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