T1218.013 Elastic Security · Elastic

Detect Mavinject in Elastic Security

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/

Elastic Detection Query

Elastic Security (Elastic)
eql
process where event.type == "start" and process.name : "mavinject.exe" and (
  process.args : "/INJECTRUNNING" or
  process.args : "/INJECTRUNNING*" or
  process.command_line : "*mavinject*"
)
| eval inject_running = if(process.args like "/INJECTRUNNING*", 1, 0)
| eval suspicious_path = if(process.command_line like "*Temp*" or process.command_line like "*AppData*" or process.command_line like "*Downloads*" or process.command_line like "*Public*" or process.command_line like "*Desktop*", 1, 0)
| eval suspicious_parent = if(process.parent.name in ("cmd.exe", "powershell.exe", "wscript.exe", "cscript.exe", "mshta.exe", "winword.exe", "excel.exe"), 1, 0)
high severity high confidence

Detects mavinject.exe process creation with /INJECTRUNNING flag, suspicious DLL paths, or suspicious parent processes. Covers DLL injection abuse of the Microsoft Application Virtualization Injector as described in T1218.013.

Data Sources

Elastic Endpoint SecurityWindows Sysmon via Elastic AgentWinlogbeat

Required Tables

logs-endpoint.events.process-*logs-windows.sysmon_operational-*winlogbeat-*

False Positives & Tuning

  • Legitimate Microsoft App-V deployments where administrators use mavinject.exe to inject approved virtualization components into running processes
  • Automated software testing pipelines that use mavinject.exe to instrument processes for coverage or debugging purposes
  • Application compatibility tooling in enterprise environments that invokes mavinject.exe as part of sanctioned compatibility shims
Download portable Sigma rule (.yml)

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.

  1. 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.

  2. 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.

  3. 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.

Unlock Pro Content

Get the full detection package for T1218.013 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections