Host Recon
For automated enumeration of potential PE vectors see here.
Get Help
# List available commands
help
# Help for a specified command
help <command>
<command> /?# List available commands
Get-Command
# Help for a specified command
Get-Help <command>
<command> -?Networking
All the below commands work with both CMD and Powershell.
General networking information, such as interfaces, IP addresses, and DNS:
ipconfig /allCheck recent communications via the ARP table:
arp -aList active TCP and UDP connections:
netstat -anoList recent and persistent routes:
route printTest-NetConnection -ComputerName 192.168.210.12 -Port 5985Test-Connection -Count 1 -Comp 10.10.10.10 -QuietSystem
# General system information
systeminfo
# Name of the host
hostname
# Operating system version
[environment]::OSVersion.Version
ver
echo %OS%
# Environment variables
dir env:
set
# Diplay the value of a specific variable
set %PATH%
echo %PATH%
# Named pipes
gci \\.\pipe\
# Clipboard
Get-ClipboardUsers & Groups
Shared Resources
All the below commands work with both CMD and Powershell.
Protections
Check WD's status with PS:
Check WD's status with CMD:
Check AppLocker's rules and policies with PS:
List hotfixes with both CMD and PS:
Files
PowerShell (PS) uses different host types depending on how it's being accessed, so the (Get-PSReadlineOption).HistorySavePath command will point to different files.
If the PS process is spawed as local (e.g. via SSH or RDP) →
ConsoleHost_history.txtIf the PS process is spawned as remote (e.g. WinRM) →
ServerRemoteHost_history.txt
PowerShell provides a convenient mechanism for storing encrypted credentials, commonly used in scripting and automation. These credentials are protected using the Data Protection API (DPAPI), which enforces that decryption is only possible by the same user account on the same system where the credentials were originally created.
Consider a scenario where a script, such as Connect-VC.ps1, has been configured to connect to a vCenter server:
While secure in normal operation, this protection is only as strong as the isolation of the user context. If command execution is obtained under the same user, or if DPAPI protections can be bypassed, the cleartext password can be retrieved directly from the stored credential file:
Writable Directories
Test access:
Use another user's credentials
Binaries
We can transfer the binary in a Unix-based attacking host and run strings on it:
Last updated
Was this helpful?