2 - Windows Permissions
Topics
Introduction to the Windows Shells
Windows Permissions
Reverse Shells in Windows
SeImpersonatePrivilege Exploitation
On Cross Compilation
Windows Services
Weak Service Permissions
Unquoted Service Path
DLL Hijacking
Always Install Elevated
Files with Sensitive Data
Windows Hashes
Stored Credentials and the Windows Vault
Scheduled Task
Critical Registry Paths
Useful Tools
AMSI Bypass
Authentication, Authorization and Session Management
Authentication
Authentication is the process of verifying the identity of a user or entity attempting to access a system. Windows supports several authentication mechanisms, including:
Password-Based Authentication: Verifies user credentials stored in the Security Account Manager (SAM) or Active Directory.
Kerberos Protocol: A ticket-based authentication method used in domain environments.
NTLM (NT LAN Manager): A challenge-response authentication protocol for non-domain systems or backward compatibility.
Biometric Authentication: Uses features like Windows Hello for facial recognition or fingerprint scanning.
Authorization
Authorization determines what actions a user or process is permitted to perform after authentication. It relies on:
Access Control Lists (ACLs): Define the permissions for objects, like files or registry keys.
Group Memberships: Users inherit permissions based on their group affiliations, such as "Administrators" or "Users."
Security Policies: Set through Group Policy to enforce restrictions or grant privileges.
Session Management
Session management handles user sessions to ensure secure and isolated execution of processes.
Logon Sessions: Created when a user logs in and managed by the Local Security Authority Subsystem Service (LSASS).
Session Isolation: Ensures that one user’s processes and data cannot interfere with another’s.
Access Tokens: Generated during authentication to represent the user and their permissions throughout the session.
Security Principals and Security Identifiers (SIDs)
Security Principals
Users (e.g.,
JohnDoe
)Groups (e.g.,
Administrators
)Computer accounts
Threads or processes
Security Identifiers (SIDs)
Structure of a SID:
S-1
: Identifier authority (Windows NT SID).5
: Security authority (NT Authority).21
: Identifier for domain or local computer.<RID>
: Relative identifier unique to the principal.
SIDs are generated by different components depending on the situation:
The SID for local accounts and group is generated by the Local Security Authority (LSA)
The SID for domain users and domain group is generated by the Domain Controller (DC)
Well-Known SIDs
S-1-5-18
: Local System account.S-1-5-32-544
: Administrators group.S-1-1-0
: Everyone group.
How to Obtain a SID
Using PowerShell:
Using CMD:
Access Tokens
Access tokens contain the following information:
SIDs for the groups of which the user is a member
An owner SID
The SID for the primary group
The source of the access token
Current impersonation levels
Other statistics
File Permissions and ACLs
File Permissions
Permissions determine how users and processes can interact with files and folders. Common permissions include:
Read: View file contents.
Write: Modify file contents.
Execute: Run executable files.
Access Control Lists (ACLs)
Discretionary ACL (DACL): Specifies who can access an object and their permissions.
System ACL (SACL): Defines auditing rules for tracking access events.
To check ACLs:
PowerShell:
CMD:
Mandatory Integrity Control (MIC)
Integrity Levels:
Low: Limited rights (e.g., internet browsers).
Medium: Standard user privileges.
High: Elevated privileges (administrators).
System: Reserved for OS processes.
Effect: Objects with lower integrity levels cannot modify objects with higher levels.
View integrity levels:
User Account Control (UAC)
Separation of Privileges: Even when logged in as an administrator, users run most applications with standard user permissions. Elevation is required for tasks that could impact system integrity or security.
Protection Against Malware: Prevents unauthorized programs from making changes by prompting for user consent or administrative credentials.
Compliance: Aligns with the principle of least privilege (PoLP), ensuring users operate with the minimum required permissions.
How UAC Works
When an application or process requests elevated privileges:
Prompt Displayed: UAC prompts the user with a dialog box indicating that an application is requesting higher privileges.
Secure Desktop Mode: The desktop dims (a feature called Secure Desktop) to prevent other applications from interacting with the UAC prompt.
User Interaction Required: The user must either allow or deny the elevation request.
Elevation or Denial:
If allowed, the process receives an elevated token with administrative privileges.
If denied, the process continues with standard privileges or exits.
Disclaimer
❗ Never use tools and techniques on real IP addresses, hosts or networks without proper authorization!❗
Last updated