Installer Packages
Adversaries may establish persistence and elevate privileges by using an installer package to execute malicious content. Installer packages are setup utilities for applications bundled with an installer utility and can be distributed through legitimate channels. Malicious code can be embedded within installer packages to create backdoors and establish persistence. Installer utilities such as msiexec.exe (Windows MSI), macOS pkgutil, and Linux dpkg/rpm allow adversaries to run pre-install and post-install scripts. These scripts can execute arbitrary code with elevated privileges during the installation process. Additionally, malicious code within the installer can establish persistence by deploying backdoors as scheduled tasks, services, or startup items.
let MsiScriptPatterns = dynamic([
"powershell", "cmd.exe", "wscript", "cscript", "mshta",
"certutil", "bitsadmin", "Invoke-WebRequest", "DownloadString",
"Net.WebClient", "curl", "wget"
]);
let InstallerChildren = DeviceProcessEvents
| where Timestamp > ago(24h)
| where InitiatingProcessFileName in~ ("msiexec.exe", "installer", "pkgutil", "dpkg", "rpm", "yum", "apt")
| where FileName in~ (
"powershell.exe", "pwsh.exe", "cmd.exe", "wscript.exe", "cscript.exe",
"mshta.exe", "certutil.exe", "bitsadmin.exe", "bash", "sh", "python3", "python"
)
| extend SuspiciousCommand = ProcessCommandLine has_any (MsiScriptPatterns)
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
InitiatingProcessFileName, SuspiciousCommand;
let MsiDownloadIndicators = DeviceNetworkEvents
| where Timestamp > ago(24h)
| where InitiatingProcessFileName in~ ("msiexec.exe", "installer")
| where RemoteIPType == "Public"
| project NetTime=Timestamp, DeviceName, AccountName, RemoteIP, RemotePort, InitiatingProcessFileName;
union (InstallerChildren | extend EventType="INSTALLER_CHILD_PROCESS"),
(MsiDownloadIndicators | extend EventType="INSTALLER_NETWORK_ACTIVITY")
| sort by Timestamp desc, NetTime desc Data Sources
Required Tables
False Positives
- Legitimate software installers that download additional components during installation (e.g., Visual Studio, Adobe products, game installers)
- Package managers (npm, pip, cargo) that run pre/post-install scripts as part of package installation
- Enterprise software deployment tools (SCCM, Intune, Munki, Chocolatey) that execute scripts as part of managed software installation
- Development toolchains that compile code or configure environments during installation via shell scripts
References (5)
- https://attack.mitre.org/techniques/T1546/016/
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1546.016/T1546.016.md
- https://docs.microsoft.com/en-us/windows/win32/msi/custom-actions
- https://arstechnica.com/information-technology/2022/01/researchers-find-hundreds-of-compromised-npm-packages-stealing-data/
- https://unit42.paloaltonetworks.com/atoms/supply-chain-compromise/
Unlock Pro Content
Get the full detection package for T1546.016 including response playbook, investigation guide, and atomic red team tests.