Security Engineering / Fundamentals / Windows
Fundamental 02

Windows
internals Most EDR detections, most ATT&CK techniques and most incident triage happen here. You do not need to write kernel drivers — you need to read a process tree, know which parent-child pairs are impossible, and understand tokens well enough to explain how one click became domain admin.

feeds → SentinelOne, SecOps5 tiers
Tier 0 · Groundthe objects

What Windows is made of

Five object types explain nearly all endpoint telemetry: processes, threads, tokens, handles and registry keys.

Module 0.1

Processes, threads and the tree

Parent-child relationships are the core detection primitive

A process is a container: private virtual memory, loaded modules (DLLs), handles, and a security token. Threads execute inside it. Every process except the first has a parent, and that lineage is what EDR records.

Normal: Suspicious: explorer.exe WINWORD.EXE └─ chrome.exe └─ cmd.exe └─ chrome.exe (renderer) └─ powershell.exe -enc SQBFAF... └─ rundll32.exe

Office spawning a shell is the canonical "impossible parent". So is w3wp.exe (IIS) spawning cmd.exe — that is a web shell. Learning ten of these pairs gets you further than any signature list.

Processes you must recognise

ProcessLegit parentNormal countAbuse
System / smss.exe1Name-spoofing imposters elsewhere on disk
csrss.exesmss (gone)2+Fake copies in user paths
wininit / winlogonsmss (gone)1 eachSession hijack, sticky-keys backdoor
services.exewininit1Parent of malicious services
svchost.exeservices.exemanyWrong parent = injection; always check -k group
lsass.exewininit1Credential dumping target
explorer.exeuserinit (gone)1 per sessionParent of user-launched anything
Rule of thumb: the right question is rarely "is this binary malicious?" but "is this combination — binary, parent, command line, user, path, signer — normal in this estate?" That is exactly how SentinelOne's Storyline and a SIEM behavioural rule both think.
Module 0.2

Identity on Windows: SIDs, tokens, integrity levels

Why "admin" is more complicated than it sounds
  • SID — the real identifier for a principal, e.g. S-1-5-21-…-1103. Names are cosmetic; SIDs are what ACLs store. Well-known ones worth recognising: S-1-5-18 SYSTEM, S-1-5-32-544 Administrators, RID 500 the built-in Administrator, 512 Domain Admins.
  • Access token — attached to every process: user SID, group SIDs, and privileges such as SeDebugPrivilege (read any process memory) or SeImpersonatePrivilege (the basis of the "potato" escalations).
  • Integrity levels — Low / Medium / High / System. A normal admin's shell runs Medium until UAC elevation makes it High. Browsers sandbox renderers at Low.
  • SYSTEM ≠ Domain Admin. SYSTEM is total power on one machine; Domain Admin is power over the directory. Attack chains are usually local privilege escalation to SYSTEM, then credential theft, then lateral movement toward the second.
Module 0.3

Registry and filesystem geography

Where persistence hides
# hives
HKLM  machine-wide config      HKCU  current user
HKLM\SYSTEM\CurrentControlSet\Services      services + drivers
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run   classic autorun
HKCU\...\Windows\CurrentVersion\Explorer\Shell Folders\Startup
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options
                                            debugger hijack (sticky keys)
# paths that matter
C:\Windows\System32          signed OS binaries — the LOLBin pantry
C:\Users\<u>\AppData\Local\Temp   payload staging
C:\Users\<u>\AppData\Roaming     persistence, browser profiles
C:\ProgramData                   world-writable-ish, malware favourite
\\?\C:\$Recycle.Bin              hiding in plain sight

Execution from Temp, ProgramData or a user's Downloads, by an unsigned binary, is a three-signal stack that should always be worth a look.

Tier 1 · Mechanicshow attacks work

Execution, persistence, credentials

Module 1.1

LOLBins — living off the land

Signed Microsoft binaries doing attacker work

Attackers prefer built-in, signed tools because allow-listing and reputation checks pass them. Know these on sight:

BinaryLegit jobAbuse
powershell.exeAutomation-enc base64, download cradles, in-memory execution
rundll32.exeRun a DLL exportExecute payload DLLs, proxy execution
regsvr32.exeRegister COMScriptlet execution from a URL (Squiblydoo)
mshta.exeRun HTA filesRemote script execution
certutil.exeCertificates-urlcache -f = file downloader; base64 decode
bitsadmin / curl.exeTransfersStealthy download of stage 2
wmic.exeManagementRemote process creation, lateral movement
msbuild.exeBuildCompile and run inline C# payloads
rundll32 comsvcs.dll MiniDumpDump LSASS without external tools

Detection approach: do not block the binaries — most break the OS. Detect anomalous invocation: certutil with a URL, regsvr32 with scrobj.dll, PowerShell with encoded commands from an Office parent, rundll32 with no arguments.

Module 1.2

Persistence mechanisms

The dozen places to check on every host
  • Run/RunOnce keys — noisy but still used constantly.
  • Scheduled tasksschtasks /create; check C:\Windows\System32\Tasks for XML with odd actions.
  • Services — a new service pointing at a user-writable path, or a legitimate service with its ImagePath changed.
  • WMI event subscriptions — filter + consumer + binding; fileless and frequently missed by manual checks.
  • Startup folder — per-user and all-users shortcuts.
  • DLL search-order / side-loading — a legitimate signed EXE in a folder with a malicious DLL beside it.
  • COM hijacking — HKCU CLSID entries overriding system COM objects.
  • Accessibility backdoors — sethc.exe / utilman.exe replaced or IFEO-debugged.
  • Boot/logon scripts, GPO — domain-wide persistence, the nastiest variety.
Triage habit: in SentinelOne, pivot from a detection to the Storyline and check for any of the above appearing after the initial execution. In the SIEM, the equivalent UDM events are process launches of schtasks/sc/reg and registry-write events under the autorun keys.
Module 1.3

Credentials: LSASS, hashes, tickets

Pass-the-hash explained without hand-waving

LSASS holds authentication material for logged-on users so they are not re-prompted: NTLM hashes, Kerberos tickets, sometimes plaintext with legacy providers. Dumping its memory is therefore the single highest-value action on a Windows host, and any process opening a handle to lsass.exe with read-memory rights deserves an alert.

  • Pass-the-hash — NTLM authentication proves knowledge of the hash, not the password. Steal the hash, authenticate as the user, never crack anything.
  • Pass-the-ticket / Kerberoasting — request a service ticket encrypted with a service account's password hash, crack it offline. Service accounts with weak passwords and SPNs are the classic path.
  • Token impersonation — reuse a token already present on the machine rather than credentials at all.
  • DPAPI — protects browser-saved passwords and cookies; SYSTEM-level access plus the master key unlocks them, which is how session-cookie theft happens post-compromise.

Defensive levers worth naming in a design review: Credential Guard (isolates LSASS secrets in VBS), Protected Process Light on LSASS, tiered administration (admins never log into workstations), LAPS for unique local admin passwords, and disabling NTLM where possible.

Module 1.4

Lateral movement and Active Directory

SMB, WMI, WinRM, RDP — and what each leaves behind
TechniquePortArtefact on target
PsExec-style service445New service, ADMIN$ write, 7045 event
WMI (wmiexec)135 + dynamicWmiPrvSE.exe spawning cmd.exe
WinRM / PowerShell Remoting5985/5986wsmprovhost.exe as parent
RDP3389Type 10 logon, rdpclip.exe
Scheduled task remote445Task XML created remotely

Logon types in event 4624 are the fastest triage field: 2 interactive, 3 network (SMB/share), 10 RemoteInteractive (RDP), 5 service, 9 new-credentials (runas /netonly — often tooling). A wave of type 3 logons from one workstation to many servers is lateral movement in one line.

Drill 1

svchost.exe appears with parent explorer.exe, running from C:\Users\jsmith\AppData\Local\Temp\. Verdict?

Wrong parent and wrong path. Genuine svchost.exe is spawned by services.exe from C:\Windows\System32, always with a -k group argument. A copy in a user Temp directory launched from Explorer is name-spoofing — a technique that works precisely because analysts recognise the name and relax. Hash lookup is useful later; the structural facts already decide it.
Tier 2 · Operatetelemetry

Logs, event IDs and live triage

Module 2.1

The event IDs worth memorising

Security, Sysmon and PowerShell channels
IDChannelMeaning
4624 / 4625SecuritySuccessful / failed logon (check Logon Type)
4648SecurityExplicit credentials used — runas, lateral movement
4672SecuritySpecial privileges assigned — admin logon
4688SecurityProcess creation (enable command-line auditing!)
4720 / 4732SecurityUser created / added to privileged group
4768 / 4769DC SecurityKerberos TGT / service ticket — Kerberoasting shows here
7045SystemNew service installed — PsExec-style movement
Sysmon 1 / 3 / 7 / 8 / 11 / 22SysmonProcess, network, image load, remote thread, file create, DNS
4104PowerShellScript block logging — the deobfuscated script text
Defaults lie. 4688 command lines and PowerShell 4104 script-block logging are off by default. If nobody enabled them via GPO/Intune, your SIEM has process names but not arguments — and almost every good detection needs arguments. Verify this rather than assuming.
Module 2.2

Live triage commands

What to run when you have a shell on a suspect host
# who and what
whoami /all                       SID, groups, privileges
tasklist /svc
wmic process get Name,ProcessId,ParentProcessId,CommandLine
Get-CimInstance Win32_Process | Select Name,ProcessId,ParentProcessId,CommandLine

# network → process pivot
netstat -ano | findstr ESTABLISHED
Get-NetTCPConnection -State Established | Select LocalPort,RemoteAddress,RemotePort,OwningProcess

# persistence sweep
Get-ScheduledTask | Where State -ne "Disabled" | Select TaskName,TaskPath
Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
Get-CimInstance -Namespace root\subscription -Class __EventFilter
Get-Service | Where {$_.Status -eq "Running"} | Select Name,DisplayName

# signing and hashes
Get-AuthenticodeSignature C:\path\to.exe
Get-FileHash -Algorithm SHA256 C:\path\to.exe

In practice you will run most of this through SentinelOne's remote shell or its Deep Visibility queries rather than by hand — but knowing the native equivalents means you can validate what the tool tells you.

Tier 3 · Engineerhardening & detection

Making Windows expensive to attack

Module 3.1

Hardening that actually moves the needle

Ordered by value per hour spent
  1. Remove local admin from standard users. Single biggest reduction in attack success.
  2. Application control — WDAC or AppLocker in audit then enforce; blocks the unsigned-binary-from-Temp class entirely.
  3. ASR rules (Defender Attack Surface Reduction) — block Office child processes, credential stealing from LSASS, executable content from mail. Deploy in audit first.
  4. Credential Guard + LAPS + tiered admin — breaks the hash-reuse chain.
  5. Patch cadence — 14 days for high/critical is the Cyber Essentials bar and a reasonable internal SLA.
  6. Macro policy — block macros from the internet; still one of the highest-yield settings in existence.
  7. Baseline to CIS Benchmarks — gives you a defensible, measurable configuration standard, and maps neatly to what auditors ask for.
Module 3.2

Writing endpoint detections that survive

Behaviour over indicators

Rank your detection ideas by how expensive they are for an attacker to evade — the classic pyramid: hashes are free to change, IPs and domains cheap, tools moderate, behaviours (TTPs) expensive.

# pseudo-logic that generalises well
parent IN (winword,excel,outlook,powerpnt) AND child IN (cmd,powershell,wscript,mshta)
process=powershell AND cmdline CONTAINS ANY (-enc, -w hidden, downloadstring, frombase64)
process opens HANDLE to lsass.exe WITH access 0x1010 AND process NOT IN (known_edr, taskmgr)
new_service WITH image_path NOT UNDER (C:\Windows, C:\Program Files)
schtasks CREATE WHERE task_action CONTAINS (powershell, rundll32, %temp%)

Every rule needs three things before it ships: an ATT&CK technique ID, a known false-positive list from your own estate (backup agents, RMM tools and installers cause most of them), and a documented response action. A rule with no response instruction is a rule the on-call will close as "informational".

Referencesearchable

Glossary