Windows PowerShell MSIX Package Installation
Description
The following analytic detects the execution of PowerShell commands to install unsigned AppX packages using Add-AppxPackage or Add-AppPackage cmdlets with the -AllowUnsigned flag. This detection leverages PowerShell Script Block Logging (EventCode=4104) to capture the full command content. This activity is significant as adversaries may use unsigned AppX packages to install malicious applications, bypass security controls, or establish persistence. If confirmed malicious, this could allow attackers to install unauthorized applications that may contain malware, backdoors, or other malicious components.
Query · spl
`powershell` EventCode=4104 ScriptBlockText IN("*Add-AppPackage *", "*Add-AppxPackage *") AND ScriptBlockText IN ("* -AllowUnsigned*")
| fillnull
| stats count min(_time) as firstTime max(_time) as lastTime
BY dest signature signature_id
user_id vendor_product EventID
Guid Opcode Name
Path ProcessID ScriptBlockId
ScriptBlockText
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `windows_powershell_msix_package_installation_filter`
| `windows_powershell_msix_package_installation_filter`
Implementation guide
The following analytic requires PowerShell operational logs to be imported. Modify the powershell macro as needed to match the sourcetype or add index. This analytic is specific to 4104, or PowerShell Script Block Logging. Ensure PowerShell Script Block Logging is enabled in your environment to capture the full command content.
Known false positives
- Installation of unsigned packages for testing purposes by developers or system administrators. Legitimate software development and testing activities may trigger this detection. Internal application development teams testing MSIX packages before signing. System administrators installing custom unsigned applications for business purposes. Note: The -AllowUnsigned flag is only available on Windows 11 and later versions.
Analyst notes
Known false positives: Installation of unsigned packages for testing purposes by developers or system administrators. Legitimate software development and testing activities may trigger this detection. Internal application development teams testing MSIX packages before signing. System administrators installing custom unsigned applications for business purposes. Note: The -AllowUnsigned flag is only available on Windows 11 and later versions.