Name:Windows Run Key Self Registration From User Writable Path id:d45cc449-f293-4b09-9f7c-611a01e159f4 version:1 date:None author:Onur Mustafa Erdogan, Splunk status:production type:TTP Description:The following analytic detects a binary located in a user-writable directory
(C:\Users, C:\ProgramData or C:\PerfLogs) that registers itself for persistence by
writing its own path into a CurrentVersion Run registry key. This activity is significant
because malware delivered through ClickFix-style remote MSI installations (such as
NodeJS based loaders or DeElevate64.exe) commonly drops its payload into the user
profile and then adds itself to the Run key to survive reboots. If confirmed malicious,
this could allow an attacker to maintain persistent access to the endpoint every time
the user logs in.
Data_source:
-Sysmon EventID 13
search:`sysmon` EventCode=13 registry_path = "*\\Microsoft\\Windows\\CurrentVersion\\Run*" process_path IN ("*:\\Users\\*", "*:\\ProgramData\\*", "*:\\PerfLogs\\*") NOT process_name IN ( "Amazon WorkDocs Companion.exe", "Balto.exe", "GoToForTeams.exe", "IWDesktop.exe", "JTTray.exe", "Microsoft.SharePoint.exe", "OfficeAtHandForTeams.exe", "OneDrive.Sync.Service.exe", "opera.exe", "Print to Fax.exe", "QSHelper.exe", "RingCentralForTeams.exe", "UniKeyNT.exe" )
| where lower(process_path)=lower(replace(registry_value_data,"[\x22\x27]",""))
| stats count min(_time) as firstTime max(_time) as lastTime by dest user process_guid process_id process_name process_path registry_path registry_value_name registry_value_data vendor_product
how_to_implement:This search requires Sysmon logs with a Sysmon configuration that includes EventID 13 (Registry value set) for the CurrentVersion Run keys.
If you are using Sysmon, you must have at least version 2.0 of the official Sysmon TA.
This search uses an input macro named `sysmon`. We strongly recommend that you specify your environment-specific configurations (index, source, sourcetype, etc.) for Windows Sysmon logs.
Replace the macro definition with configurations for your Splunk environment.
The search also uses a post-filter macro designed to filter out known false positives.
Update the process name exclusion list with software in your environment that legitimately registers itself in the Run key.
known_false_positives:Per-user installed software (for example collaboration clients, browsers, VPN clients and updaters) commonly installs into the user profile and registers itself in the Run key.
Such software will be returned by this analytic and should be added to the process name exclusion list after validation.
References: -https://attack.mitre.org/techniques/T1547/001/ -https://www.huntress.com/blog/the-evolving-tradecraft-of-clickfix drilldown_searches: name:'View the detection results for - "$dest$"' search:'%original_detection_search% | search dest = "$dest$"' earliest_offset:'$info_min_time$' latest_offset:'$info_max_time$' name:'View risk events for the last 7 days for - "$dest$"' search:'| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$dest$") | 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:'7d' latest_offset:'0' analytic_story:['Windows Persistence Techniques', 'Fake CAPTCHA Campaigns']