TExcelTAD
Home › Defensive Security: SOC, SIEM, Detection Engineering & Threat Hunting › What EDR Sees: Process Injection and Credential Access

What EDR Sees: Process Injection and Credential Access

Two techniques sit in the middle of almost every serious Windows intrusion. Process injection (ATT&CK T1055) runs the attacker's code inside another, trusted process, so it inherits that process's identity and hides from process lists. Credential access from LSASS memory (T1003.001) extracts the password hashes and Kerberos tickets of everyone who logged on to a machine, which is how one compromised laptop becomes a compromised domain. This lesson stays at the level a defender needs: what each technique must do at the operating-system level, which telemetry those steps leave, how to read it, and how to make both techniques fail. It contains no injection or dumping code, and none is needed to detect them.

Process injection: the unavoidable steps

Whatever the variant (classic remote thread, APC queueing, process hollowing, thread hijacking), injecting code into another process needs the same basic steps, each of which the operating system can observe:

Step What happens Telemetry
Open the target Get a handle to another process with rights to write memory and control threads Sysmon Event ID 10 (ProcessAccess) with the granted rights; EDR process-access events
Allocate and write Reserve memory in the target and copy code into it ETW threat-intelligence events for remote allocation and write (used by EDRs)
Make it executable Mark the memory executable (often after writing it as read-write) Same; memory scans later find executable memory not backed by any file on disk
Run it Create a remote thread, queue an APC, or redirect an existing thread Sysmon Event ID 8 (CreateRemoteThread); thread-start addresses outside any loaded module
Behave The target process now does unusual things A notepad.exe or svchost.exe making network connections or spawning shells it never spawns

The last row is often the most reliable: a process behaving out of character is visible even when the injection itself was missed.

Credential access: LSASS

The Local Security Authority Subsystem Service (lsass.exe) holds credential material for logged-on users. Reading it requires opening the process with the right to read its memory (PROCESS_VM_READ), either to read it directly or to write a memory dump file. The telemetry:

  • Process access to lsass.exe (Sysmon 10, EDR) with the GrantedAccess mask, the source process and its call trace.
  • Dump files: a .dmp file created by an unusual process (Sysmon 11), or a known dumping method using a signed system DLL with rundll32.exe (a classic living-off-the-land pattern detectable by its command line).
  • Related techniques: saving the SAM and SECURITY registry hives, copying ntds.dit from a volume shadow copy on a DC, or replicating secrets from a DC with DCSync (DCSync and Replication Rights). Each has its own events.

Many legitimate programs open LSASS too (antivirus, the EDR itself, backup and monitoring agents), usually with limited rights. The detection work is separating them.

Reading GrantedAccess

The mask is a set of process-access rights ORed together. The program decodes synthetic Sysmon Event ID 10 records whose target is lsass.exe, applies an allow-list of known accessors, and flags reads of memory by anything else.

python · try it yourself
RIGHTS = {0x0001: "TERMINATE", 0x0002: "CREATE_THREAD", 0x0008: "VM_OPERATION", 0x0010: "VM_READ",
          0x0020: "VM_WRITE", 0x0040: "DUP_HANDLE", 0x0080: "CREATE_PROCESS", 0x0200: "SET_INFORMATION",
          0x0400: "QUERY_INFORMATION", 0x0800: "SUSPEND_RESUME", 0x1000: "QUERY_LIMITED_INFORMATION"}

def decode(mask):
    if mask == 0x1FFFFF:
        return ["ALL_ACCESS"]
    return [name for bit, name in RIGHTS.items() if mask & bit]

ALLOWED = {  # (source image, max rights) known to touch lsass on this fleet; owner and review date in the real list
    "C:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\4.18\\MsMpEng.exe": 0x1410,
    "C:\\Program Files\\LabEDR\\sensor.exe": 0x1410,
    "C:\\Windows\\System32\\wininit.exe": 0x1000,
}
events = [  # Sysmon Event ID 10, TargetImage = C:\Windows\System32\lsass.exe
    ("ws11", "C:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\4.18\\MsMpEng.exe", 0x1410),
    ("ws11", "C:\\Windows\\System32\\wininit.exe", 0x1000),
    ("ws12", "C:\\Windows\\System32\\taskmgr.exe", 0x1000),
    ("ws15", "C:\\Users\\Public\\lib.exe", 0x1010),
    ("ws15", "C:\\Windows\\System32\\rundll32.exe", 0x1FFFFF),
    ("srv-mon", "C:\\Program Files\\LabEDR\\sensor.exe", 0x1410),
    ("srv-mon", "C:\\Program Files\\OldMonitor\\agent.exe", 0x1410),
]
for host, src, mask in events:
    rights = decode(mask)
    name = src.rsplit("\\", 1)[1]
    allowed = ALLOWED.get(src)
    reads = "VM_READ" in rights or "ALL_ACCESS" in rights
    if allowed is not None and mask & ~allowed == 0:
        verdict = "allowed"
    elif reads:
        verdict = "ALERT: memory read of lsass"
    else:
        verdict = "info: query only"
    print(f"{host:7} {name:14} 0x{mask:06X} {'|'.join(rights):52} {verdict}")
ws11    MsMpEng.exe    0x001410 VM_READ|QUERY_INFORMATION|QUERY_LIMITED_INFORMATION  allowed
ws11    wininit.exe    0x001000 QUERY_LIMITED_INFORMATION                            allowed
ws12    taskmgr.exe    0x001000 QUERY_LIMITED_INFORMATION                            info: query only
ws15    lib.exe        0x001010 VM_READ|QUERY_LIMITED_INFORMATION                    ALERT: memory read of lsass
ws15    rundll32.exe   0x1FFFFF ALL_ACCESS                                           ALERT: memory read of lsass
srv-mon sensor.exe     0x001410 VM_READ|QUERY_INFORMATION|QUERY_LIMITED_INFORMATION  allowed
srv-mon agent.exe      0x001410 VM_READ|QUERY_INFORMATION|QUERY_LIMITED_INFORMATION  ALERT: memory read of lsass

Seven accesses to LSASS, three alerts. Defender's engine, the EDR sensor and wininit.exe are allowed because both the exact path and the rights match the list. Task Manager asked only for limited query rights, which every process list does: information, not an alert. The alerts:

  • lib.exe from C:\Users\Public (the folder the DLL came from in EDR and XDR) opened LSASS with 0x1010, query plus VM_READ: the minimal rights for reading credential memory.
  • rundll32.exe opened it with all access (0x1FFFFF) on the same host: a legitimate Windows binary used as a tool, which is why allow-lists must never be built on image names alone.
  • An old monitoring agent on srv-mon requested the same rights as the EDR sensor but is not on the list. Possibly legitimate, possibly not; either way someone must decide, and the decision goes into the allow-list with an owner.

Detection, written as rules

  • LSASS memory read by an unexpected process: Sysmon 10 / EDR, TargetImage ends with \lsass.exe, GrantedAccess includes 0x10 (VM_READ) or is all-access, source not in an allow-list of exact paths. Severity high; critical on servers and DCs.
  • Dump file creation: file events where a .dmp file is created by a process other than the Windows error-reporting service, or command lines that invoke a dump function of a system DLL through rundll32.exe.
  • Remote thread into a sensitive process: Sysmon 8 where the target is lsass.exe, a browser or a system process and the source is not a known debugger or security tool.
  • Out-of-character behaviour: processes that normally never connect to the network or spawn children doing so (notepad.exe with network connections), which catches injection variants that leave no thread event.

Write them as Sigma rules with tests (Sigma Rules, Testing Detections); allow-lists use full paths and, where possible, signer information.

How the techniques are made to fail

  • LSA protection (running LSASS as a protected process light, RunAsPPL): ordinary processes, even with admin rights, cannot open it for memory reads.
  • Credential Guard: secrets are kept in an isolated, virtualisation-based environment that LSASS itself can't hand out (LSASS, Stored Credentials and Credential Guard).
  • Attack surface reduction rule "Block credential stealing from the Windows local security authority subsystem" in Microsoft Defender.
  • Fewer credentials to steal: admins don't log on to workstations (tiering), Protected Users for privileged accounts, Windows LAPS for unique local admin passwords (Windows LAPS and gMSA).
  • Against injection: application control (WDAC) and HVCI limit what code can load and run; EDR prevention policies block known injection behaviours.

Pitfalls

  • Allow-listing by image name. rundll32.exe and taskmgr.exe are legitimate Windows binaries; what matters is the rights requested and the command line. Allow-list exact paths and rights, not names.
  • Ignoring query-only access completely. It is usually benign, but a new process querying LSASS on many hosts is still worth a hunt.
  • Assuming detection replaces protection. By the time the alert fires, the secrets may be gone; LSA protection and Credential Guard stop the theft itself.

Practice

1. Decode 0x1438 by hand.

0x1000 QUERY_LIMITED_INFORMATION + 0x0400 QUERY_INFORMATION + 0x0020 VM_WRITE + 0x0010 VM_READ + 0x0008 VM_OPERATION. Read and write of memory plus memory operations: the rights needed to change another process's memory. On lsass.exe from an unknown process: alert.

2. Why is the old monitoring agent on srv-mon an alert even though it requests the same rights as the EDR sensor?

Because it is not in the allow-list: same rights, different, unapproved source. Either it is legitimate and needs an owner-approved entry (and a question about why an old agent reads LSASS memory at all), or something is using that path. Check the binary's signature and hash before adding it.

3. Which single control would have stopped both alerting events on ws15 from reading credentials?

LSA protection (RunAsPPL): with LSASS running as a protected process, neither lib.exe nor rundll32.exe could obtain a handle with VM_READ, regardless of the user's admin rights (barring a kernel-level bypass, which itself leaves driver-load traces). Credential Guard would additionally protect the secrets even if memory were read.

Test yourself

Which Sysmon event records a process opening another process, including the rights requested?

  1. Event ID 1
  2. Event ID 3
  3. Event ID 10 (ProcessAccess)
  4. Event ID 22

Which access right in GrantedAccess indicates a read of the target's memory?

  1. QUERY_LIMITED_INFORMATION (0x1000)
  2. VM_READ (0x0010)
  3. TERMINATE (0x0001)
  4. SUSPEND_RESUME (0x0800)

Why is out-of-character behaviour a good detection for process injection?

  1. It is always present in logs
  2. Even if the injection steps are missed, the injected code makes the host process do things it never does, such as network connections or child processes
  3. It is required by ATT&CK
  4. It needs no telemetry

Which control prevents ordinary admin processes from reading LSASS memory?

  1. A longer password policy
  2. LSA protection (RunAsPPL)
  3. Disabling DNS
  4. Sysmon