πŸ΄β€β˜ οΈ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

  1. System Context: Understand host role and privilege level

  2. Security Posture: Assess defensive capabilities and monitoring

  3. Network Topology: Map accessible systems and network segments

  4. Domain Structure: Identify users, groups, and trust relationships

  5. 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 net1 instead of net to 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