Process Creating LNK file in Suspicious Location

Original Source: [splunk source]
Name:Process Creating LNK file in Suspicious Location
id:5d814af1-1041-47b5-a9ac-d754e82e9a26
version:8
date:2024-09-30
author:Jose Hernandez, Michael Haag, Splunk
status:production
type:TTP
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.
Data_source:
  • -Sysmon EventID 11 AND Sysmon EventID 1
search:| 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
| `drop_dm_object_name(Filesystem)`
| rename process_guid as lnk_guid
| join lnk_guid _time [| 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
| `drop_dm_object_name(Processes)`
| rename parent_process_guid as lnk_guid]
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| table firstTime, lastTime, lnk_guid, user, dest, file_name, file_path, process_name, process, process_path, file_hash
| `process_creating_lnk_file_in_suspicious_location_filter`


how_to_implement: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.
References:
  -https://attack.mitre.org/techniques/T1566/001/
  -https://www.trendmicro.com/en_us/research/17/e/rising-trend-attackers-using-lnk-files-download-malware.html
  -https://twitter.com/pr0xylife/status/1590394227758104576
drilldown_searches:
name:'View the detection results for - "$dest$" and "$user$"'
search:'%original_detection_search% | search dest = "$dest$" user = "$user$"'
earliest_offset:'$info_min_time$'
latest_offset:'$info_max_time$'
name:'View risk events for the last 7 days for - "$dest$" and "$user$"'
search:'| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$dest$", "$user$") starthoursago=168 | stats count min(_time) as firstTime max(_time) as lastTime values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories) as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic) as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`'
earliest_offset:'$info_min_time$'
latest_offset:'$info_max_time$'
tags:
  analytic_story:
    - 'Spearphishing Attachments'
    - 'Qakbot'
    - 'IcedID'
    - 'Amadey'
    - 'Gozi Malware'
  asset_type:Endpoint
  confidence:90
  impact:70
  message:A process $process_name$ that launching .lnk file in $file_path$ in host $dest$
  mitre_attack_id:
    - 'T1566'
    - 'T1566.002'
  observable:
    name:'dest'
    type:'Hostname'
    - role:
      - 'Victim'
    name:'user'
    type:'User'
    - role:
      - 'Victim'
  product:
    - 'Splunk Enterprise'
    - 'Splunk Enterprise Security'
    - 'Splunk Cloud'
  required_fields:
    - '_time'
    - 'Filesystem.file_name'
    - 'Filesystem.file_path'
    - 'Filesystem.process_id'
    - 'Filesystem.file_name'
    - 'Filesystem.file_path'
    - 'Filesystem.file_hash'
    - 'Filesystem.user'
  risk_score:63
  security_domain:network

tests:
name:'True Positive Test'
 attack_data:
  data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1566.002/lnk_file_temp_folder/windows-sysmon.log
  source: XmlWinEventLog:Microsoft-Windows-Sysmon/Operational
  sourcetype: XmlWinEventLog
manual_test:None