π΄ββ οΈLiving Off the Land
π Overview
"Living Off the Land" refers to using only native Windows tools and commands for Active Directory enumeration and reconnaissance. This approach is essential when external tools cannot be uploaded, when operating in restricted environments, or when maintaining maximum stealth. By leveraging built-in Windows utilities, PowerShell cmdlets, and AD-integrated tools, we can perform comprehensive enumeration without introducing foreign binaries that might trigger security controls.
π― Strategic Context
π‘οΈ When to Use Living Off the Land
Restricted Environments: No internet access or file upload capabilities
Stealth Operations: Minimizing detection by avoiding external tool signatures
Managed Hosts: Client-provided systems with restrictive policies
EDR Evasion: Built-in tools are less likely to trigger alerts
Baseline Operations: Understanding what's possible with native capabilities
β οΈ Operational Considerations
Logging Awareness: Many commands generate logs in Event Viewer
PowerShell Monitoring: Script Block Logging captures command history
EDR Detection: Even native tools can trigger behavioral analysis
Version Dependencies: Tool availability varies across Windows versions
Privilege Requirements: Some commands require elevated privileges
π§ Basic Environmental Reconnaissance
π Host Information Gathering
Essential System Commands
Command
Purpose
Output
hostname
Computer name
Host identifier
[System.Environment]::OSVersion.Version
OS version
Build and revision details
wmic qfe get Caption,Description,HotFixID,InstalledOn
Patch level
Security updates applied
ipconfig /all
Network configuration
Adapter settings and IPs
set
Environment variables
System and user variables
echo %USERDOMAIN%
Domain name
Current domain affiliation
echo %logonserver%
Domain controller
Authenticating DC
Comprehensive System Information
Example Output Analysis:
β‘ PowerShell Reconnaissance
π PowerShell Environment Analysis
Example PowerShell Environment Check:
π PowerShell Version Downgrade (Stealth Technique)
Example Downgrade Process:
π‘οΈ Security Controls Assessment
π₯ Windows Firewall Enumeration
Example Firewall Analysis:
π‘οΈ Windows Defender Assessment
Example Defender Analysis:
π₯ Session and User Analysis
Example Session Analysis:
π Network Intelligence Gathering
π Network Configuration Discovery
Example Network Discovery:
π Network Intelligence Analysis
ARP Entries: Recently contacted hosts (potential targets)
Routing Table: Known network segments (lateral movement opportunities)
DNS Cache: Previously resolved domains and hosts
Active Connections: Current network activity and services
π WMI (Windows Management Instrumentation)
π Core WMI Queries
System and Domain Information
Example WMI Domain Discovery:
Advanced WMI Techniques
π Net Commands
π Essential Net Command Reference
Command
Purpose
Example Usage
net accounts
Password policy
Local account settings
net accounts /domain
Domain password policy
Domain-wide policies
net group /domain
Domain groups
All domain security groups
net group "Domain Admins" /domain
Group membership
Privileged users
net user /domain
Domain users
All domain user accounts
net user USERNAME /domain
User details
Specific user information
net localgroup
Local groups
Host-specific groups
net localgroup administrators
Admin group
Local administrators
net share
Shared resources
Available network shares
net view
Network hosts
Visible domain computers
net view /domain
Domain computers
Domain-joined systems
π Domain Enumeration Examples
Example Domain Group Enumeration:
Example User Information:
π Net1 Stealth Technique
π Dsquery (Directory Services Query)
π Overview
Dsquery is a native Active Directory command-line tool for LDAP-based queries. It exists on all domain-joined systems and provides powerful search capabilities without requiring additional tools.
π₯ User and Computer Enumeration
Example User Discovery:
π Advanced LDAP Filtering
π§ LDAP Filter Components
OID (Object Identifier) Rules
OID
Function
Usage
1.2.840.113556.1.4.803
Bitwise AND
Exact bit match required
1.2.840.113556.1.4.804
Bitwise OR
Any matching bit
1.2.840.113556.1.4.1941
Distinguished Name
Membership/ownership chains
UserAccountControl Values
Value
Flag
Description
1
SCRIPT
Login script executed
2
ACCOUNTDISABLE
Account disabled
8
HOMEDIR_REQUIRED
Home directory required
16
LOCKOUT
Account locked out
32
PASSWD_NOTREQD
Password not required
64
PASSWD_CANT_CHANGE
Password cannot change
128
ENCRYPTED_TEXT_PWD_ALLOWED
Encrypted text password allowed
512
NORMAL_ACCOUNT
Normal user account
8192
SERVER_TRUST_ACCOUNT
Domain controller
65536
DONT_EXPIRE_PASSWORD
Password never expires
Logical Operators
π― HTB Academy Lab Solutions
π Lab Questions & Solutions
π‘οΈ Question 1: "Enumerate the host's security configuration information and provide its AMProductVersion."
Solution Process:
Expected Output:
Expected Answer: 4.18.2202.4
π₯ Question 2: "What domain user is explicitly listed as a member of the local Administrators group on the target host?"
Solution Process:
Expected Output:
Expected Answer: damundsen
π© Question 3: "Utilizing techniques learned in this section, find the flag hidden in the description field of a disabled account with administrative privileges. Submit the flag as the answer."
Solution Process:
Expected Output:
Expected Answer: HTB{...}
π§ Advanced Native Techniques
π PowerShell One-Liners
π WMI Remote Enumeration
π Registry-Based Discovery
β‘ Quick Reference Commands
π§ Essential Command Matrix
Category
Command
Purpose
System Info
systeminfo
Complete system overview
Network
ipconfig /all
Network configuration
Network
arp -a
Known hosts discovery
Network
route print
Network topology
Security
netsh advfirewall show allprofiles
Firewall status
Security
Get-MpComputerStatus
Defender configuration
Sessions
qwinsta
Active sessions
Domain
net group /domain
Domain groups
Domain
net user /domain
Domain users
Domain
dsquery user
LDAP user query
Domain
dsquery computer
LDAP computer query
WMI
wmic ntdomain list /format:list
Domain information
π Rapid Enumeration Script
π Key Takeaways
β
Native Tool Advantages
No File Transfer: Built-in tools eliminate upload requirements
Reduced Detection: Lower probability of triggering security controls
Legitimate Activity: Commands blend with normal administrative tasks
Universal Availability: Tools exist on all Windows domain systems
π― Strategic Enumeration Priorities
System Context: Understand host role and privilege level
Security Posture: Assess defensive capabilities and monitoring
Network Topology: Map accessible systems and network segments
Domain Structure: Identify users, groups, and trust relationships
Attack Vectors: Locate privilege escalation and lateral movement opportunities
β οΈ Operational Security Considerations
PowerShell Logging: Script Block Logging captures command history
Event Generation: Net commands and WMI queries create Event Log entries
Behavioral Analysis: Unusual command patterns may trigger EDR alerts
Version Downgrade: PowerShell v2.0 bypasses modern logging capabilities
Alternative Syntax: Use
net1instead ofnetto avoid string detection
π Escalation Pathways
After native enumeration, typical next steps include:
Credential Harvesting: Memory dumps, registry extraction, file hunting
Privilege Escalation: Service misconfigurations, scheduled tasks, permissions
Lateral Movement: PSRemoting, WMI execution, service account abuse
Persistence: Registry modifications, service creation, scheduled tasks
Living off the land demonstrates that comprehensive Active Directory enumeration is possible using only native Windows tools - proving that security through obscurity is insufficient and that proper access controls and monitoring are essential for domain protection.
Last updated