Detection: Process Creating LNK file in Suspicious Location

Description

The following analytic detects a process creating a .lnk file in suspicious locations such as C:\User* or *\Local\Temp\*. It leverages filesystem and process activity data from the Endpoint data model to identify this behavior. This activity is significant because creating .lnk files in these directories is a common tactic used by spear phishing tools to establish persistence or execute malicious payloads. If confirmed malicious, this could allow an attacker to maintain persistence, execute arbitrary code, or further compromise the system.

 1
 2| tstats `security_content_summariesonly` count min(_time) as firstTime max(_time) as lastTime FROM datamodel=Endpoint.Filesystem where Filesystem.file_name="*.lnk" AND (Filesystem.file_path="C:\\Users\\*" OR Filesystem.file_path="*\\Temp\\*") by _time span=1h Filesystem.process_guid Filesystem.file_name Filesystem.file_path Filesystem.file_hash Filesystem.user 
 3| `drop_dm_object_name(Filesystem)` 
 4| rename process_guid as lnk_guid 
 5| join lnk_guid _time [
 6| tstats `security_content_summariesonly` count FROM datamodel=Endpoint.Processes where Processes.process_name=* by _time span=1h Processes.parent_process_name Processes.parent_process_guid Processes.process_name Processes.dest Processes.process Processes.path 
 7| `drop_dm_object_name(Processes)` 
 8| rename parent_process_guid as lnk_guid] 
 9| `security_content_ctime(firstTime)` 
10| `security_content_ctime(lastTime)` 
11| table firstTime, lastTime, lnk_guid, user, dest, file_name, file_path, process_name, process, process_path, file_hash 
12| `process_creating_lnk_file_in_suspicious_location_filter`

Data Source

Name Platform Sourcetype Source Supported App
Sysmon EventID 1 Windows icon Windows 'xmlwineventlog' 'XmlWinEventLog:Microsoft-Windows-Sysmon/Operational' N/A

Macros Used

Name Value
security_content_ctime convert timeformat="%Y-%m-%dT%H:%M:%S" ctime($field$)
process_creating_lnk_file_in_suspicious_location_filter search *
process_creating_lnk_file_in_suspicious_location_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
T1566 Phishing Initial Access
T1566.002 Spearphishing Link Initial Access
KillChainPhase.DELIVERY
NistCategory.DE_CM
Cis18Value.CIS_13
Axiom
GOLD SOUTHFIELD
APT1
APT28
APT29
APT3
APT32
APT33
APT39
BlackTech
Cobalt Group
Confucius
EXOTIC LILY
Earth Lusca
Elderwood
Ember Bear
Evilnum
FIN4
FIN7
FIN8
Kimsuky
Lazarus Group
LazyScripter
Leviathan
LuminousMoth
Machete
Magic Hound
Mofang
Molerats
MuddyWater
Mustang Panda
Mustard Tempest
OilRig
Patchwork
Sandworm Team
Sidewinder
TA2541
TA505
Transparent Tribe
Turla
Windshift
Wizard Spider
ZIRCONIUM

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

You must be ingesting data that records filesystem and process activity from your hosts to populate the Endpoint data model. This is typically populated via endpoint detection-and-response product, such as Carbon Black, or endpoint data sources, such as Sysmon.

Known False Positives

This detection should yield little or no false positive results. It is uncommon for LNK files to be executed from temporary or user directories.

Associated Analytic Story

Risk Based Analytics (RBA)

Risk Message Risk Score Impact Confidence
A process $process_name$ that launching .lnk file in $file_path$ in host $dest$ 63 70 90
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: 7