National Cyber Warfare Foundation (NCWF)login

Windows security internals for defenders: tokens, integrity levels, and UAC


0 user ratings
2026-11-18 15:30:28
milo
Red Team (CNA)
"Windows

A defensive primer on how Windows access tokens, integrity levels, and UAC actually enforce privilege boundaries, and why understanding them is essential for authorized security teams investigating escalation paths.








TopicWindows security internals — access tokens, integrity levels, and UAC
CategoryOperating system security architecture
Primary UseUnderstanding token mechanics and IL enforcement to detect and prevent local privilege escalation during authorized assessments
Safe UseEducational analysis for defenders and authorized security professionals working in labs, incident response, and hardening engagements
Telemetry NoteToken manipulation and UAC bypass activity surfaces in Windows Event Log channels such as Security auditing (4624/4672), Sysmon events, and Microsoft-Windows-UAC operational logs

Most defenders interact with Windows access control every day without ever looking under the hood, and that gap is exactly where privilege escalation incidents hide. The Windows security model is not a single gate; it is a layered pipeline in which an access token is manufactured at logon, stamped with group memberships and integrity level, and then consulted on nearly every subsequent handle operation. When an attacker escalates privilege on a Windows host, they are almost always abusing some stage of that pipeline: stealing a richer token, running code at a higher integrity level than intended, or coaxing an auto-elevating binary into minting a full token. This essay walks through those three pillars — tokens, integrity levels, and UAC — from a defensive perspective, because hardening and detection both depend on knowing what normal looks like inside the machinery.


An access token is fundamentally a claim set that the kernel attaches to a process or thread. It contains the user SID (security identifier), group SIDs, privileges such as SeDebugPrivilege or SeImpersonatePrivilege, an integrity level field, and the restrictive token flags if any apply. Every securable object — files, registry keys, sections, processes — carries a security descriptor with a discretionary ACL and a system ACL, and the access check performed by the Security Reference Monitor compares the token's claims against those lists. The crucial defensive insight is that the token, not the binary, determines what code can touch. This is why token theft via APIs like OpenProcessToken and duplication across process boundaries is a canonical post-exploitation move: the attacker does not need to exploit the kernel, only to borrow authority already present on the box.


Integrity levels sit above the ACL model as a coarse mandatory layer inherited from the Windows Integrity Mechanism introduced with Vista. Objects and processes are labeled Low, Medium, High, or System (with Untrusted and Protected at the extremes), and the default No-Write-Up policy prevents a lower-integrity subject from obtaining write access to a higher-integrity object even when the DACL would nominally allow it. Internet Explorer's old Protected Mode and the modern AppContainer used by Edge and sandboxed applications are the visible examples: untrusted rendering code runs at Low or in an AppContainer profile, so a compromise of the renderer cannot directly rewrite binaries at Medium. When analysts triage an escalation report, the first question should be what integrity level the malicious code achieved, because Medium to High is a policy artifact of UAC, whereas High to System crosses a genuine kernel-enforced trust boundary.


UAC itself is probably the most misunderstood component in the stack. It is not a security boundary in the sense the kernel enforces one — Microsoft has said so plainly in its documentation — rather, it is an administrative convenience that splits one administrator account into a filtered Medium token for normal use and a full High token available on demand. When you see a process running as the local Administrator account yet unable to write to Program Files, you are looking at the filtered token. Elevation through consent.exe produces the shield-prompt and launches the process with the linked full token. The two tokens are connected by the LinkedToken attribute, which is why tooling that reads the linked token can detect that an interactive session belongs to an admin even while filtered.


The elevation mechanics matter for defenders because auto-elevation creates deterministic code paths an attacker can influence. Binaries signed by Microsoft and manifest-declared with autoElevate=true, installed into trusted directories, are permitted by the UAC infrastructure to elevate silently. Attackers who already hold a Medium token belonging to an admin can abuse these paths — DLL search-order issues in auto-elevating applications, COM object registrations, environment-variable manipulation at process creation — to get code running at High without ever showing a prompt. Monitoring should therefore include process-creation telemetry filtered for auto-elevating binaries spawning unusual children, and attention to HKCU Software\Classes registrations that shadow HKLM COM CLSIDs, a classic UAC bypass footprint.


Telemetry around these events is unusually good if you collect it. The Security event log records logon type and elevated group membership in event 4624 and 4672, the latter firing whenever a logon session holds administrator-equivalent groups or sensitive privileges. Sysmon event ID 1 with IntegrityLevel in the process-create fields gives you a direct, queryable record of what label each new process ran under — an alert on Medium-integrity processes spawning from High-integrity parents, or child processes of consent.exe and auto-elevators with unexpected command lines, is high-signal. Microsoft-Windows-UAC/Operational logs the elevation decisions themselves. Correlating token-related activity with authentication events lets an incident responder reconstruct exactly which token an attacker used and when.


Privileges embedded in the token deserve their own attention because several of them are escalation primitives in disguise. SeImpersonatePrivilege, granted to service accounts by default, enables the well-known pattern of coercing a higher-privileged service into authenticating and then impersonating its token — the family of techniques that made printer and potato-style abuses famous. SeBackupPrivilege and SeRestorePrivilege bypass normal ACL checks for read and write respectively, meaning a holder can pull SAM, SYSTEM, and SECURITY registry hives or any file regardless of the DACL. SeDebugPrivilege opens a door to any process, including lsass.exe, which is why its use should be restricted, monitored, and in many environments replaced by narrower delegation. Audit who holds these privileges with tools such as whoami /priv in baselining, or scripted enumeration during authorized assessments.


From a hardening standpoint, the highest-leverage configuration choices follow directly from the architecture. Accounts in the local Administrators group that are used interactively will always present a filtered-token attack surface at Medium; the countermeasure is LAPS-style local admin password randomization combined with the built-in policy that strips admin accounts from UAC token filtering, or simply avoiding interactive admin logons in favor of runas or administrative jump hosts. Enabling the UAC virtualization awareness and setting the EnableLUA and ConsentPromptBehaviorAdmin registry policies to the highest practical strictness reduces silent elevation paths. Disabling unnecessary service accounts' SeImpersonatePrivilege and rotating machine account usage shrinks the impersonation surface. None of these are exotic; they are direct consequences of how the token pipeline works.


It is also worth internalizing where the model's genuine boundaries lie, because marketing language often blurs them. Boundaries Microsoft commits to defending are the session boundary, the session-per-user boundary, and the transition from High to SYSTEM/TrustedInstaller; the transition from Medium to High within an admin's own session is explicitly not in that list. This does not make UAC useless — it raises the cost of opportunistic malware and cleanly separates daily browsing from administration — but it tells detection engineers where to draw the severity line. An alert for Medium-to-High elevation on a developer workstation with an interactive admin is a hygiene finding; the same technique on a server where no interactive admin should exist is a full-blown incident.


For authorized assessment teams, the practical workflow is to enumerate before acting: dump the current token with whoami /all, enumerate local group membership, check integrity levels via Sysmon or process explorers, and map which Se* privileges are present before assuming any path forward. For blue teams, the mirror-image exercise is maintaining a baseline of expected integrity levels and privilege grants per host class, so deviations — a scheduled task running at High, a service granted SeImpersonatePrivilege it never uses, a High-integrity rundll32 — stand out immediately. Both sides of the engagement benefit from speaking the same internal vocabulary.


Ultimately, tokens, integrity levels, and UAC form a single coherent story: the token says who you are, the integrity level says how much the system trusts you, and UAC decides when you get to drop the polite fiction of running with reduced rights. Defenders who internalize that story stop treating escalation findings as opaque magic and start reading them as properties of the pipeline — a claim was borrowed, a label was crossed, a silent elevation path was exercised. That literacy, applied in labs and authorized engagements, is what turns Windows internals knowledge from trivia into detection engineering.



Educational analysis for authorized security professionals. Use only in controlled, authorized environments.






Source: OffensiveSec
Source Link: https://www.offsecblog.com/2026/11/windows-security-internals-for.html


Comments
new comment
Nobody has commented yet. Will you be the first?
 
Forum
Red Team (CNA)



Copyright 2012 through 2026 - National Cyber Warfare Foundation - All rights reserved worldwide.