Living Off the Land

In case you are on host where you cannot load tools, and don't have internet access on it. You need to use built-in tools for enumeration.

Host & Network Recon

# We can get basic info about the system using this command
Systeminfo

# Get user's information and privileges
whoami /all

# Get the specified user's PowerShell history
Get-Content $env:APPDATA\Microsoft\Windows\Powershell\PSReadline\ConsoleHost_history.txt

# Prints the PC's Name
hostname
# Prints out the OS version and revision level
[System.Environment]::OSVersion.Version
# Displays a list of environment variables for the current session (ran from CMD-prompt)
set
Get-ChildItem Env: | ft Key,Value
# Displays the domain name to which the host belongs (ran from CMD-prompt)
echo %USERDOMAIN%
# Prints out the name of the Domain controller the host checks in with (ran from CMD-prompt)
echo %logonserver%
# Prints out network adapter state and configurations
ipconfig /all
# List of all known hosts stored in arp table
arp -a
# Displays routing table (IPv4 & IPv6)
route print

Recon using WMI

Windows Management Instrumentation (WMI) is a scripting engine that is widely used within Windows enterprise environments to retrieve information and run administrative tasks on local and remote hosts.

Net Commands for Domain Enumeration

Use net1 to avoid detection.

Dsquery

  • Dsquery is a helpful command-line tool that can be utilized to find Active Directory objects.

  • It exists on modern Windows systems at C:\Windows\System32\dsquery.dll

  • But we need shell from SYSTEM context.

Some Useful Commands

LDAP Filtering Explanation

https://academy.hackthebox.com/module/143/section/1360

Last updated