$npx -y skills add meltedinhex/analyst-ai-pack --skill detecting-process-injection-in-memoryDetects process injection in a memory image by identifying private executable regions
| 1 | # Detecting Process Injection in Memory |
| 2 | |
| 3 | ## When to Use |
| 4 | |
| 5 | - You have a Windows memory image and want to find injected/hollowed code. |
| 6 | - You are triaging private RWX regions, unbacked executable memory, and PE headers in private |
| 7 | allocations (classic injection/hollowing signs). |
| 8 | |
| 9 | **Do not use** this on a live production host without authorization — work from an acquired image. |
| 10 | This skill interprets analysis output; run Volatility separately on the image. |
| 11 | |
| 12 | ## Prerequisites |
| 13 | |
| 14 | - A memory image and Volatility 3 (`windows.malfind`, `windows.vadinfo`) installed. |
| 15 | |
| 16 | ## Safety & Handling |
| 17 | |
| 18 | - Treat carved injected regions as live malicious code; store them password-protected. |
| 19 | |
| 20 | ## Workflow |
| 21 | |
| 22 | ### Step 1: Run malfind and capture output |
| 23 | |
| 24 | ```bash |
| 25 | vol -f memory.raw windows.malfind > malfind.txt |
| 26 | ``` |
| 27 | |
| 28 | ### Step 2: Score injection candidates |
| 29 | |
| 30 | ```bash |
| 31 | python scripts/analyst.py score malfind.txt |
| 32 | ``` |
| 33 | |
| 34 | Flags regions with `PAGE_EXECUTE_READWRITE`, MZ/PE headers in private memory, and shellcode-like |
| 35 | disassembly hints, ranking processes by suspicion. |
| 36 | |
| 37 | ### Step 3: Corroborate |
| 38 | |
| 39 | Cross-check flagged PIDs with `windows.vadinfo` (private, executable, no mapped file) and the |
| 40 | process tree for anomalous parents. |
| 41 | |
| 42 | ### Step 4: Carve and route |
| 43 | |
| 44 | Carve the injected region for follow-on shellcode/PE recovery and analysis. |
| 45 | |
| 46 | ## Validation |
| 47 | |
| 48 | - Flagged regions are private + executable, not legitimate mapped images. |
| 49 | - PE-in-private-memory findings are confirmed by an MZ/`This program` signature. |
| 50 | - High-scoring PIDs corroborate with VAD protections and process-tree anomalies. |
| 51 | |
| 52 | ## Pitfalls |
| 53 | |
| 54 | - JIT engines (.NET, Java, browsers) legitimately create RWX regions — corroborate before alerting. |
| 55 | - Relying on malfind alone; pair with vadinfo and ldrmodules. |
| 56 | - Missing hollowing where the region is RX (not RWX) after protection change. |
| 57 | |
| 58 | ## References |
| 59 | |
| 60 | - See [`references/api-reference.md`](references/api-reference.md) for the scorer. |
| 61 | - ATT&CK T1055 and Volatility 3 docs (linked in frontmatter). |