LoFP LoFP / legitimate applications installed via the microsoft store or msix packages may execute powershell scripts from the windowsapps directory as part of their normal operation. verify if the msix package is from a trusted source and signed by a trusted publisher before taking action. look for additional suspicious activities like network connections to unknown domains or execution of known malicious payloads.

Techniques

Sample rules

Windows PowerShell Script From WindowsApps Directory

Description

The following analytic identifies the execution of PowerShell scripts from the WindowsApps directory, which is a common technique used in malicious MSIX package execution. This detection leverages data from Endpoint Detection and Response (EDR) agents, focusing on process command lines and parent process paths. This activity is significant as adversaries have been observed using MSIX packages with embedded PowerShell scripts (particularly StartingScriptWrapper.ps1) to execute malicious code. If confirmed malicious, this could allow attackers to execute arbitrary code, establish persistence, or deliver malware while evading traditional detection mechanisms.

Detection logic


| tstats `security_content_summariesonly` count min(_time) as firstTime max(_time) as lastTime FROM datamodel=Endpoint.Processes where Processes.process_name="powershell.exe" AND (Processes.parent_process_path="*\\WindowsApps\\*" OR Processes.process="*WindowsApps*-file *" OR Processes.process="*WindowsApps*.ps1*") by Processes.action Processes.dest Processes.original_file_name Processes.parent_process Processes.parent_process_exec Processes.parent_process_guid Processes.parent_process_id Processes.parent_process_name Processes.parent_process_path Processes.process Processes.process_exec Processes.process_guid Processes.process_hash Processes.process_id Processes.process_integrity_level Processes.process_name Processes.process_path Processes.user Processes.user_id Processes.vendor_product 
| `drop_dm_object_name("Processes")` 
| `security_content_ctime(firstTime)` 
| `security_content_ctime(lastTime)` 
| `windows_powershell_script_from_windowsapps_directory_filter`