SlideShare a Scribd company logo
1 of 61
Download to read offline
Social Engineering
the Windows Kernel
James Forshaw @tiraniddo
Shakacon 2015
1
James Forshaw @tiraniddo
Obligatory Background Slide
● Researcher in Google’s
Project Zero team
● Specialize in Windows
○ Especially local privilege
escalation
● Never met a logical
vulnerability I didn’t like
2
James Forshaw @tiraniddo
What I’m Going to Talk About
● Windows Access Security
○ Security Reference Monitor
○ Access Tokens
○ Impersonation
● Kernel Token Handling Vulnerability Classes and Descriptions
● Kernel Token Handling Vulnerability Exploitation
3
James Forshaw @tiraniddo
Windows Kernel
Windows Security Components
4
Security
Reference Monitor
Process
Resource
Group SID
SACL
DACL
Security Descriptor
Owner SID
Access
Token
User Calls System Call
Handlers
Kernel and
Driver Code
Resource Access Check
Se* API
James Forshaw @tiraniddo
Security Reference Monitor
5
James Forshaw @tiraniddo
Security Access Check (SeAccessCheck)
6
Deny AccessGrant Access
IL Check
Owner
Check
DACL Check
Desired Access:
e.g. Read and Write
Access Token
Group SID
SACL
DACL
Security Descriptor
Owner SID
James Forshaw @tiraniddo
Access Token
7
User Security
Identifier
Groups
Privileges
Mandatory
Label
James Forshaw @tiraniddo
Just Another Kernel Object
kd> dt nt!_TOKEN
+0x000 TokenSource : _TOKEN_SOURCE
+0x010 TokenId : _LUID
+0x018 AuthenticationId : _LUID
+0x020 ParentTokenId : _LUID
+0x028 ExpirationTime : _LARGE_INTEGER
+0x030 TokenLock : Ptr32 _ERESOURCE
+0x034 ModifiedId : _LUID
+0x040 Privileges : _SEP_TOKEN_PRIVILEGES
+0x058 AuditPolicy : _SEP_AUDIT_POLICY
+0x078 SessionId : Uint4B
....
8
James Forshaw @tiraniddo
Token Categories
9
Normal Token Linked Token
Filtered Token LowBox Token
UAC
NtFilterToken
NtCreateLowBoxToken
James Forshaw @tiraniddo
Important Token Fields
● Token User SID
● Token ID (unique 64 bit value assigned when token created)
● Parent Token ID (parent token ID when creating filtered tokens)
● Token Group SIDs
● Token Privileges
● Token Authentication ID (64 bit value ties it to a logon session)
● Token Flags (holds pre-tested privilege check values for speed)
● Restricted Token SIDs
● Lowbox Token SIDs
10
James Forshaw @tiraniddo
● Tokens in user mode accessed via handles
● Can specify certain access rights based on DACL access check
Important Token Access Rights
11
TOKEN_DUPLICATE Required to duplicate the token
TOKEN_ASSIGN_PRIMARY Required to assign the token to a new process
TOKEN_IMPERSONATE Required to impersonate the token
TOKEN_ADJUST_DEFAULT Required to set the integrity level of a token
TOKEN_ADJUST_PRIVILEGES Required to enable/disable privileges
James Forshaw @tiraniddo
Access Token Types
12
Primary Impersonation
James Forshaw @tiraniddo
Impersonation Security Level
13
Anonymous
Identification
Impersonation
Delegation
James Forshaw @tiraniddo
Token Duplication
14
Primary Impersonation
Always Allowed
Can duplicate token’s between types if have TOKEN_DUPLICATE access on handle
Duplicated Token can be referenced with any set of access rights
James Forshaw @tiraniddo
Token Duplication
15
Primary Impersonation
Always Allowed
Only if level >= Impersonate
Can duplicate token’s between types if have TOKEN_DUPLICATE access on handle
Duplicated Token can be referenced with any set of access rights
James Forshaw @tiraniddo
Token Duplication
16
Primary Impersonation
New Token LUID for Each Token
Can duplicate token’s between types if have TOKEN_DUPLICATE access on handle
Duplicated Token can be referenced with any set of access rights
James Forshaw @tiraniddo
Setting an Impersonation Token
● Impersonation assigns a token to a thread, replaced the token used
in access checks for the majority of system calls
17
Direct Setting
SetThreadToken()
ImpersonateLoggedOnUser()
NtSetInformationThread(...)
Indirect Setting
ImpersonateNamedPipeClient()
RpcImpersonateClient()
CoImpersonateClient()
Kernel Setting
PsImpersonateClient()
SeImpersonateClient/Ex()
James Forshaw @tiraniddo
Impersonation Security
18
If Token Level
< Impersonate
If Process has
Impersonate
Privilege
ALLOWED
Restrict to
Identification
Level
If Process IL <
Token IL
If Process User
== Token User
PsImpersonateClient(...) ► SeTokenCanImpersonate(...)
James Forshaw @tiraniddo
NtAccessCheck versus SeAccessCheck
NtAccessCheck
● User mode system call
● Takes an impersonation token
handle
● Only verifies impersonation level
>= Identification
19
SeAccessCheck
● Kernel mode only
● Takes a subject context
● Verifies impersonation level >=
Impersonation
James Forshaw @tiraniddo
Identification Tokens == Fake IDs
20
● Would seem the biggest challenge is getting an impersonation
token as a normal user
● Want to get hold of local system, or potentially arbitrary user
James Forshaw @tiraniddo
Capturing Identification
Tokens
21
James Forshaw @tiraniddo
LogonUser
● Can be used to get a token if the user’s password is known
● Returns a full impersonation token which is configured for the caller
to impersonate with no additional privileges
● No need to play games
22
HANDLE hToken;
LogonUser("UserName", ".", "Password",
LOGON32_LOGON_INTERACTIVE,
LOGON32_PROVIDER_DEFAULT, &hToken);
ImpersonateLoggedOnUser(hToken);
James Forshaw @tiraniddo
UAC Linked Tokens
● If split token admin get linked token using GetTokenInformation
● Without TCB privilege you only get back an identification token
23
TOKEN_LINKED_TOKEN linked_token;
GetTokenInformation(hToken, TokenLinkedToken,
&linked_token, ...);
// Identification level token for the admin
HANDLE hToken = linked_token.LinkedToken;
James Forshaw @tiraniddo
Named Pipes
● Well known trick, get a system service to open a named pipe
● Call ImpersonateNamedPipeClient on pipe server handle
○ Normally needs pipe to be written to to get impersonation token so
send over SMB (localhostpipemynamedpipe)
● Get service like Anti-Virus to scan the path to capture token
24
HANDLE hPipe = CreateNamedPipe(".dummy", ...);
// Start Windows defender to scan localhostpipedummy
ConnectNamedPipe(hPipe, NULL);
ImpersonateNamedPipeClient(hPipe);
James Forshaw @tiraniddo
RPC/DCOM
● Many DCOM services over RPC support impersonation
● Plenty of scope for callbacks to be made as privileged user
25
// Set callback in system COM object (e.g. BITS)
HRESULT ComCallback() {
if(SUCCEEDED(CoImpersonateClient())) {
HANDLE hToken;
OpenThreadToken(GetCurrentThread(),
..., &hToken);
}
}
James Forshaw @tiraniddo
NTLM Negotiation
● LSASS exposes APIs to do network authentication
● Can get localhost NTLM authentication using redirected WebDAV
● Creates an impersonation level token even for a normal user
26
// Start fake WebDAV service on localhost
// Init a AV scan to localhostfakefake
BYTE* type1 = GetType1();
BYTE* challenge;
AcceptSecurityContext(hContext type1, &challenge);
BYTE* result = SetChallengeAndGetResult(challenge);
AcceptSecurityContext(hContext, result, ...);
QuerySecurityContextToken(hContext, &hToken);
James Forshaw @tiraniddo
Services For User (S4U)
● LsaLogonUser has an S4U mode
● At least on Windows 8.1 can get you a identification token for any
local and remote user without any privileges
● Can’t get local system/local service/network service tokens
● Can craft token source which might be useful for certain things
27
James Forshaw @tiraniddo
DEMO
Capturing Access Tokens
28
James Forshaw @tiraniddo
Vulnerability Examples
29
James Forshaw @tiraniddo
How the Kernel Code Interacts with Tokens
30
System Calls (returns a HANDLE)
● ZwCreateToken(Ex)
● ZwOpenProcessToken(Ex)
● ZwOpenThreadToken(Ex)
● ZwFilterToken
Process/Thread Manager Calls (returns a
ACCESS_TOKEN pointer)
● PsReferencePrimaryToken
● PsReferenceImpersonationToken
● PsReferenceEffectiveToken
● SeCaptureSubjectContext
Direct Access (returns a TOKEN pointer)
● EPROCESS::Token
● ETHREAD::ClientSecurity::ImpersonationToken
○ Only valid if ETHREAD::CrossThreadFlags bit
4 is set
IO Manager
● IRP_MJ_CREATE SecurityContext
James Forshaw @tiraniddo
Not Checking Impersonation Level
31
● When checking the token it’s important kernel code verifies
impersonation level
struct SECURITY_SUBJECT_CONTEXT {
PACCESS_TOKEN ClientToken;
SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
PACCESS_TOKEN PrimaryToken;
PVOID ProcessAuditId;
} context;
#define SeQuerySubjectContextToken(c)
(c->ClientToken ? c->ClientToken : c->PrimaryToken)
SeCaptureSubjectContext(&context);
// Get impersonation token or primary token
PACCESS_TOKEN token = SeQuerySubjectContextToken(&context)
// Do something with token Bad!, no check on ImpersonationLevel
James Forshaw @tiraniddo
Variants
32
SECURITY_IMPERSONATION_LEVEL imp_level;
PACCESS_TOKEN token = PsReferenceImpersonationToken(
PsGetCurrentThread(),
..., &imp_level);
if (token == NULL) {
token = PsReferencePrimaryToken(PsGetCurrentProcess());
}
// Do something with token
SECURITY_IMPERSONATION_LEVEL imp_level;
TOKEN_TYPE token_type;
PACCESS_TOKEN token = PsReferenceEffectiveToken(
PsGetCurrentThread(),
&token_type,
..., &imp_level);
// Do something with token
James Forshaw @tiraniddo
Real Example CVE-2015-0002
33
BOOLEAN AhcVerifyAdminContext()
{
TOKEN_USER *user;
SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
PACCESS_TOKEN token = PsReferenceImpersonationToken(
PsCurrentThread(), ...,
&ImpersonationLevel);
if (token == NULL) {
token = PsReferencePrimaryToken(PsCurrentProcess());
}
SeQueryInformationToken(token, TokenUser, &user);
if(RtlEqualSid(user->User->Sid, LocalSystemSid) || SeTokenIsAdmin(token)) {
return TRUE;
}
return FALSE;
}
Bad!, no check on ImpersonationLevel
James Forshaw @tiraniddo
DEMO
CVE-2015-0002 AppHelp Cache Control
EoP
34
James Forshaw @tiraniddo
Is SeTokenIsAdmin Also Bad?
● CVE-2015-0002 was Windows 8+ only
● Similar bug existed on Windows 7, but could also bypass
SeTokenIsAdmin as well
35
// Win7
BOOLEAN SeTokenIsAdmin(PACCESS_TOKEN Token) {
return SepSidInToken(Token, SeExports->AdminGroupSid);
}
// Win8+
BOOLEAN SeTokenIsAdmin(PACCESS_TOKEN Token) {
if (Token->TokenType == TokenImpersonation &&
Token->SecurityLevel < SecurityImpersonation)
return FALSE;
return SepSidInToken(Token, SeExports->AdminGroupSid);
}
James Forshaw @tiraniddo
Crafted Subject Context
36
PSECURITY_DESCRIPTOR sd = ...;
PACCESS_TOKEN primary_token =
PsReferenceEffectiveToken(...);
SECURITY_SUBJECT_CONTEXT context = {0};
context->PrimaryToken = primary_token;
if (SeAccessCheck(sd, &context, ...) {
// Do a privileged action
}
James Forshaw @tiraniddo
Crafted Subject Context
37
PSECURITY_DESCRIPTOR sd = ...;
PACCESS_TOKEN primary_token =
PsReferenceEffectiveToken(...);
SECURITY_SUBJECT_CONTEXT context = {0};
context->PrimaryToken = primary_token;
if (SeAccessCheck(sd, &context, ...) {
// Do a privileged action
}
BOOLEAN SeAccessCheck(...,
PSECURITY_SUBJECT_CONTEXT context, ...,
PNTSTATUS AccessStatus) {
// Some initialization
if (context.ClientToken
&& context.ImpersonationLevel < SecurityImpersonation) {
*AccessStatus = STATUS_ACCESS_DENIED;
return FALSE;
}
// Do access check with token
}
James Forshaw @tiraniddo
Real Example RtlpAllowsLowBoxAccess
38
NTSTATUS RtlpAllowsLowBoxAccess(wchar_t* atomname) {
SubjectSecurityContext.PrimaryToken = PsReferenceEffectiveToken(
PsGetCurrentThread(),
...);
SubjectSecurityContext.ProcessAuditId =
PsGetCurrentProcess()->UniqueProcessId;
BOOLEAN result = SeAccessCheckWithHint(
SeAtomSd,
0,
&SubjectSecurityContext,
...);
// Handle result
}
James Forshaw @tiraniddo
System Thread Impersonation
● Impersonation usually through SeImpersonateClient
● Can also use PsImpersonateClient
● If an explicit impersonation level is passed it will override what’s in
the token
39
VOID DoWorkThread(LPVOID arg) {
PACCESS_TOKEN token = arg;
PsImpersonateClient(PsCurrentThread(), token,
..., SecurityImpersonation);
}
PACCESS_TOKEN token = PsReferenceImpersonationToken(...);
PsCreateSystemThread(&hThread, ..., DoWorkThread, token);
James Forshaw @tiraniddo
Leaky Tokens
● Kernel code can capture access token objects just like any other
kernel object and manipulate it
● Bad code could return the token to user mode as a handle
○ Only requires you pass the access check
● This goes against the leakage of tokens through impersonation as
you can get hold of primary tokens from other processes
● Can be used to elevate privileges in restricted token scenarios
40
// Capture token in one process
PACCESS_TOKEN token = PsReferenceEffectiveToken();
CapturedAccessToken = token;
// Read in another
OpenCapturedAccessToken(PHANDLE TokenHandle, ACCESS_MASK Access) {
ObOpenObjectByPointer(CapturedAccessToken, Access, TokenHandle);
}
James Forshaw @tiraniddo
Real Example CVE-2015-0078
● Undocumented win32k system call NtUserGetClipboardToken
introduced in Windows 8.1
41
Win32k
Medium IL
Process 1
W
rite
to
Clipboard
Captured
Token
Low IL Process
Process 1
NtUserG
etClipboardToken
Open for read access
James Forshaw @tiraniddo
Why Is This a Problem?
● GENERIC_READ access gives TOKEN_DUPLICATE access right
● Duplicate to get a writable token then lower IL level
● As long as the same user allows us to assign the token.
42
TOKEN_MANDATORY_LABEL TokenMandatoryLabel;
TokenMandatoryLabel.Label.Attributes = SE_GROUP_INTEGRITY;
TokenMandatoryLabel.Label.Sid = MediumMandatoryLevelSid;
SetTokenInformation(hNewToken,
TokenIntegrityLevel,
&TokenMandatoryLabel,
sizeof(TOKEN_MANDATORY_LABEL));
James Forshaw @tiraniddo
DEMO
CVE-2015-0078
Win32k Leaky Tokens
43
James Forshaw @tiraniddo
Incorrect Token Duplication
● External duplication APIs, NtDuplicateToken and
SeDuplicateToken check for impersonation level < Impersonate
● Kernel code can also use internal duplication function
SepDuplicatetoken
● No checks done on the original token that it’s compatible for
duplication
44
James Forshaw @tiraniddo
Real Example CVE-2015-0078
● CreateProcessAsUser takes a token handle to assign as primary
token
● Documented as requiring a Primary Token
45
James Forshaw @tiraniddo
Digging into NtCreateUserProcess
46
NTSTATUS PspReferenceTokenForNewProcess(
HANDLE token,
KPROCESSOR_MODE AccessMode,
TOKEN **outtok)
{
result = ObReferenceObjectByHandle(token,
TOKEN_ASSIGN_PRIMARY,
SeTokenObjectType,
AccessMode, outtok);
return result;
}
Only requires TOKEN_ASSIGN_PRIMARY privileges
James Forshaw @tiraniddo
Token Creation
NSTATUS SeSubProcessToken(_EPROCESS *process,
_TOKEN *token,
_TOKEN **subtoken)
{
OBJECT_ATTRIBUTES objattr;
InitializeObjectAttributes(&objattr);
SepDuplicateToken(token, &objattr, TokenPrimary,
SecurityAnonymous, subtoken);
// Do rest of initialization
}
47
Explicitly Duplicate as
Primary
James Forshaw @tiraniddo
SeAssignPrimaryTokenPrivilege
● Limit to general exploitability, caller process must have privilege or
meet a set of criteria to assign token
● System services (such as IIS) have privilege so can be used as an
EoP there, but what about user processes?
48
BOOLEAN has_assign_privilege = FALSE;
if (SeSinglePrivilegeCheck(SeAssignPrimaryTokenPrivilege))
has_assign_privilege = TRUE;
BOOLEAN can_assign;
SeIsTokenAssignableToProcess(tokena, &can_assign);
if ( !can_assign && !has_assign_privilege )
return STATUS_PRIVILEGE_NOT_HELD;
James Forshaw @tiraniddo
SeIsTokenAssignableToProcess
49
Parent Token Sibling Token
Process
Token
Token ID
Assigned
Token
Parent
Token ID
Equal
CreateRestrictedToken
Process
Token
Parent
Token ID
Auth ID
Assigned
Token
Parent
Token ID
Auth ID
Equal
Equal
DuplicateToken
NtCreateLowBoxToken
OR
James Forshaw @tiraniddo
LowBox Token Hierarchy
● LowBox Tokens used in things like IE EPM are siblings of the main
user’s token.
● Using this issue can capture an identification token from main user
and use that to create a new process with elevated privileges
● Only restriction is must be at same IL, which for IE EPM is Low
50
James Forshaw @tiraniddo
DEMO
CVE-2015-0078
NtCreateUserProcess
51
James Forshaw @tiraniddo
TOCTOU Issues
● Some bugs need to change the token between one call and the
next
● Can be done from another thread
● Useful to bypass lower SeAccessCheck then subsequent additional
checks
52
void DoUserAction()
{
if (SeAccessCheck(...)) {
PACCESS_TOKEN token = PsReferenceEffectiveToken();
PSID sid = GetUserSid(token);
// Do operations as that use
}
}
James Forshaw @tiraniddo
IO Manager TOCTOU
● IO Manager Only Captures Security during IRP_MJ_CREATE
processing
● No subsequent IO calls are explicitly checked, so sometimes
drivers do it manually
53
void UseDriver()
{
// Security check made here
HANDLE hDevice = CreateFile(".DeviceName", ...);
ImpersonateLoggedOnUser(hFakeId);
// No further security checks
DeviceIoControl(hDevice, ...);
}
James Forshaw @tiraniddo
Real Example CVE-2015-0011
● MRXDAV driver implements kernel mode component of WebDAV
UNC path support
● Accessible through DeviceWebDavRedirector device, which does
a security check
● Functionality implemented in Device IO Control commands, which
does the following:
54
// Do Device IO Control
SeCaptureSubjectContext(&ctx)
SeQueryAuthenticationId(SeQuerySubjectContextToken(&ctx),
&luid);
if(luid == LocalSystemLUID)
is_local_system = true;
if (is_local_system)
// Do privileged operation
James Forshaw @tiraniddo
Vulnerable Zw Calls
● Calls to ZwOpenThreadToken and ZwOpenProcessToken are
deprecated, replaced with Ex Variants.
● This is because these calls were supposed to only be used from
user mode and not the kernel
○ Didn’t specify a handles flag option
○ Meant all handles were opened as user-mode handles
○ Potential for a user-mode process to get access to privileged handles
55
James Forshaw @tiraniddo
Changes in Token Handling
56
James Forshaw @tiraniddo
SeTokenIsAdmin Fixed in Windows 7
57
James Forshaw @tiraniddo
Windows 10 Changes (Build 10159)
58
If Token Level
< Impersonate
If Process has
Impersonate
Privilege
ALLOWED
Restrict to
Identification
Level
If Process IL <
Token IL
If Process User
== Token User
Elevation
Check
Capability
Check
James Forshaw @tiraniddo
Windows 10 Impersonation Capability
● New Group and Capability SIDs to add impersonation capability
○ Session Impersonation Group
○ Constrained Impersonation Group
○ Constrained Impersonation Capability
59
If Same Session and
Process Token has
Session Impersonation
Group
If LowBox Token and
Process Token has
Constrained
Impersonation Group
If LowBox Token and
Process Token has
Constrained
Impersonation Group
If same LowBox Package
SID
Also needs SepAllowSessionImpersonationCap
set in Kernel Flags
James Forshaw @tiraniddo
Windows 10 Elevated Token Impersonation
● Blocks impersonating an elevated token unless process token is
also elevated
● Must be enabled in SeCompatFlags kernel flag
● Blocks trick used to elevate privileges with
NtUserGetClipboardToken
60
if (SeTokenIsElevated(ImpersonationToken)) {
if ((SeCompatFlags & 1)
&& !SeTokenIsElevated(ProcessToken)) {
return STATUS_PRIVILEGE_NOT_HELD;
}
}
James Forshaw @tiraniddo
Questions?
61

More Related Content

What's hot

DeathNote of Microsoft Windows Kernel
DeathNote of Microsoft Windows KernelDeathNote of Microsoft Windows Kernel
DeathNote of Microsoft Windows KernelPeter Hlavaty
 
I'm in your cloud... reading everyone's email. Hacking Azure AD via Active Di...
I'm in your cloud... reading everyone's email. Hacking Azure AD via Active Di...I'm in your cloud... reading everyone's email. Hacking Azure AD via Active Di...
I'm in your cloud... reading everyone's email. Hacking Azure AD via Active Di...DirkjanMollema
 
Catch Me If You Can: PowerShell Red vs Blue
Catch Me If You Can: PowerShell Red vs BlueCatch Me If You Can: PowerShell Red vs Blue
Catch Me If You Can: PowerShell Red vs BlueWill Schroeder
 
AMSI: How Windows 10 Plans to Stop Script-Based Attacks and How Well It Does It
AMSI: How Windows 10 Plans to Stop Script-Based Attacks and How Well It Does ItAMSI: How Windows 10 Plans to Stop Script-Based Attacks and How Well It Does It
AMSI: How Windows 10 Plans to Stop Script-Based Attacks and How Well It Does ItNikhil Mittal
 
DerbyCon 2019 - Kerberoasting Revisited
DerbyCon 2019 - Kerberoasting RevisitedDerbyCon 2019 - Kerberoasting Revisited
DerbyCon 2019 - Kerberoasting RevisitedWill Schroeder
 
A Forgotten HTTP Invisibility Cloak
A Forgotten HTTP Invisibility CloakA Forgotten HTTP Invisibility Cloak
A Forgotten HTTP Invisibility CloakSoroush Dalili
 
Introduction to Dynamic Analysis of Android Application
Introduction to Dynamic Analysis of Android ApplicationIntroduction to Dynamic Analysis of Android Application
Introduction to Dynamic Analysis of Android ApplicationKelwin Yang
 
Hunting for Privilege Escalation in Windows Environment
Hunting for Privilege Escalation in Windows EnvironmentHunting for Privilege Escalation in Windows Environment
Hunting for Privilege Escalation in Windows EnvironmentTeymur Kheirkhabarov
 
aclpwn - Active Directory ACL exploitation with BloodHound
aclpwn - Active Directory ACL exploitation with BloodHoundaclpwn - Active Directory ACL exploitation with BloodHound
aclpwn - Active Directory ACL exploitation with BloodHoundDirkjanMollema
 
[CB16] DeathNote of Microsoft Windows Kernel by Peter Hlavaty & Jin Long
[CB16] DeathNote of Microsoft Windows Kernel by Peter Hlavaty & Jin Long[CB16] DeathNote of Microsoft Windows Kernel by Peter Hlavaty & Jin Long
[CB16] DeathNote of Microsoft Windows Kernel by Peter Hlavaty & Jin LongCODE BLUE
 
Csw2017 bazhaniuk exploring_yoursystemdeeper_updated
Csw2017 bazhaniuk exploring_yoursystemdeeper_updatedCsw2017 bazhaniuk exploring_yoursystemdeeper_updated
Csw2017 bazhaniuk exploring_yoursystemdeeper_updatedCanSecWest
 
Windows 10 Nt Heap Exploitation (English version)
Windows 10 Nt Heap Exploitation (English version)Windows 10 Nt Heap Exploitation (English version)
Windows 10 Nt Heap Exploitation (English version)Angel Boy
 
syzkaller: the next gen kernel fuzzer
syzkaller: the next gen kernel fuzzersyzkaller: the next gen kernel fuzzer
syzkaller: the next gen kernel fuzzerDmitry Vyukov
 
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourWAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourSoroush Dalili
 
Passwords#14 - mimikatz
Passwords#14 - mimikatzPasswords#14 - mimikatz
Passwords#14 - mimikatzBenjamin Delpy
 
AppSec USA 2015: Customizing Burp Suite
AppSec USA 2015: Customizing Burp SuiteAppSec USA 2015: Customizing Burp Suite
AppSec USA 2015: Customizing Burp SuiteAugust Detlefsen
 
Fundamentals of Linux Privilege Escalation
Fundamentals of Linux Privilege EscalationFundamentals of Linux Privilege Escalation
Fundamentals of Linux Privilege Escalationnullthreat
 
CNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbgCNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbgSam Bowne
 
스프링 시큐리티 구조 이해
스프링 시큐리티 구조 이해스프링 시큐리티 구조 이해
스프링 시큐리티 구조 이해beom kyun choi
 

What's hot (20)

DeathNote of Microsoft Windows Kernel
DeathNote of Microsoft Windows KernelDeathNote of Microsoft Windows Kernel
DeathNote of Microsoft Windows Kernel
 
I'm in your cloud... reading everyone's email. Hacking Azure AD via Active Di...
I'm in your cloud... reading everyone's email. Hacking Azure AD via Active Di...I'm in your cloud... reading everyone's email. Hacking Azure AD via Active Di...
I'm in your cloud... reading everyone's email. Hacking Azure AD via Active Di...
 
Catch Me If You Can: PowerShell Red vs Blue
Catch Me If You Can: PowerShell Red vs BlueCatch Me If You Can: PowerShell Red vs Blue
Catch Me If You Can: PowerShell Red vs Blue
 
AMSI: How Windows 10 Plans to Stop Script-Based Attacks and How Well It Does It
AMSI: How Windows 10 Plans to Stop Script-Based Attacks and How Well It Does ItAMSI: How Windows 10 Plans to Stop Script-Based Attacks and How Well It Does It
AMSI: How Windows 10 Plans to Stop Script-Based Attacks and How Well It Does It
 
DerbyCon 2019 - Kerberoasting Revisited
DerbyCon 2019 - Kerberoasting RevisitedDerbyCon 2019 - Kerberoasting Revisited
DerbyCon 2019 - Kerberoasting Revisited
 
A Forgotten HTTP Invisibility Cloak
A Forgotten HTTP Invisibility CloakA Forgotten HTTP Invisibility Cloak
A Forgotten HTTP Invisibility Cloak
 
Introduction to Dynamic Analysis of Android Application
Introduction to Dynamic Analysis of Android ApplicationIntroduction to Dynamic Analysis of Android Application
Introduction to Dynamic Analysis of Android Application
 
Hunting for Privilege Escalation in Windows Environment
Hunting for Privilege Escalation in Windows EnvironmentHunting for Privilege Escalation in Windows Environment
Hunting for Privilege Escalation in Windows Environment
 
WSL Reloaded
WSL ReloadedWSL Reloaded
WSL Reloaded
 
aclpwn - Active Directory ACL exploitation with BloodHound
aclpwn - Active Directory ACL exploitation with BloodHoundaclpwn - Active Directory ACL exploitation with BloodHound
aclpwn - Active Directory ACL exploitation with BloodHound
 
[CB16] DeathNote of Microsoft Windows Kernel by Peter Hlavaty & Jin Long
[CB16] DeathNote of Microsoft Windows Kernel by Peter Hlavaty & Jin Long[CB16] DeathNote of Microsoft Windows Kernel by Peter Hlavaty & Jin Long
[CB16] DeathNote of Microsoft Windows Kernel by Peter Hlavaty & Jin Long
 
Csw2017 bazhaniuk exploring_yoursystemdeeper_updated
Csw2017 bazhaniuk exploring_yoursystemdeeper_updatedCsw2017 bazhaniuk exploring_yoursystemdeeper_updated
Csw2017 bazhaniuk exploring_yoursystemdeeper_updated
 
Windows 10 Nt Heap Exploitation (English version)
Windows 10 Nt Heap Exploitation (English version)Windows 10 Nt Heap Exploitation (English version)
Windows 10 Nt Heap Exploitation (English version)
 
syzkaller: the next gen kernel fuzzer
syzkaller: the next gen kernel fuzzersyzkaller: the next gen kernel fuzzer
syzkaller: the next gen kernel fuzzer
 
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourWAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
 
Passwords#14 - mimikatz
Passwords#14 - mimikatzPasswords#14 - mimikatz
Passwords#14 - mimikatz
 
AppSec USA 2015: Customizing Burp Suite
AppSec USA 2015: Customizing Burp SuiteAppSec USA 2015: Customizing Burp Suite
AppSec USA 2015: Customizing Burp Suite
 
Fundamentals of Linux Privilege Escalation
Fundamentals of Linux Privilege EscalationFundamentals of Linux Privilege Escalation
Fundamentals of Linux Privilege Escalation
 
CNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbgCNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbg
 
스프링 시큐리티 구조 이해
스프링 시큐리티 구조 이해스프링 시큐리티 구조 이해
스프링 시큐리티 구조 이해
 

Viewers also liked

Suns Out Guns Out: Hacking without a Vehicle by Charlie Miller & Chris Valasek
Suns Out Guns Out: Hacking without a Vehicle by Charlie Miller & Chris ValasekSuns Out Guns Out: Hacking without a Vehicle by Charlie Miller & Chris Valasek
Suns Out Guns Out: Hacking without a Vehicle by Charlie Miller & Chris ValasekShakacon
 
Breaking Vaults - Stealing Lastpass Protected Secrets by Martin Vigo
Breaking Vaults - Stealing Lastpass Protected Secrets by Martin VigoBreaking Vaults - Stealing Lastpass Protected Secrets by Martin Vigo
Breaking Vaults - Stealing Lastpass Protected Secrets by Martin VigoShakacon
 
The Joy of Sandbox Mitigations
The Joy of Sandbox MitigationsThe Joy of Sandbox Mitigations
The Joy of Sandbox MitigationsJames Forshaw
 
Practical Windows Kernel Exploitation
Practical Windows Kernel ExploitationPractical Windows Kernel Exploitation
Practical Windows Kernel ExploitationzeroSteiner
 
4 Ways to Make UAC Less Annoying on Windows 7 / Vista
4 Ways to Make UAC Less Annoying on Windows 7 / Vista4 Ways to Make UAC Less Annoying on Windows 7 / Vista
4 Ways to Make UAC Less Annoying on Windows 7 / Vistayeenaroth
 
Richard wartell malware is hard. let's go shopping!!
Richard wartell   malware is hard.  let's go shopping!!Richard wartell   malware is hard.  let's go shopping!!
Richard wartell malware is hard. let's go shopping!!Shakacon
 
There's Waldo by Patrick Wardle & Colby Moore
There's Waldo by Patrick Wardle & Colby MooreThere's Waldo by Patrick Wardle & Colby Moore
There's Waldo by Patrick Wardle & Colby MooreShakacon
 
Hacking Highly Secured Enterprise Environments by Zoltan Balazs
Hacking Highly Secured Enterprise Environments by Zoltan BalazsHacking Highly Secured Enterprise Environments by Zoltan Balazs
Hacking Highly Secured Enterprise Environments by Zoltan BalazsShakacon
 
SplunkLive Brisbane Splunking the Endpoint
SplunkLive Brisbane Splunking the EndpointSplunkLive Brisbane Splunking the Endpoint
SplunkLive Brisbane Splunking the EndpointSplunk
 
Windows Systems & Code Signing Protection by Paul Rascagneres
Windows Systems & Code Signing Protection by Paul RascagneresWindows Systems & Code Signing Protection by Paul Rascagneres
Windows Systems & Code Signing Protection by Paul RascagneresShakacon
 
Red vs Blue- Modern Atice Directory Attacks, Detection & Protection by Sean M...
Red vs Blue- Modern Atice Directory Attacks, Detection & Protection by Sean M...Red vs Blue- Modern Atice Directory Attacks, Detection & Protection by Sean M...
Red vs Blue- Modern Atice Directory Attacks, Detection & Protection by Sean M...Shakacon
 
Chema Alonso - Dorking, Pentesting & Hacking con Android Apps [rootedvlc2]
Chema Alonso - Dorking, Pentesting & Hacking con Android Apps [rootedvlc2]Chema Alonso - Dorking, Pentesting & Hacking con Android Apps [rootedvlc2]
Chema Alonso - Dorking, Pentesting & Hacking con Android Apps [rootedvlc2]RootedCON
 
Level Up! - Practical Windows Privilege Escalation
Level Up! - Practical Windows Privilege EscalationLevel Up! - Practical Windows Privilege Escalation
Level Up! - Practical Windows Privilege Escalationjakx_
 
Windows Memory Forensic Analysis using EnCase
Windows Memory Forensic Analysis using EnCaseWindows Memory Forensic Analysis using EnCase
Windows Memory Forensic Analysis using EnCaseTakahiro Haruyama
 
The old is new, again. CVE-2011-2461 is back!
The old is new, again. CVE-2011-2461 is back!The old is new, again. CVE-2011-2461 is back!
The old is new, again. CVE-2011-2461 is back!Luca Carettoni
 
Automotive Exploitation Techniques by Craig Smith
Automotive Exploitation Techniques by Craig SmithAutomotive Exploitation Techniques by Craig Smith
Automotive Exploitation Techniques by Craig SmithShakacon
 
Windows 8 vs windows 7 ppt
Windows 8 vs windows 7 pptWindows 8 vs windows 7 ppt
Windows 8 vs windows 7 pptDiya Mirza
 
Exploiting Elevator Security Weaknesses by Deviant Ollam
Exploiting Elevator Security Weaknesses by Deviant OllamExploiting Elevator Security Weaknesses by Deviant Ollam
Exploiting Elevator Security Weaknesses by Deviant OllamShakacon
 
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000CTruncer
 

Viewers also liked (20)

Suns Out Guns Out: Hacking without a Vehicle by Charlie Miller & Chris Valasek
Suns Out Guns Out: Hacking without a Vehicle by Charlie Miller & Chris ValasekSuns Out Guns Out: Hacking without a Vehicle by Charlie Miller & Chris Valasek
Suns Out Guns Out: Hacking without a Vehicle by Charlie Miller & Chris Valasek
 
Breaking Vaults - Stealing Lastpass Protected Secrets by Martin Vigo
Breaking Vaults - Stealing Lastpass Protected Secrets by Martin VigoBreaking Vaults - Stealing Lastpass Protected Secrets by Martin Vigo
Breaking Vaults - Stealing Lastpass Protected Secrets by Martin Vigo
 
The Joy of Sandbox Mitigations
The Joy of Sandbox MitigationsThe Joy of Sandbox Mitigations
The Joy of Sandbox Mitigations
 
Practical Windows Kernel Exploitation
Practical Windows Kernel ExploitationPractical Windows Kernel Exploitation
Practical Windows Kernel Exploitation
 
4 Ways to Make UAC Less Annoying on Windows 7 / Vista
4 Ways to Make UAC Less Annoying on Windows 7 / Vista4 Ways to Make UAC Less Annoying on Windows 7 / Vista
4 Ways to Make UAC Less Annoying on Windows 7 / Vista
 
Windows 7
Windows 7Windows 7
Windows 7
 
Richard wartell malware is hard. let's go shopping!!
Richard wartell   malware is hard.  let's go shopping!!Richard wartell   malware is hard.  let's go shopping!!
Richard wartell malware is hard. let's go shopping!!
 
There's Waldo by Patrick Wardle & Colby Moore
There's Waldo by Patrick Wardle & Colby MooreThere's Waldo by Patrick Wardle & Colby Moore
There's Waldo by Patrick Wardle & Colby Moore
 
Hacking Highly Secured Enterprise Environments by Zoltan Balazs
Hacking Highly Secured Enterprise Environments by Zoltan BalazsHacking Highly Secured Enterprise Environments by Zoltan Balazs
Hacking Highly Secured Enterprise Environments by Zoltan Balazs
 
SplunkLive Brisbane Splunking the Endpoint
SplunkLive Brisbane Splunking the EndpointSplunkLive Brisbane Splunking the Endpoint
SplunkLive Brisbane Splunking the Endpoint
 
Windows Systems & Code Signing Protection by Paul Rascagneres
Windows Systems & Code Signing Protection by Paul RascagneresWindows Systems & Code Signing Protection by Paul Rascagneres
Windows Systems & Code Signing Protection by Paul Rascagneres
 
Red vs Blue- Modern Atice Directory Attacks, Detection & Protection by Sean M...
Red vs Blue- Modern Atice Directory Attacks, Detection & Protection by Sean M...Red vs Blue- Modern Atice Directory Attacks, Detection & Protection by Sean M...
Red vs Blue- Modern Atice Directory Attacks, Detection & Protection by Sean M...
 
Chema Alonso - Dorking, Pentesting & Hacking con Android Apps [rootedvlc2]
Chema Alonso - Dorking, Pentesting & Hacking con Android Apps [rootedvlc2]Chema Alonso - Dorking, Pentesting & Hacking con Android Apps [rootedvlc2]
Chema Alonso - Dorking, Pentesting & Hacking con Android Apps [rootedvlc2]
 
Level Up! - Practical Windows Privilege Escalation
Level Up! - Practical Windows Privilege EscalationLevel Up! - Practical Windows Privilege Escalation
Level Up! - Practical Windows Privilege Escalation
 
Windows Memory Forensic Analysis using EnCase
Windows Memory Forensic Analysis using EnCaseWindows Memory Forensic Analysis using EnCase
Windows Memory Forensic Analysis using EnCase
 
The old is new, again. CVE-2011-2461 is back!
The old is new, again. CVE-2011-2461 is back!The old is new, again. CVE-2011-2461 is back!
The old is new, again. CVE-2011-2461 is back!
 
Automotive Exploitation Techniques by Craig Smith
Automotive Exploitation Techniques by Craig SmithAutomotive Exploitation Techniques by Craig Smith
Automotive Exploitation Techniques by Craig Smith
 
Windows 8 vs windows 7 ppt
Windows 8 vs windows 7 pptWindows 8 vs windows 7 ppt
Windows 8 vs windows 7 ppt
 
Exploiting Elevator Security Weaknesses by Deviant Ollam
Exploiting Elevator Security Weaknesses by Deviant OllamExploiting Elevator Security Weaknesses by Deviant Ollam
Exploiting Elevator Security Weaknesses by Deviant Ollam
 
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000
 

Similar to Social Engineering the Windows Kernel by James Forshaw

James Forshaw, elevator action
James Forshaw, elevator actionJames Forshaw, elevator action
James Forshaw, elevator actionPacSecJP
 
Jaap Groneveld - Go Basics
Jaap Groneveld -  Go BasicsJaap Groneveld -  Go Basics
Jaap Groneveld - Go BasicsJaapGroeneveld2
 
Module 6 (trojans and backdoors)
Module 6 (trojans and backdoors)Module 6 (trojans and backdoors)
Module 6 (trojans and backdoors)Wail Hassan
 
Introduction of hacking and cracking
Introduction of hacking and crackingIntroduction of hacking and cracking
Introduction of hacking and crackingHarshil Barot
 
Chapter 4 access control fundamental ii
Chapter 4   access control fundamental iiChapter 4   access control fundamental ii
Chapter 4 access control fundamental iiSyaiful Ahdan
 
ip spoofing by Ipshita Nandy
 ip spoofing by Ipshita Nandy ip spoofing by Ipshita Nandy
ip spoofing by Ipshita NandyIpshitaNandy
 
Code Smells and How to avoid it
Code Smells and How to avoid itCode Smells and How to avoid it
Code Smells and How to avoid itSyed Shah
 
Step-by-step Development of an Application for the Java Card Connected Platform
Step-by-step Development of an Application for the Java Card Connected PlatformStep-by-step Development of an Application for the Java Card Connected Platform
Step-by-step Development of an Application for the Java Card Connected PlatformEric Vétillard
 
[2010 CodeEngn Conference 04] window31 - Art of Keylogging 키보드보안과 관계없는 키로거들
[2010 CodeEngn Conference 04] window31 - Art of Keylogging 키보드보안과 관계없는 키로거들[2010 CodeEngn Conference 04] window31 - Art of Keylogging 키보드보안과 관계없는 키로거들
[2010 CodeEngn Conference 04] window31 - Art of Keylogging 키보드보안과 관계없는 키로거들GangSeok Lee
 
Attacker's Perspective of Active Directory
Attacker's Perspective of Active DirectoryAttacker's Perspective of Active Directory
Attacker's Perspective of Active DirectorySunny Neo
 
PROJECT REPORT ON CRYPTOGRAPHIC ALGORITHM
PROJECT REPORT ON CRYPTOGRAPHIC ALGORITHMPROJECT REPORT ON CRYPTOGRAPHIC ALGORITHM
PROJECT REPORT ON CRYPTOGRAPHIC ALGORITHMsaniacorreya
 

Similar to Social Engineering the Windows Kernel by James Forshaw (20)

Final Engagement
Final EngagementFinal Engagement
Final Engagement
 
James Forshaw, elevator action
James Forshaw, elevator actionJames Forshaw, elevator action
James Forshaw, elevator action
 
Jaap Groneveld - Go Basics
Jaap Groneveld -  Go BasicsJaap Groneveld -  Go Basics
Jaap Groneveld - Go Basics
 
How to hack or what is ethical hacking
How to hack or what is ethical hackingHow to hack or what is ethical hacking
How to hack or what is ethical hacking
 
Module 6 (trojans and backdoors)
Module 6 (trojans and backdoors)Module 6 (trojans and backdoors)
Module 6 (trojans and backdoors)
 
It act seminar
It act seminarIt act seminar
It act seminar
 
Introduction of hacking and cracking
Introduction of hacking and crackingIntroduction of hacking and cracking
Introduction of hacking and cracking
 
Chapter 4 access control fundamental ii
Chapter 4   access control fundamental iiChapter 4   access control fundamental ii
Chapter 4 access control fundamental ii
 
Multiprizer Whitepaper
Multiprizer WhitepaperMultiprizer Whitepaper
Multiprizer Whitepaper
 
ip spoofing by Ipshita Nandy
 ip spoofing by Ipshita Nandy ip spoofing by Ipshita Nandy
ip spoofing by Ipshita Nandy
 
Mimikatz
MimikatzMimikatz
Mimikatz
 
Ethical hacking ppt
Ethical hacking pptEthical hacking ppt
Ethical hacking ppt
 
Code Smells and How to avoid it
Code Smells and How to avoid itCode Smells and How to avoid it
Code Smells and How to avoid it
 
LO3 - Lesson 2 - Door Triggers
LO3 - Lesson 2 - Door TriggersLO3 - Lesson 2 - Door Triggers
LO3 - Lesson 2 - Door Triggers
 
Step-by-step Development of an Application for the Java Card Connected Platform
Step-by-step Development of an Application for the Java Card Connected PlatformStep-by-step Development of an Application for the Java Card Connected Platform
Step-by-step Development of an Application for the Java Card Connected Platform
 
Real life hacking101
Real life hacking101Real life hacking101
Real life hacking101
 
[2010 CodeEngn Conference 04] window31 - Art of Keylogging 키보드보안과 관계없는 키로거들
[2010 CodeEngn Conference 04] window31 - Art of Keylogging 키보드보안과 관계없는 키로거들[2010 CodeEngn Conference 04] window31 - Art of Keylogging 키보드보안과 관계없는 키로거들
[2010 CodeEngn Conference 04] window31 - Art of Keylogging 키보드보안과 관계없는 키로거들
 
Attacker's Perspective of Active Directory
Attacker's Perspective of Active DirectoryAttacker's Perspective of Active Directory
Attacker's Perspective of Active Directory
 
PROJECT REPORT ON CRYPTOGRAPHIC ALGORITHM
PROJECT REPORT ON CRYPTOGRAPHIC ALGORITHMPROJECT REPORT ON CRYPTOGRAPHIC ALGORITHM
PROJECT REPORT ON CRYPTOGRAPHIC ALGORITHM
 
Trojan
TrojanTrojan
Trojan
 

More from Shakacon

Web (dis)assembly
Web (dis)assemblyWeb (dis)assembly
Web (dis)assemblyShakacon
 
I can be apple and so can you
I can be apple and so can youI can be apple and so can you
I can be apple and so can youShakacon
 
Cloud forensics putting the bits back together
Cloud forensics putting the bits back togetherCloud forensics putting the bits back together
Cloud forensics putting the bits back togetherShakacon
 
Pwned in Translation - from Subtitles to RCE
Pwned in Translation - from Subtitles to RCEPwned in Translation - from Subtitles to RCE
Pwned in Translation - from Subtitles to RCEShakacon
 
Oversight: Exposing spies on macOS
Oversight: Exposing spies on macOS Oversight: Exposing spies on macOS
Oversight: Exposing spies on macOS Shakacon
 
Modern Reconnaissance Phase on APT - protection layer
Modern Reconnaissance Phase on APT - protection layerModern Reconnaissance Phase on APT - protection layer
Modern Reconnaissance Phase on APT - protection layerShakacon
 
A Decompiler for Blackhain-Based Smart Contracts Bytecode
A Decompiler for Blackhain-Based Smart Contracts BytecodeA Decompiler for Blackhain-Based Smart Contracts Bytecode
A Decompiler for Blackhain-Based Smart Contracts BytecodeShakacon
 
Honey, I Stole Your C2 Server: A Dive into Attacker Infrastructure
Honey, I Stole Your C2 Server:  A Dive into Attacker InfrastructureHoney, I Stole Your C2 Server:  A Dive into Attacker Infrastructure
Honey, I Stole Your C2 Server: A Dive into Attacker InfrastructureShakacon
 
Dock ir incident response in a containerized, immutable, continually deploy...
Dock ir   incident response in a containerized, immutable, continually deploy...Dock ir   incident response in a containerized, immutable, continually deploy...
Dock ir incident response in a containerized, immutable, continually deploy...Shakacon
 
Reviewing the Security of ASoC Drivers in Android Kernel
Reviewing the Security of ASoC Drivers in Android KernelReviewing the Security of ASoC Drivers in Android Kernel
Reviewing the Security of ASoC Drivers in Android KernelShakacon
 
Silent Protest: A Wearable Protest Network
Silent Protest:  A Wearable Protest NetworkSilent Protest:  A Wearable Protest Network
Silent Protest: A Wearable Protest NetworkShakacon
 
WiFi-Based IMSI Catcher
WiFi-Based IMSI CatcherWiFi-Based IMSI Catcher
WiFi-Based IMSI CatcherShakacon
 
Sad Panda Analysts: Devolving Malware
Sad Panda Analysts:  Devolving MalwareSad Panda Analysts:  Devolving Malware
Sad Panda Analysts: Devolving MalwareShakacon
 
reductio [ad absurdum]
reductio [ad absurdum]reductio [ad absurdum]
reductio [ad absurdum]Shakacon
 
XFLTReat: a new dimension in tunnelling
XFLTReat:  a new dimension in tunnellingXFLTReat:  a new dimension in tunnelling
XFLTReat: a new dimension in tunnellingShakacon
 
When Encryption is Not Enough...Sumanth Naropanth, Chandra Prakash Gopalaiah ...
When Encryption is Not Enough...Sumanth Naropanth, Chandra Prakash Gopalaiah ...When Encryption is Not Enough...Sumanth Naropanth, Chandra Prakash Gopalaiah ...
When Encryption is Not Enough...Sumanth Naropanth, Chandra Prakash Gopalaiah ...Shakacon
 
The Search for the Perfect Door - Deviant Ollam
The Search for the Perfect Door - Deviant OllamThe Search for the Perfect Door - Deviant Ollam
The Search for the Perfect Door - Deviant OllamShakacon
 
Swift Reversing by Ryan Stortz
Swift Reversing by Ryan StortzSwift Reversing by Ryan Stortz
Swift Reversing by Ryan StortzShakacon
 

More from Shakacon (20)

Web (dis)assembly
Web (dis)assemblyWeb (dis)assembly
Web (dis)assembly
 
Macdoored
MacdooredMacdoored
Macdoored
 
I can be apple and so can you
I can be apple and so can youI can be apple and so can you
I can be apple and so can you
 
Cloud forensics putting the bits back together
Cloud forensics putting the bits back togetherCloud forensics putting the bits back together
Cloud forensics putting the bits back together
 
Pwned in Translation - from Subtitles to RCE
Pwned in Translation - from Subtitles to RCEPwned in Translation - from Subtitles to RCE
Pwned in Translation - from Subtitles to RCE
 
Oversight: Exposing spies on macOS
Oversight: Exposing spies on macOS Oversight: Exposing spies on macOS
Oversight: Exposing spies on macOS
 
Modern Reconnaissance Phase on APT - protection layer
Modern Reconnaissance Phase on APT - protection layerModern Reconnaissance Phase on APT - protection layer
Modern Reconnaissance Phase on APT - protection layer
 
Shamoon
ShamoonShamoon
Shamoon
 
A Decompiler for Blackhain-Based Smart Contracts Bytecode
A Decompiler for Blackhain-Based Smart Contracts BytecodeA Decompiler for Blackhain-Based Smart Contracts Bytecode
A Decompiler for Blackhain-Based Smart Contracts Bytecode
 
Honey, I Stole Your C2 Server: A Dive into Attacker Infrastructure
Honey, I Stole Your C2 Server:  A Dive into Attacker InfrastructureHoney, I Stole Your C2 Server:  A Dive into Attacker Infrastructure
Honey, I Stole Your C2 Server: A Dive into Attacker Infrastructure
 
Dock ir incident response in a containerized, immutable, continually deploy...
Dock ir   incident response in a containerized, immutable, continually deploy...Dock ir   incident response in a containerized, immutable, continually deploy...
Dock ir incident response in a containerized, immutable, continually deploy...
 
Reviewing the Security of ASoC Drivers in Android Kernel
Reviewing the Security of ASoC Drivers in Android KernelReviewing the Security of ASoC Drivers in Android Kernel
Reviewing the Security of ASoC Drivers in Android Kernel
 
Silent Protest: A Wearable Protest Network
Silent Protest:  A Wearable Protest NetworkSilent Protest:  A Wearable Protest Network
Silent Protest: A Wearable Protest Network
 
WiFi-Based IMSI Catcher
WiFi-Based IMSI CatcherWiFi-Based IMSI Catcher
WiFi-Based IMSI Catcher
 
Sad Panda Analysts: Devolving Malware
Sad Panda Analysts:  Devolving MalwareSad Panda Analysts:  Devolving Malware
Sad Panda Analysts: Devolving Malware
 
reductio [ad absurdum]
reductio [ad absurdum]reductio [ad absurdum]
reductio [ad absurdum]
 
XFLTReat: a new dimension in tunnelling
XFLTReat:  a new dimension in tunnellingXFLTReat:  a new dimension in tunnelling
XFLTReat: a new dimension in tunnelling
 
When Encryption is Not Enough...Sumanth Naropanth, Chandra Prakash Gopalaiah ...
When Encryption is Not Enough...Sumanth Naropanth, Chandra Prakash Gopalaiah ...When Encryption is Not Enough...Sumanth Naropanth, Chandra Prakash Gopalaiah ...
When Encryption is Not Enough...Sumanth Naropanth, Chandra Prakash Gopalaiah ...
 
The Search for the Perfect Door - Deviant Ollam
The Search for the Perfect Door - Deviant OllamThe Search for the Perfect Door - Deviant Ollam
The Search for the Perfect Door - Deviant Ollam
 
Swift Reversing by Ryan Stortz
Swift Reversing by Ryan StortzSwift Reversing by Ryan Stortz
Swift Reversing by Ryan Stortz
 

Recently uploaded

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 

Recently uploaded (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 

Social Engineering the Windows Kernel by James Forshaw

  • 1. Social Engineering the Windows Kernel James Forshaw @tiraniddo Shakacon 2015 1
  • 2. James Forshaw @tiraniddo Obligatory Background Slide ● Researcher in Google’s Project Zero team ● Specialize in Windows ○ Especially local privilege escalation ● Never met a logical vulnerability I didn’t like 2
  • 3. James Forshaw @tiraniddo What I’m Going to Talk About ● Windows Access Security ○ Security Reference Monitor ○ Access Tokens ○ Impersonation ● Kernel Token Handling Vulnerability Classes and Descriptions ● Kernel Token Handling Vulnerability Exploitation 3
  • 4. James Forshaw @tiraniddo Windows Kernel Windows Security Components 4 Security Reference Monitor Process Resource Group SID SACL DACL Security Descriptor Owner SID Access Token User Calls System Call Handlers Kernel and Driver Code Resource Access Check Se* API
  • 5. James Forshaw @tiraniddo Security Reference Monitor 5
  • 6. James Forshaw @tiraniddo Security Access Check (SeAccessCheck) 6 Deny AccessGrant Access IL Check Owner Check DACL Check Desired Access: e.g. Read and Write Access Token Group SID SACL DACL Security Descriptor Owner SID
  • 7. James Forshaw @tiraniddo Access Token 7 User Security Identifier Groups Privileges Mandatory Label
  • 8. James Forshaw @tiraniddo Just Another Kernel Object kd> dt nt!_TOKEN +0x000 TokenSource : _TOKEN_SOURCE +0x010 TokenId : _LUID +0x018 AuthenticationId : _LUID +0x020 ParentTokenId : _LUID +0x028 ExpirationTime : _LARGE_INTEGER +0x030 TokenLock : Ptr32 _ERESOURCE +0x034 ModifiedId : _LUID +0x040 Privileges : _SEP_TOKEN_PRIVILEGES +0x058 AuditPolicy : _SEP_AUDIT_POLICY +0x078 SessionId : Uint4B .... 8
  • 9. James Forshaw @tiraniddo Token Categories 9 Normal Token Linked Token Filtered Token LowBox Token UAC NtFilterToken NtCreateLowBoxToken
  • 10. James Forshaw @tiraniddo Important Token Fields ● Token User SID ● Token ID (unique 64 bit value assigned when token created) ● Parent Token ID (parent token ID when creating filtered tokens) ● Token Group SIDs ● Token Privileges ● Token Authentication ID (64 bit value ties it to a logon session) ● Token Flags (holds pre-tested privilege check values for speed) ● Restricted Token SIDs ● Lowbox Token SIDs 10
  • 11. James Forshaw @tiraniddo ● Tokens in user mode accessed via handles ● Can specify certain access rights based on DACL access check Important Token Access Rights 11 TOKEN_DUPLICATE Required to duplicate the token TOKEN_ASSIGN_PRIMARY Required to assign the token to a new process TOKEN_IMPERSONATE Required to impersonate the token TOKEN_ADJUST_DEFAULT Required to set the integrity level of a token TOKEN_ADJUST_PRIVILEGES Required to enable/disable privileges
  • 12. James Forshaw @tiraniddo Access Token Types 12 Primary Impersonation
  • 13. James Forshaw @tiraniddo Impersonation Security Level 13 Anonymous Identification Impersonation Delegation
  • 14. James Forshaw @tiraniddo Token Duplication 14 Primary Impersonation Always Allowed Can duplicate token’s between types if have TOKEN_DUPLICATE access on handle Duplicated Token can be referenced with any set of access rights
  • 15. James Forshaw @tiraniddo Token Duplication 15 Primary Impersonation Always Allowed Only if level >= Impersonate Can duplicate token’s between types if have TOKEN_DUPLICATE access on handle Duplicated Token can be referenced with any set of access rights
  • 16. James Forshaw @tiraniddo Token Duplication 16 Primary Impersonation New Token LUID for Each Token Can duplicate token’s between types if have TOKEN_DUPLICATE access on handle Duplicated Token can be referenced with any set of access rights
  • 17. James Forshaw @tiraniddo Setting an Impersonation Token ● Impersonation assigns a token to a thread, replaced the token used in access checks for the majority of system calls 17 Direct Setting SetThreadToken() ImpersonateLoggedOnUser() NtSetInformationThread(...) Indirect Setting ImpersonateNamedPipeClient() RpcImpersonateClient() CoImpersonateClient() Kernel Setting PsImpersonateClient() SeImpersonateClient/Ex()
  • 18. James Forshaw @tiraniddo Impersonation Security 18 If Token Level < Impersonate If Process has Impersonate Privilege ALLOWED Restrict to Identification Level If Process IL < Token IL If Process User == Token User PsImpersonateClient(...) ► SeTokenCanImpersonate(...)
  • 19. James Forshaw @tiraniddo NtAccessCheck versus SeAccessCheck NtAccessCheck ● User mode system call ● Takes an impersonation token handle ● Only verifies impersonation level >= Identification 19 SeAccessCheck ● Kernel mode only ● Takes a subject context ● Verifies impersonation level >= Impersonation
  • 20. James Forshaw @tiraniddo Identification Tokens == Fake IDs 20 ● Would seem the biggest challenge is getting an impersonation token as a normal user ● Want to get hold of local system, or potentially arbitrary user
  • 21. James Forshaw @tiraniddo Capturing Identification Tokens 21
  • 22. James Forshaw @tiraniddo LogonUser ● Can be used to get a token if the user’s password is known ● Returns a full impersonation token which is configured for the caller to impersonate with no additional privileges ● No need to play games 22 HANDLE hToken; LogonUser("UserName", ".", "Password", LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, &hToken); ImpersonateLoggedOnUser(hToken);
  • 23. James Forshaw @tiraniddo UAC Linked Tokens ● If split token admin get linked token using GetTokenInformation ● Without TCB privilege you only get back an identification token 23 TOKEN_LINKED_TOKEN linked_token; GetTokenInformation(hToken, TokenLinkedToken, &linked_token, ...); // Identification level token for the admin HANDLE hToken = linked_token.LinkedToken;
  • 24. James Forshaw @tiraniddo Named Pipes ● Well known trick, get a system service to open a named pipe ● Call ImpersonateNamedPipeClient on pipe server handle ○ Normally needs pipe to be written to to get impersonation token so send over SMB (localhostpipemynamedpipe) ● Get service like Anti-Virus to scan the path to capture token 24 HANDLE hPipe = CreateNamedPipe(".dummy", ...); // Start Windows defender to scan localhostpipedummy ConnectNamedPipe(hPipe, NULL); ImpersonateNamedPipeClient(hPipe);
  • 25. James Forshaw @tiraniddo RPC/DCOM ● Many DCOM services over RPC support impersonation ● Plenty of scope for callbacks to be made as privileged user 25 // Set callback in system COM object (e.g. BITS) HRESULT ComCallback() { if(SUCCEEDED(CoImpersonateClient())) { HANDLE hToken; OpenThreadToken(GetCurrentThread(), ..., &hToken); } }
  • 26. James Forshaw @tiraniddo NTLM Negotiation ● LSASS exposes APIs to do network authentication ● Can get localhost NTLM authentication using redirected WebDAV ● Creates an impersonation level token even for a normal user 26 // Start fake WebDAV service on localhost // Init a AV scan to localhostfakefake BYTE* type1 = GetType1(); BYTE* challenge; AcceptSecurityContext(hContext type1, &challenge); BYTE* result = SetChallengeAndGetResult(challenge); AcceptSecurityContext(hContext, result, ...); QuerySecurityContextToken(hContext, &hToken);
  • 27. James Forshaw @tiraniddo Services For User (S4U) ● LsaLogonUser has an S4U mode ● At least on Windows 8.1 can get you a identification token for any local and remote user without any privileges ● Can’t get local system/local service/network service tokens ● Can craft token source which might be useful for certain things 27
  • 30. James Forshaw @tiraniddo How the Kernel Code Interacts with Tokens 30 System Calls (returns a HANDLE) ● ZwCreateToken(Ex) ● ZwOpenProcessToken(Ex) ● ZwOpenThreadToken(Ex) ● ZwFilterToken Process/Thread Manager Calls (returns a ACCESS_TOKEN pointer) ● PsReferencePrimaryToken ● PsReferenceImpersonationToken ● PsReferenceEffectiveToken ● SeCaptureSubjectContext Direct Access (returns a TOKEN pointer) ● EPROCESS::Token ● ETHREAD::ClientSecurity::ImpersonationToken ○ Only valid if ETHREAD::CrossThreadFlags bit 4 is set IO Manager ● IRP_MJ_CREATE SecurityContext
  • 31. James Forshaw @tiraniddo Not Checking Impersonation Level 31 ● When checking the token it’s important kernel code verifies impersonation level struct SECURITY_SUBJECT_CONTEXT { PACCESS_TOKEN ClientToken; SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; PACCESS_TOKEN PrimaryToken; PVOID ProcessAuditId; } context; #define SeQuerySubjectContextToken(c) (c->ClientToken ? c->ClientToken : c->PrimaryToken) SeCaptureSubjectContext(&context); // Get impersonation token or primary token PACCESS_TOKEN token = SeQuerySubjectContextToken(&context) // Do something with token Bad!, no check on ImpersonationLevel
  • 32. James Forshaw @tiraniddo Variants 32 SECURITY_IMPERSONATION_LEVEL imp_level; PACCESS_TOKEN token = PsReferenceImpersonationToken( PsGetCurrentThread(), ..., &imp_level); if (token == NULL) { token = PsReferencePrimaryToken(PsGetCurrentProcess()); } // Do something with token SECURITY_IMPERSONATION_LEVEL imp_level; TOKEN_TYPE token_type; PACCESS_TOKEN token = PsReferenceEffectiveToken( PsGetCurrentThread(), &token_type, ..., &imp_level); // Do something with token
  • 33. James Forshaw @tiraniddo Real Example CVE-2015-0002 33 BOOLEAN AhcVerifyAdminContext() { TOKEN_USER *user; SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; PACCESS_TOKEN token = PsReferenceImpersonationToken( PsCurrentThread(), ..., &ImpersonationLevel); if (token == NULL) { token = PsReferencePrimaryToken(PsCurrentProcess()); } SeQueryInformationToken(token, TokenUser, &user); if(RtlEqualSid(user->User->Sid, LocalSystemSid) || SeTokenIsAdmin(token)) { return TRUE; } return FALSE; } Bad!, no check on ImpersonationLevel
  • 34. James Forshaw @tiraniddo DEMO CVE-2015-0002 AppHelp Cache Control EoP 34
  • 35. James Forshaw @tiraniddo Is SeTokenIsAdmin Also Bad? ● CVE-2015-0002 was Windows 8+ only ● Similar bug existed on Windows 7, but could also bypass SeTokenIsAdmin as well 35 // Win7 BOOLEAN SeTokenIsAdmin(PACCESS_TOKEN Token) { return SepSidInToken(Token, SeExports->AdminGroupSid); } // Win8+ BOOLEAN SeTokenIsAdmin(PACCESS_TOKEN Token) { if (Token->TokenType == TokenImpersonation && Token->SecurityLevel < SecurityImpersonation) return FALSE; return SepSidInToken(Token, SeExports->AdminGroupSid); }
  • 36. James Forshaw @tiraniddo Crafted Subject Context 36 PSECURITY_DESCRIPTOR sd = ...; PACCESS_TOKEN primary_token = PsReferenceEffectiveToken(...); SECURITY_SUBJECT_CONTEXT context = {0}; context->PrimaryToken = primary_token; if (SeAccessCheck(sd, &context, ...) { // Do a privileged action }
  • 37. James Forshaw @tiraniddo Crafted Subject Context 37 PSECURITY_DESCRIPTOR sd = ...; PACCESS_TOKEN primary_token = PsReferenceEffectiveToken(...); SECURITY_SUBJECT_CONTEXT context = {0}; context->PrimaryToken = primary_token; if (SeAccessCheck(sd, &context, ...) { // Do a privileged action } BOOLEAN SeAccessCheck(..., PSECURITY_SUBJECT_CONTEXT context, ..., PNTSTATUS AccessStatus) { // Some initialization if (context.ClientToken && context.ImpersonationLevel < SecurityImpersonation) { *AccessStatus = STATUS_ACCESS_DENIED; return FALSE; } // Do access check with token }
  • 38. James Forshaw @tiraniddo Real Example RtlpAllowsLowBoxAccess 38 NTSTATUS RtlpAllowsLowBoxAccess(wchar_t* atomname) { SubjectSecurityContext.PrimaryToken = PsReferenceEffectiveToken( PsGetCurrentThread(), ...); SubjectSecurityContext.ProcessAuditId = PsGetCurrentProcess()->UniqueProcessId; BOOLEAN result = SeAccessCheckWithHint( SeAtomSd, 0, &SubjectSecurityContext, ...); // Handle result }
  • 39. James Forshaw @tiraniddo System Thread Impersonation ● Impersonation usually through SeImpersonateClient ● Can also use PsImpersonateClient ● If an explicit impersonation level is passed it will override what’s in the token 39 VOID DoWorkThread(LPVOID arg) { PACCESS_TOKEN token = arg; PsImpersonateClient(PsCurrentThread(), token, ..., SecurityImpersonation); } PACCESS_TOKEN token = PsReferenceImpersonationToken(...); PsCreateSystemThread(&hThread, ..., DoWorkThread, token);
  • 40. James Forshaw @tiraniddo Leaky Tokens ● Kernel code can capture access token objects just like any other kernel object and manipulate it ● Bad code could return the token to user mode as a handle ○ Only requires you pass the access check ● This goes against the leakage of tokens through impersonation as you can get hold of primary tokens from other processes ● Can be used to elevate privileges in restricted token scenarios 40 // Capture token in one process PACCESS_TOKEN token = PsReferenceEffectiveToken(); CapturedAccessToken = token; // Read in another OpenCapturedAccessToken(PHANDLE TokenHandle, ACCESS_MASK Access) { ObOpenObjectByPointer(CapturedAccessToken, Access, TokenHandle); }
  • 41. James Forshaw @tiraniddo Real Example CVE-2015-0078 ● Undocumented win32k system call NtUserGetClipboardToken introduced in Windows 8.1 41 Win32k Medium IL Process 1 W rite to Clipboard Captured Token Low IL Process Process 1 NtUserG etClipboardToken Open for read access
  • 42. James Forshaw @tiraniddo Why Is This a Problem? ● GENERIC_READ access gives TOKEN_DUPLICATE access right ● Duplicate to get a writable token then lower IL level ● As long as the same user allows us to assign the token. 42 TOKEN_MANDATORY_LABEL TokenMandatoryLabel; TokenMandatoryLabel.Label.Attributes = SE_GROUP_INTEGRITY; TokenMandatoryLabel.Label.Sid = MediumMandatoryLevelSid; SetTokenInformation(hNewToken, TokenIntegrityLevel, &TokenMandatoryLabel, sizeof(TOKEN_MANDATORY_LABEL));
  • 44. James Forshaw @tiraniddo Incorrect Token Duplication ● External duplication APIs, NtDuplicateToken and SeDuplicateToken check for impersonation level < Impersonate ● Kernel code can also use internal duplication function SepDuplicatetoken ● No checks done on the original token that it’s compatible for duplication 44
  • 45. James Forshaw @tiraniddo Real Example CVE-2015-0078 ● CreateProcessAsUser takes a token handle to assign as primary token ● Documented as requiring a Primary Token 45
  • 46. James Forshaw @tiraniddo Digging into NtCreateUserProcess 46 NTSTATUS PspReferenceTokenForNewProcess( HANDLE token, KPROCESSOR_MODE AccessMode, TOKEN **outtok) { result = ObReferenceObjectByHandle(token, TOKEN_ASSIGN_PRIMARY, SeTokenObjectType, AccessMode, outtok); return result; } Only requires TOKEN_ASSIGN_PRIMARY privileges
  • 47. James Forshaw @tiraniddo Token Creation NSTATUS SeSubProcessToken(_EPROCESS *process, _TOKEN *token, _TOKEN **subtoken) { OBJECT_ATTRIBUTES objattr; InitializeObjectAttributes(&objattr); SepDuplicateToken(token, &objattr, TokenPrimary, SecurityAnonymous, subtoken); // Do rest of initialization } 47 Explicitly Duplicate as Primary
  • 48. James Forshaw @tiraniddo SeAssignPrimaryTokenPrivilege ● Limit to general exploitability, caller process must have privilege or meet a set of criteria to assign token ● System services (such as IIS) have privilege so can be used as an EoP there, but what about user processes? 48 BOOLEAN has_assign_privilege = FALSE; if (SeSinglePrivilegeCheck(SeAssignPrimaryTokenPrivilege)) has_assign_privilege = TRUE; BOOLEAN can_assign; SeIsTokenAssignableToProcess(tokena, &can_assign); if ( !can_assign && !has_assign_privilege ) return STATUS_PRIVILEGE_NOT_HELD;
  • 49. James Forshaw @tiraniddo SeIsTokenAssignableToProcess 49 Parent Token Sibling Token Process Token Token ID Assigned Token Parent Token ID Equal CreateRestrictedToken Process Token Parent Token ID Auth ID Assigned Token Parent Token ID Auth ID Equal Equal DuplicateToken NtCreateLowBoxToken OR
  • 50. James Forshaw @tiraniddo LowBox Token Hierarchy ● LowBox Tokens used in things like IE EPM are siblings of the main user’s token. ● Using this issue can capture an identification token from main user and use that to create a new process with elevated privileges ● Only restriction is must be at same IL, which for IE EPM is Low 50
  • 52. James Forshaw @tiraniddo TOCTOU Issues ● Some bugs need to change the token between one call and the next ● Can be done from another thread ● Useful to bypass lower SeAccessCheck then subsequent additional checks 52 void DoUserAction() { if (SeAccessCheck(...)) { PACCESS_TOKEN token = PsReferenceEffectiveToken(); PSID sid = GetUserSid(token); // Do operations as that use } }
  • 53. James Forshaw @tiraniddo IO Manager TOCTOU ● IO Manager Only Captures Security during IRP_MJ_CREATE processing ● No subsequent IO calls are explicitly checked, so sometimes drivers do it manually 53 void UseDriver() { // Security check made here HANDLE hDevice = CreateFile(".DeviceName", ...); ImpersonateLoggedOnUser(hFakeId); // No further security checks DeviceIoControl(hDevice, ...); }
  • 54. James Forshaw @tiraniddo Real Example CVE-2015-0011 ● MRXDAV driver implements kernel mode component of WebDAV UNC path support ● Accessible through DeviceWebDavRedirector device, which does a security check ● Functionality implemented in Device IO Control commands, which does the following: 54 // Do Device IO Control SeCaptureSubjectContext(&ctx) SeQueryAuthenticationId(SeQuerySubjectContextToken(&ctx), &luid); if(luid == LocalSystemLUID) is_local_system = true; if (is_local_system) // Do privileged operation
  • 55. James Forshaw @tiraniddo Vulnerable Zw Calls ● Calls to ZwOpenThreadToken and ZwOpenProcessToken are deprecated, replaced with Ex Variants. ● This is because these calls were supposed to only be used from user mode and not the kernel ○ Didn’t specify a handles flag option ○ Meant all handles were opened as user-mode handles ○ Potential for a user-mode process to get access to privileged handles 55
  • 56. James Forshaw @tiraniddo Changes in Token Handling 56
  • 58. James Forshaw @tiraniddo Windows 10 Changes (Build 10159) 58 If Token Level < Impersonate If Process has Impersonate Privilege ALLOWED Restrict to Identification Level If Process IL < Token IL If Process User == Token User Elevation Check Capability Check
  • 59. James Forshaw @tiraniddo Windows 10 Impersonation Capability ● New Group and Capability SIDs to add impersonation capability ○ Session Impersonation Group ○ Constrained Impersonation Group ○ Constrained Impersonation Capability 59 If Same Session and Process Token has Session Impersonation Group If LowBox Token and Process Token has Constrained Impersonation Group If LowBox Token and Process Token has Constrained Impersonation Group If same LowBox Package SID Also needs SepAllowSessionImpersonationCap set in Kernel Flags
  • 60. James Forshaw @tiraniddo Windows 10 Elevated Token Impersonation ● Blocks impersonating an elevated token unless process token is also elevated ● Must be enabled in SeCompatFlags kernel flag ● Blocks trick used to elevate privileges with NtUserGetClipboardToken 60 if (SeTokenIsElevated(ImpersonationToken)) { if ((SeCompatFlags & 1) && !SeTokenIsElevated(ProcessToken)) { return STATUS_PRIVILEGE_NOT_HELD; } }