# Malware Behavioral Analysis Process Injection

> Use when a trace or memory image shows code executing inside a process that should not contain it and you need to identify the injection technique, extract the payload, and assess intent. Covers the injection taxonomy (classic, hollowing, APC, mapping, hijacking), recognizing each in API traces, confirming with Volatility malfind, dumping injected regions, and determining what the injected code does. Use when sandbox reports show cross-process activity, when malfind reports hits, or when a legitimate process exhibits malicious behavior.

- Skill: `mizazhaider-ceh/malware-behavioral-analysis-process-injection` (Agent Skill)
- Install (CLI): `npx get-skill add mizazhaider-ceh/malware-behavioral-analysis-process-injection`
- Raw SKILL.md: https://api.skillmd.com/api/skills/mizazhaider-ceh/malware-behavioral-analysis-process-injection/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: mizazhaider-ceh (https://skillmd.com/u/mizazhaider-ceh)
- Updated: 2026-11-22
- Page: https://skillmd.com/skills/mizazhaider-ceh/malware-behavioral-analysis-process-injection

---


Process injection puts attacker code inside a legitimate process so it
inherits that process's trust, permissions, and network reputation.
For the analyst, injection is where the dropper ends and the implant
begins: the injected payload is usually the real malware. This sub-skill
covers recognizing each technique in traces, confirming in memory, and
extracting the payload for its own analysis pass. Scope: analyze
injection only from samples you are authorized to handle, in isolated
labs, during authorized DFIR or malware research.

## Quick Workflow

1. Spot the injection in the trace: cross-process alloc/write/execute
   primitives.
2. Classify the technique from the execute step (section 2).
3. Note the target process and why it was chosen (privilege, trust,
   network access).
4. Capture memory and confirm with malfind.
5. Dump the injected region and triage it as a new sample.
6. Map the technique to ATT&CK and write the detection.

## 1. The primitive sequence

Every injection is allocate, write, execute in another process:

```text
OpenProcess(target) or CreateProcess(target, SUSPENDED)
  -> VirtualAllocEx(target, ..., PAGE_EXECUTE_READWRITE)
  -> WriteProcessMemory(target, payload)
  -> <execute step varies>
```

In the trace, filter for these four calls with a process handle that is
not the caller's own. The target PID in the arguments is the victim;
the buffer size hints at the payload size. If you see alloc plus write
but no execute, the injection may have failed or the execute step uses
a technique your tracer misses (check memory).

## 2. Injection taxonomy by execute step

```text
Classic (T1055):
  ... -> CreateRemoteThread(target, start=payload)
  Loudest; the new thread is visible in thread listings.

Process hollowing (T1055.012):
  CreateProcess(target, CREATE_SUSPENDED) -> NtUnmapViewOfSection ->
  WriteProcessMemory -> SetThreadContext(entry=payload) -> ResumeThread
  The hollowed process looks legitimate (explorer.exe, svchost.exe)
  but runs attacker code from its entry point.

APC injection (T1055.004):
  ... -> OpenThread(target thread) -> QueueUserAPC(payload) ->
  thread enters alertable wait -> payload runs
  Quieter; look for QueueUserAPC with a non-system address.

Module stomping / mapping (T1055):
  ... -> NtMapViewOfSection / MapViewOfFile into target
  Shows as image loads rather than memory writes; check loaded
  module lists for unsigned images in system processes.

Thread hijacking (T1055.003):
  ... -> SuspendThread -> GetThreadContext ->
  SetThreadContext(rip=payload) -> ResumeThread
  No new thread; an existing thread gets redirected.
```

Classify by the execute call; when the trace is ambiguous, memory
forensics decides (a hollowed process has one image replaced, a mapped
injection shows an extra image).

## 3. Confirming with Volatility malfind

```bash
vol -f mem.dmp windows.malfind.Malfind --dump
```

Example output shape:

```text
explorer.exe  pid 1232  vad 0x1a0000-0x1b0000  PAGE_EXECUTE_READWRITE
  MZ header present, no mapped file, no VAD tag match
  -> dumped to: malfind.1232.1a0000-1b0000.dmp

svchost.exe   pid 880   vad 0x2c0000-0x2e0000  PAGE_EXECUTE_READWRITE
  no MZ header, heap-like content -> possible shellcode, dumped
```

malfind flags executable private memory, which legitimate processes
rarely have. The MZ-present hit is a PE payload (triage it as a new
sample); the no-MZ hit may be shellcode (disassemble it directly).
Always use --dump: the dumped region is your next analysis input.

## 4. Target selection analysis

Why this target matters for intent:

```text
explorer.exe / svchost.exe  -> blend in, survive user scrutiny
lsass.exe                   -> credential theft (T1003)
browser processes           -> session/data theft, traffic blending
services.exe                -> persistence-adjacent, SYSTEM privileges
```

A loader injecting into lsass is after credentials; into a browser is
after sessions. Record the target and the inference; it shapes the
incident's data-exposure assessment.

## 5. Extracting and analyzing the payload

```bash
# The malfind dump is now a sample: hash it first
sha256sum malfind.1232.1a0000-1b0000.dmp

# Triage as usual
floss -n 8 malfind.1232.1a0000-1b0000.dmp | head -40
diec malfind.1232.1a0000-1b0000.dmp
```

Dumped regions may lack PE headers (raw shellcode) or have partial
headers (hollowed image). For headerless dumps, disassemble from the
entry bytes; for partial PEs, graft headers from a template or analyze
in the debugger. The payload often contains the C2 config in clearer
form than the dropper did.

## Edge cases

- Injection into newly spawned vs existing processes: hollowing needs
  a suspended child; classic injection needs an existing target.
  The trace shows which.
- Self-injection (alloc/write in own process): technique-wise
  uninteresting, but the RWX self-allocation is still a detection
  signal.
- Injection chains: payload A injects payload B into a third process.
  Follow each hop; the final payload is usually the implant.
- Failed injections: access denied on protected processes (PPL);
  the attempt is still evidence of intent.
- .NET payloads injected as assemblies: dump and analyze with
  .NET tooling, not as native code.

## Escalation

- If injection targets a protected process (PPL, lsass with
  Credential Guard), memory acquisition may need kernel-level tools;
  escalate rather than fighting user-mode limitations.
- If the injected payload resists dumping (encrypted in memory,
  hooks the dumper), escalate to debugger-based extraction at the
  payload's own decode point.

- If the injected payload hooks security products in the target process, escalate: the host's defenses may be blind until reboot.
- If injection crosses session boundaries (session 0 to user), escalate the privilege analysis; that changes the incident scope.

## Detection and defender view

Injection primitives are high-value EDR telemetry: alert on
cross-process VirtualAllocEx plus WriteProcessMemory plus
CreateRemoteThread from unusual parents. Tune per environment: some
legitimate software injects (AV, accessibility tools); allowlist by
signer and parent. Hollowed processes betray themselves via image
path vs command-line mismatches and unsigned code in signed
processes; hunt those properties, not just the API sequence. Map each
confirmed injection to T1055 sub-techniques for the coverage matrix.

## Key references

- MITRE ATT&CK T1055 and sub-techniques:
  https://attack.mitre.org/techniques/T1055/
- Volatility 3 malfind documentation:
  https://volatility3.readthedocs.io/
- Practical Malware Analysis (Sikorski and Honig), Chapter 12
  (covert malware launching: injection)
- MITRE ATT&CK T1003 (OS Credential Dumping):
  https://attack.mitre.org/techniques/T1003/

- MITRE ATT&CK T1055.012 (Process Hollowing):
  https://attack.mitre.org/techniques/T1055/012/

