Windows

  • The general goal of Windows privilege escalation is to further our access to a given system to a member of the Local Administrators group or the NT AUTHORITY\SYSTEM LocalSystem account.

  • In some cases, privilege escalation may be the ultimate goal of the assessment if our client hires us for a "gold image" or "workstation breakout" type assessment.

  • We can escalate privileges to one of the following depending on the system configuration and what type of data we encounter:

  • The highly privileged NT AUTHORITY\SYSTEM account, or LocalSystem account which is a highly privileged account with more privileges than a local administrator account and is used to run most Windows services.

  • The built-in local administrator account. Some organizations disable this account, but many do not. It is not uncommon to see this account reused across multiple systems in a client environment.

  • Another local account that is a member of the local Administrators group. Any account in this group will have the same privileges as the built-in administrator account.

  • A standard (non-privileged) domain user who is part of the local Administrators group.

  • A domain admin (highly privileged in the Active Directory environment) that is part of the local Administrators group.

Network Information

ipconfig /all
arp -a
route print

System Information

# To View tasks list
tasklist /svc

# View env variable
set
Get-ChildItem Env:

# System info
systeminfo

# Patches and updates
wmic qfe
Get-HotFix | ft -AutoSize

# Installed programs
wmic product get name
Get-WmiObject -Class Win32_Product |  select Name, Version

# Active connections
# Focus on entries listening on loopback addresses
netstat -ano

# Users & Groups information
query user  # logged in users
net user    # all users
net localgroup  # all groups
net localgroup administrators   # details about group
net accounts    # password policy and other info

echo %USERNAME%     # username
whoami
whoami /priv    # User privileges
whoami /group # User group information

Named Pipe Attack

  • We can use lax permissions assigned to named pipes to escalate privileges on the host to SYSTEM.

Windows User Privileges

  • Privileges in Windows are rights that an account can be granted to perform a variety of operations on the local system such as managing services, loading drivers, shutting down the system, debugging an application, and more.

  • Privileges are different from access rights, which a system uses to grant or deny access to securable objects.

SeImpersonate and SeAssignPrimaryToken

  • In Windows, every process has a token that has information about the account that is running it.

  • These tokens are not considered secure resources, as they are just locations within memory that could be brute-forced by users that cannot read memory.

  • Legitimate programs may utilize another process's token to escalate from Administrator to Local System, which has additional privileges. Processes generally do this by making a call to the WinLogon process to get a SYSTEM token, then executing itself with that token placing it within the SYSTEM space.

  • Attackers often abuse this privilege in the "Potato style" privescs - where a service account can SeImpersonate, but not obtain full SYSTEM level privileges.

SeDebugPrivilege

  • This privilege can be used to capture sensitive information from system memory, or access/modify kernel and application structures.

  • We can elevate our privileges to SYSTEM by launching a child process and using the elevated rights granted to our account via SeDebugPrivilege to alter normal system behavior to inherit the token of a parent process and impersonate it.

SeTakeOwnershipPrivilege

  • SeTakeOwnershipPrivilege grants a user the ability to take ownership of any "securable object," meaning Active Directory objects, NTFS files/folders, printers, registry keys, services, and processes. This privilege assigns WRITE_OWNER rights over an object, meaning the user can change the owner within the object's security descriptor.

  • These privileges can also be used to escalate privileges: SeBackupPrivilege, SeRestorePrivilege, and SeSecurityPrivilege

  • Sometimes this privilege can be disabled. So, we have to enable it first.

  • We can change ownership of some important file and read it.

  • Interesting files:

Windows Built-in Groups

Backup Operators

  • Membership of this group grants its members the SeBackup and SeRestore privileges.

  • Copying NTDS.dit

  • Extracting credentials from NTDS.dit file

Event Log Readers

  • Administrators or members of the Event Log Readers group have permission to access logs.

DNS Admins

coming soon

Last updated