Skip to content
Threat Feed
medium advisory

Abuse of Mavinject.exe for DLL Injection

Attackers are abusing the native Windows binary mavinject.exe to perform arbitrary DLL injection into running processes, enabling stealthy code execution and persistence.

Mavinject.exe (Microsoft Application Virtualization Injector) is a legitimate, digitally signed Windows component intended for debugging and virtualization purposes. Threat actors frequently exploit this binary as a 'Living off the Land' (LotL) tool to perform DLL injection into target processes. By utilizing specific undocumented command-line flags such as /INJECTRUNNING and /HMODULE, an attacker can force a process to load a malicious DLL. Because mavinject.exe is a trusted system binary, this technique often bypasses security controls that primarily focus on blocking unknown or unsigned executables. This activity is a hallmark of sophisticated attackers seeking to maintain stealthy persistence and escalate privileges within a compromised host. Defenders should prioritize visibility into the command-line arguments of this binary to distinguish between legitimate maintenance tasks and malicious injection attempts.

Attack Chain

  1. The attacker gains initial access to the system via phishing, exploit, or credential compromise.
  2. The attacker stages a malicious DLL file on the local filesystem.
  3. The attacker identifies a target process ID (PID) for the intended injection.
  4. The attacker invokes mavinject.exe via command-line (e.g., mavinject.exe <PID> /INJECTRUNNING <path_to_dll>).
  5. Mavinject.exe initializes and utilizes its injection functionality to load the specified DLL into the target process memory space.
  6. The malicious code within the injected DLL executes in the context of the target process, bypassing traditional security boundary checks.
  7. The attacker leverages the code execution for persistence, further credential theft, or lateral movement.

Impact

Successful abuse of mavinject.exe allows for arbitrary code execution within the context of arbitrary running processes. This can lead to full system compromise, the installation of persistent backdoors, and the bypass of security monitoring that fails to inspect the legitimacy of injected modules or the command-line arguments of trusted binaries.

Recommendation

Prioritize the implementation of EDR-based monitoring to capture process-level command-line execution telemetry.

  • Deploy the provided Sigma rule to detect the use of sensitive mavinject.exe command-line parameters.
  • Baseline legitimate usage of mavinject.exe in the environment to reduce false positives by filtering known-good parent processes or specific DLL paths.
  • Ensure that process-creation logs (Event ID 1 or 4688) capture the full command line to facilitate detection.

Immediate actions

Deploy detection rule to identify mavinject.exe misuse.

Detection Engineering 24h

Threat Hunt

Search historical logs for any execution of mavinject.exe with /INJECTRUNNING or /HMODULE flags.

T1218.013 high high confidence hunt now

Data: Process creation logs with full command-line arguments

Mitigations

Restrict execution of mavinject.exe to necessary service accounts or administrative contexts only.

medium_term IT Operations

T1218.013

Detection coverage 1

Detect Mavinject DLL Injection

medium

Detects the use of mavinject.exe with command-line arguments indicative of DLL injection into running processes.

sigma tactics: defense_evasion techniques: T1218.013 sources: process_creation, windows

Detection queries are available on the platform. Get full rules →