Courses3 levels
Level 1 · Foundations11 courses
Level 2 · Core5 courses
Level 3 · Advanced5 courses
Labs8 topics
Library Practice exams AI Range Pricing Start free

Practice library / Security operations basics

Lab · Hard · 3 hoursFree account

Process Injection & Detection

Detect DLL injection, process hollowing, and reflective injection in EDR logs.

  • process-injection
  • dll-injection
  • process-hollowing
  • edr
  • detection
On this page 13 sections
  1. ·Prerequisites
  2. ·Background in five lines
  3. ·Lab Setup
  4. 1Count the events
  5. 2Read the access rights in event 10
  6. Locked: Find DLL injection
  7. Locked: Find process hollowing
  8. Locked: Find shellcode injection
  9. Locked: Write the rules
  10. Locked: Build the timeline and write the report
  11. Locked: Defence and Detection
  12. Locked: Check Your Work
  13. Locked: Clean-up

Malware hides inside trusted processes to evade antivirus and bypass application control. Cobalt Strike, Emotet and modern ransomware all inject shellcode into svchost or explorer before they run the real payload, and defenders who read the right Sysmon and ETW events catch the pattern even when the sample is new. Study DLL injection, process hollowing and reflective injection, then write three Sigma rules that catch them.

What You'll Learn

  • Explain what process injection is and why attackers use it
  • Find DLL injection in Sysmon events 10, 8 and 7
  • Find process hollowing with Sysmon events 1 and 25
  • Find shellcode injection from a thread that starts in unbacked memory
  • Match Sysmon events with ETW Threat-Intelligence events by address and process ID
  • Write three Sigma rules, run them, and check that normal activity does not match

An attacker who runs upd.exe from a temporary folder is easy to see. An attacker whose code runs inside explorer.exe is not. Process injection puts code into the memory of another process and runs it there. The code then has the name, the privileges and the network access of a trusted program. This lab does not teach how to inject. It teaches what injection looks like in the logs, so that you can find it and write rules for it.

You work as a defender. You only read log files. You never run injection code.

Walk-through. This lab is a guided walk-through of real Sysmon and ETW Threat-Intelligence output. KaliRange gives no sample files. To do the steps yourself, bring Sysmon and ETW Threat-Intelligence event logs of a process-injection incident on a Windows machine of your own lab: run the Atomic Red Team tests for technique T1055 on a Windows VM you own, with Sysmon configured to log events 1, 7, 8, 10 and 25 (the configuration under "Defence and Detection" below) and an EDR product exporting its Threat-Intelligence events. Export the Sysmon log as sysmon.evtx and sysmon.jsonl (evtx_dump -o jsonl sysmon.evtx), and the ETW export as etw-ti.jsonl, in place of this lab's example files, and replace the file names below with your own. The example output shows what such a capture looks like.

Prerequisites

For the same technique on Linux, see Linux Process Injection. For the attacker side, see Windows Evasion Techniques.

Background in five lines

  1. DLL injection. The attacker opens the target process, writes a DLL path into it and starts a thread at LoadLibraryA. The target loads the DLL from disk.
  2. Process hollowing. The attacker starts a normal program suspended, removes its code from memory, writes new code and resumes it. The process looks like svchost.exe but runs other code.
  3. Reflective and shellcode injection. The attacker writes code into the target and starts a thread at that address. No file is loaded, so no DLL load event exists.
  4. Sysmon (System Monitor, from Microsoft Sysinternals) writes these events: 1 process create, 7 image load, 8 CreateRemoteThread, 10 ProcessAccess, 25 ProcessTampering.
  5. ETW (Event Tracing for Windows) is the kernel event system. The provider Microsoft-Windows-Threat-Intelligence reports memory operations between processes. Only a protected anti-malware process can subscribe to it, so you see it through an EDR product, not through Event Viewer.

Lab Setup

Use your own Kali machine (a virtual machine is fine). You need these tools:

  1. jq to read JSON lines (package jq).
  2. chainsaw to run Sigma rules on .evtx files (release of the WithSecure Labs project).
  3. A text editor.

Put your capture in the folder ~/lab/injection/. The example below is data from the fictional workstation WS01 of CORP.LOCAL, user alice, on 12 November 2026:

  • sysmon.evtx and sysmon.jsonl: Sysmon events. The .jsonl file is the same data, one JSON object per line. You make it with evtx_dump -o jsonl sysmon.evtx.
  • etw-ti.jsonl: Threat-Intelligence events exported by your EDR.

All times are UTC. The data holds normal activity and three injection patterns.

Analyse only your own captured data. Build it on a Windows VM that you own, with no link to a production network. This lab needs no attack code. The Atomic Red Team test list for technique T1055 can make similar events on your own VM. List a test before you run it, with Invoke-AtomicTest T1055.001 -ShowDetailsBrief.

Step 1: Count the events

1

Know what is in the data

Before you hunt, learn what you have. Count the events for each ID. A log source with no event 8 or no event 10 cannot show you injection, however good your rules are.

cd ~/lab/injection
wc -l sysmon.jsonl
jq -r '.Event.System.EventID' sysmon.jsonl | sort -n | uniq -c

Example output:

299 sysmon.jsonl
    212 1
     48 7
      6 8
     31 10
      2 25

Read the result. Events 1, 7, 8, 10 and 25 are all present. Event 8 has only 6 lines, so you can read them all. Event 10 has 31 lines, so you must filter them.

Print one event 8 to see the field names.

jq 'select(.Event.System.EventID==8) | .Event.EventData' sysmon.jsonl | head -n 14

Example output:

{
  "UtcTime": "2026-11-12 09:15:12.431",
  "SourceProcessId": "5120",
  "SourceImage": "C:\\Users\\alice\\AppData\\Local\\Temp\\upd.exe",
  "TargetProcessId": "6244",
  "TargetImage": "C:\\Windows\\System32\\notepad.exe",
  "NewThreadId": "8812",
  "StartAddress": "0x00007FFC4A3E5A60",
  "StartModule": "C:\\Windows\\System32\\KERNEL32.DLL",
  "StartFunction": "LoadLibraryA"
}

The source is a program in Temp. The target is notepad.exe. The new thread starts at LoadLibraryA. Step 3 explains why this is a problem.

Step 2: Read the access rights in event 10

2

Find who opens other processes with write rights

Event 10 (ProcessAccess) records that one process opened another. It also records GrantedAccess, a bit mask of the rights. To inject, the attacker must be able to write to the memory of the target. That needs the bits PROCESS_VM_WRITE and PROCESS_VM_OPERATION.

These are the bits that matter:

BitNameMeaning
0x0002PROCESS_CREATE_THREADStart a thread in the target
0x0008PROCESS_VM_OPERATIONAllocate memory and change its protection
0x0010PROCESS_VM_READRead memory
0x0020PROCESS_VM_WRITEWrite memory
0x0400PROCESS_QUERY_INFORMATIONRead process data
0x1000PROCESS_QUERY_LIMITED_INFORMATIONRead basic process data
0x1FFFFFPROCESS_ALL_ACCESSEvery right

Add the first six: 0x1000 + 0x0400 + 0x0020 + 0x0010 + 0x0008 + 0x0002 = 0x143A. This value is the common mask for a classic remote-thread injection. A normal program that only reads status uses 0x1410 or 0x1000.

Group the event 10 lines by mask, source and target.

jq -r 'select(.Event.System.EventID==10) | .Event.EventData
  | [.GrantedAccess, .SourceImage, .TargetImage] | @tsv' sysmon.jsonl \
  | sort | uniq -c | sort -rn

Example output:

     20	0x1FFFFF	C:\Program Files\Windows Defender\MsMpEng.exe	C:\Windows\System32\svchost.exe
      9	0x1410	C:\Windows\System32\taskmgr.exe	C:\Windows\explorer.exe
      1	0x1FFFFF	C:\Users\alice\AppData\Local\Temp\upd.exe	C:\Windows\explorer.exe
      1	0x143A	C:\Users\alice\AppData\Local\Temp\upd.exe	C:\Windows\System32\notepad.exe

Look at the four groups.

  • Defender uses 0x1FFFFF 20 times. A scanner must read everything. This is normal, and a rule must exclude it by the full path of the source.
  • Task Manager uses 0x1410. This is normal.
  • upd.exe runs from Temp and opens notepad.exe with 0x143A, and opens explorer.exe with 0x1FFFFF. A program in a user folder that opens other programs with write rights is the strongest signal in this step.

Write down both lines for Step 7: the source PID is 5120.

Sign in to continue

8 more sections are for signed-in members. It is free: sign in with Google.

Related

This lab is extra practice for the course Security operations basics. Do the lessons first.Open the course