Detect Mavinject in Splunk
Adversaries may abuse mavinject.exe to proxy execution of malicious code. Mavinject.exe is the Microsoft Application Virtualization Injector, a Windows utility that can inject code into external processes as part of Microsoft Application Virtualization (App-V). Adversaries abuse it to inject malicious DLLs into running processes (DLL injection) using the /INJECTRUNNING flag. Since mavinject.exe is a signed Microsoft binary, it can bypass application control. TONESHELL malware has been observed using mavinject.exe for process injection.
MITRE ATT&CK
- Tactic
- Defense Evasion
- Technique
- T1218 System Binary Proxy Execution
- Sub-technique
- T1218.013 Mavinject
- Canonical reference
- https://attack.mitre.org/techniques/T1218/013/
SPL Detection Query
index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
Image="*\\mavinject.exe"
| eval InjectRunning=if(match(CommandLine, "/INJECTRUNNING"), 1, 0)
| eval SuspiciousPath=if(match(CommandLine, "(Temp|AppData|Downloads|Public|Desktop)"), 1, 0)
| eval SuspiciousParent=if(match(ParentImage, "(cmd|powershell|wscript|cscript|mshta|winword|excel)\.exe"), 1, 0)
| eval RiskScore=InjectRunning + SuspiciousPath + SuspiciousParent
| where RiskScore > 0
| table _time, host, User, CommandLine, ParentImage, ParentCommandLine, InjectRunning, SuspiciousPath, SuspiciousParent, RiskScore
| sort - _time Detects mavinject.exe abuse using Sysmon Event ID 1. Any execution of mavinject.exe outside of known App-V infrastructure is suspicious. /INJECTRUNNING flag usage with non-App-V DLL paths is the primary indicator.
Data Sources
Required Sourcetypes
False Positives & Tuning
- Microsoft Application Virtualization (App-V) environments using mavinject.exe for virtualized application management
- App-V client infrastructure invoking mavinject.exe as part of application publishing workflows
- Enterprise App-V deployments for application compatibility management
Other platforms for T1218.013
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 1Mavinject DLL Injection into Running Process
Expected signal: Sysmon Event ID 1: mavinject.exe with /INJECTRUNNING and a PID in command line. Sysmon Event ID 8 (CreateRemoteThread) from notepad.exe. Sysmon Event ID 7 (Image Load) on notepad.exe for the injected DLL. Security Event ID 4688.
- Test 2Mavinject from PowerShell Parent
Expected signal: Sysmon Event ID 1: powershell.exe then mavinject.exe with ParentImage=powershell.exe and /INJECTRUNNING in command line. SuspiciousParent and InjectRunning both fire.
- Test 3Mavinject with DLL from Temp Directory
Expected signal: Sysmon Event ID 11: DLL written to Temp. Sysmon Event ID 1: mavinject.exe with /INJECTRUNNING and Temp path. The injection will fail (PID 4 is SYSTEM) but the process creation and file creation events fire.
References (4)
- https://attack.mitre.org/techniques/T1218/013/
- https://lolbas-project.github.io/lolbas/Binaries/Mavinject/
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1218.013/T1218.013.md
- https://www.trendmicro.com/en_us/research/25/b/earth-preta-campaign-uses-ppam-files-and-encrypted-payloads-to-evade-detection.html
Unlock Pro Content
Get the full detection package for T1218.013 including response playbook, investigation guide, and atomic red team tests.