Detect Installer Packages in Splunk
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.
MITRE ATT&CK
- Tactic
- Privilege Escalation Persistence
- Technique
- T1546 Event Triggered Execution
- Sub-technique
- T1546.016 Installer Packages
- Canonical reference
- https://attack.mitre.org/techniques/T1546/016/
SPL Detection Query
index=wineventlog (sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" OR sourcetype="WinEventLog:Security")
| eval IsInstallerParent=if(
(EventCode=1 OR EventCode=4688)
AND match(lower(coalesce(ParentImage, "", ParentProcessName, "")),
"(msiexec|installer|pkgutil|dpkg|rpm|chocolatey|winget)"),
1, 0
)
| eval IsScriptChild=if(
IsInstallerParent=1
AND match(lower(coalesce(Image, NewProcessName, "")),
"(powershell|pwsh|cmd\.exe|wscript|cscript|mshta|certutil|bitsadmin|bash|python)"),
1, 0
)
| eval HasSuspiciousArgs=if(
match(lower(coalesce(CommandLine, "", NewProcessCommandLine, "")),
"(invoke-webrequest|downloadstring|net\.webclient|curl\s|wget\s|-encodedcommand|certutil.*urlcache)"),
1, 0
)
| eval IsNetworkInstaller=if(
EventCode=3
AND match(lower(coalesce(Image, "")), "(msiexec|installer)")
AND NOT match(DestinationIp, "(10\.|172\.16\.|192\.168\.|127\.)"),
1, 0
)
| where IsScriptChild=1 OR (HasSuspiciousArgs=1 AND IsInstallerParent=1) OR IsNetworkInstaller=1
| eval DetectionType=case(
HasSuspiciousArgs=1 AND IsScriptChild=1, "INSTALLER_DOWNLOAD_CRADLE",
IsScriptChild=1, "INSTALLER_SCRIPT_CHILD",
IsNetworkInstaller=1, "INSTALLER_NETWORK_CALLBACK",
1=1, "INSTALLER_SUSPICIOUS_ACTIVITY"
)
| table _time, host, User, EventCode, DetectionType, Image, CommandLine, ParentImage
| sort - _time Detects suspicious installer package activity on Windows using Sysmon process and network events. Categorizes detections: INSTALLER_DOWNLOAD_CRADLE (installer's child process contains download cradle arguments — high priority), INSTALLER_SCRIPT_CHILD (installer spawned a scripting engine without download patterns — medium priority), INSTALLER_NETWORK_CALLBACK (installer process makes outbound internet connection — investigate). Focus on download cradle patterns as these indicate the installer is fetching additional malicious payloads.
Data Sources
Required Sourcetypes
False Positives & Tuning
- Legitimate software downloading additional components during installation
- Package managers running pre/post-install scripts
- Enterprise deployment tools executing management scripts
- Development toolchains compiling or configuring during installation
Other platforms for T1546.016
Testing Methodology
Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1MSI Custom Action Spawning PowerShell
Expected signal: Process creation for msiexec.exe. Subsequent process creation for powershell.exe. The parent-child relationship (msiexec -> powershell) combined with the powershell command line arguments is the detection trigger.
- Test 2Package Manager Post-Install Script with Network Call
Expected signal: Process creation for pip install. Child process for python executing setup.py post-install hook. Child process for curl with the callback URL. The pip->python->curl chain is the detection signal.
- Test 3MSI Silent Installation with Custom Action Tracking
Expected signal: Process creation for msiexec.exe or cmd.exe spawned from installer context. File creation for custom_action_test.txt. Windows Installer Application event log entries for custom action execution.
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.