Chapter 43: Network Penetration Testing¶
Overview¶
Network penetration testing is the systematic evaluation of an organization's network infrastructure to identify exploitable vulnerabilities before adversaries do. Unlike vulnerability scanning, which produces automated output, network penetration testing requires human judgment to chain findings, exploit trust relationships, and demonstrate realistic attack paths from initial network access through domain compromise. This chapter covers the full methodology — from host discovery and service enumeration through lateral movement, credential harvesting, and domain dominance — with every offensive technique paired with its corresponding detection strategy. The goal is to produce security professionals who can think like attackers and build defenses that withstand real-world adversary operations.
Learning Objectives
- Execute a structured network penetration test methodology from reconnaissance through post-exploitation using industry-standard frameworks
- Enumerate network services and identify exploitable misconfigurations across common enterprise protocols (SMB, LDAP, Kerberos, DNS, SNMP)
- Explain credential harvesting techniques including LLMNR/NBT-NS poisoning, Kerberoasting, AS-REP roasting, and relay attacks at a conceptual level
- Demonstrate lateral movement concepts using pass-the-hash, pass-the-ticket, and remote service exploitation
- Map every offensive technique to MITRE ATT&CK and implement corresponding detection rules
- Write network penetration test findings that communicate risk to both technical and executive audiences
Prerequisites: Chapters 1–4 (telemetry, logging, detection), Chapter 16 (penetration testing methodology), Chapter 41 (red team methodology). Familiarity with TCP/IP, Active Directory, Windows event logging, and basic Linux command-line usage.
Curiosity Hook¶
The Flat Network That Cost $4.2 Million
A mid-size manufacturing firm hired a penetration testing team for a routine annual assessment. The tester's initial foothold was a printer on VLAN 10 — an HP LaserJet with default SNMP community strings exposed to the entire subnet. From the printer's management interface, the tester recovered LDAP credentials stored in plaintext for scan-to-email functionality. Those credentials — a service account with Domain Users membership — provided authenticated access to Active Directory.
Within 90 minutes, the tester had enumerated all SPNs, performed a Kerberoasting attack against three service accounts, and cracked one password offline in under four hours: Summer2024!. That service account had local admin rights on 47 servers due to a legacy GPO. The tester used pass-the-hash to move laterally to the backup server, where they discovered Domain Admin credentials cached in memory from a scheduled backup job.
Total time from printer to Domain Admin: 11 hours. The organization had a $2.1M SIEM deployment, EDR on every workstation, and a 24/7 SOC. None of them detected the attack. The reason: no network segmentation, no service account tiering, and no monitoring of Kerberos ticket requests. The subsequent incident response engagement — triggered by the penetration test report — revealed that three other threat actors had already traversed the same path. The breach disclosure, forensics, and remediation cost $4.2 million. The penetration test cost $35,000.
Network Penetration Testing Methodology¶
A structured methodology ensures comprehensive coverage and reproducible results. The following phases build upon each other sequentially, though skilled testers may iterate between phases as new information is discovered.
flowchart TD
A[Phase 1: Scoping &\nAuthorization] --> B[Phase 2: Host Discovery\n& Port Scanning]
B --> C[Phase 3: Service\nEnumeration]
C --> D[Phase 4: Vulnerability\nAnalysis]
D --> E[Phase 5: Exploitation\n& Initial Access]
E --> F[Phase 6: Credential\nHarvesting]
F --> G[Phase 7: Lateral\nMovement]
G --> H[Phase 8: Domain\nDominance]
H --> I[Phase 9: Post-Exploitation\n& Reporting]
style A fill:#1e3a5f,color:#e6edf3
style B fill:#2a4a6f,color:#e6edf3
style C fill:#36597f,color:#e6edf3
style D fill:#36597f,color:#e6edf3
style E fill:#8b4513,color:#e6edf3
style F fill:#8b4513,color:#e6edf3
style G fill:#8b4513,color:#e6edf3
style H fill:#8b4513,color:#e6edf3
style I fill:#1a3a1a,color:#e6edf3 Phase 1 — Scoping & Authorization¶
Before any packets leave the tester's machine, the engagement must have signed written authorization. Chapter 41 covers scoping and rules of engagement in detail. For network penetration testing specifically, the scope definition must include:
- IP ranges in scope (CIDR notation): e.g.,
10.50.0.0/16,192.168.100.0/24 - IP ranges out of scope: e.g.,
10.50.200.0/24(production SCADA network) - Testing window: business hours only vs. 24/7
- Allowed techniques: credential attacks, social engineering, physical access
- Fragile systems: printers, legacy devices, medical equipment, ICS/SCADA
- Point of contact: emergency phone number for immediate de-escalation
Critical: Fragile Systems
Network penetration tests can crash legacy systems. Older printers, embedded devices, and ICS/SCADA controllers may not tolerate aggressive port scanning. Always ask the client to identify fragile systems and either exclude them from scanning or use reduced-intensity scan profiles.
Phase 2 — Host Discovery & Port Scanning¶
Host discovery identifies live systems on the target network. Port scanning determines which services are exposed on each host. Together, they produce the attack surface map that guides all subsequent phases.
Host Discovery Concepts¶
Host discovery uses multiple protocols to determine whether an IP address has a live host. No single technique is universally reliable — firewalls, host-based firewalls, and network segmentation all affect results.
| Discovery Technique | Protocol | Advantages | Limitations |
|---|---|---|---|
| ARP Scan | Layer 2 | Fastest, cannot be blocked by host firewall | Only works on local subnet |
| ICMP Echo | ICMP Type 8 | Standard ping, widely supported | Often blocked by firewalls |
| TCP SYN Ping | TCP | Bypasses ICMP filtering | Requires specifying port(s) |
| TCP ACK Ping | TCP | Can traverse stateless firewalls | Blocked by stateful firewalls |
| UDP Ping | UDP | Discovers hosts that block TCP/ICMP | Unreliable, slow, rate-limited |
Nmap Scan Theory¶
Nmap is the foundational tool for network reconnaissance. Understanding its scan types is essential for both penetration testers and defenders.
| Scan Type | TCP Flags | Behavior | Detection Signature |
|---|---|---|---|
| TCP SYN (half-open) | SYN | Sends SYN, receives SYN/ACK (open) or RST (closed), never completes handshake | Incomplete TCP handshakes from single source |
| TCP Connect | Full handshake | Completes full three-way handshake | Logged by application-layer services |
| TCP ACK | ACK | Used for firewall rule mapping, not port discovery | Unexpected ACK packets without prior SYN |
| UDP Scan | UDP datagram | Sends empty UDP or protocol-specific payloads | ICMP port-unreachable responses, slow scan patterns |
| TCP FIN/XMAS/NULL | FIN / FIN+PSH+URG / None | Stealth scans exploiting RFC 793 behavior | Anomalous TCP flag combinations |
Conceptual: SYN Scan Workflow
Tester (10.50.1.100) -> Target (10.50.2.25)
Step 1: SYN -> port 445 -> Response: SYN/ACK -> Port OPEN (SMB)
Step 2: RST -> port 445 -> (Connection reset by tester)
Step 3: SYN -> port 3389 -> Response: RST -> Port CLOSED (RDP)
Step 4: SYN -> port 8080 -> Response: <none> -> Port FILTERED (firewall drop)
The half-open scan never completes the TCP handshake, reducing application-layer logging. However, modern IDS/IPS and EDR solutions detect SYN scan patterns through connection state analysis.
Port Scanning Strategy¶
A professional penetration test uses a phased scanning approach:
- Quick sweep: Top 100 TCP ports across all hosts — identifies the most common services in minutes
- Standard scan: Top 1,000 TCP ports on responsive hosts — covers the vast majority of enterprise services
- Full TCP scan: All 65,535 TCP ports on high-value targets — catches services on non-standard ports
- UDP scan: Top 100 UDP ports (DNS, SNMP, NTP, TFTP, IPMI) — slower but critical for finding management interfaces
- Service version detection: Banner grabbing and probe-response analysis on open ports
Blue Team: Detecting Port Scans
Network Detection:
- IDS rule: Alert on >50 SYN packets from single source to different destination ports within 60 seconds
- NetFlow analysis: Flag source IPs connecting to >20 unique destination ports in 5-minute window
- Firewall logs: Aggregate denied connections by source IP — high deny counts indicate scanning
Host Detection:
- Windows Security Event 5156 (Windows Filtering Platform connection allowed) — baseline normal connections, alert on anomalies
- Linux
iptablesLOG target — log and analyze connection attempts to closed ports
Phase 3 — Service Enumeration¶
Once open ports are identified, service enumeration extracts detailed information about each running service. This phase transforms a list of open ports into actionable intelligence.
SMB Enumeration (Ports 139/445)¶
Server Message Block (SMB) is the most information-rich protocol in Windows environments. Proper enumeration can reveal usernames, shares, group memberships, password policies, and OS versions.
Enumeration targets:
| Information | Method | Value to Attacker |
|---|---|---|
| SMB Signing | SMB negotiation | If disabled, relay attacks possible |
| Null Sessions | Anonymous bind | Unauthenticated access to user/share lists |
| Share Listing | Authenticated/anonymous | Access to files, scripts, credentials |
| OS Version | SMB banner | Identifies unpatched systems |
| Users & Groups | RPC/SAMR queries | Username list for password attacks |
| Password Policy | RPC queries | Lockout threshold, complexity requirements |
Conceptual: SMB Null Session Enumeration
Target: 10.50.2.50 (Windows Server 2019 — File Server)
[1] SMB Negotiation -> SMB signing: NOT required (relay attack possible)
[2] Null Session bind -> Anonymous access: ALLOWED
[3] Share enumeration:
\\10.50.2.50\ADMIN$ -> Access Denied
\\10.50.2.50\C$ -> Access Denied
\\10.50.2.50\IPC$ -> READ access (null session)
\\10.50.2.50\Public -> READ access
\\10.50.2.50\IT-Scripts -> READ/WRITE access
[4] User enumeration via SAMR:
Administrator, j.smith, s.johnson, svc-backup, svc-sqlengine
[5] Password policy:
Minimum length: 8 | Lockout threshold: 5 | Lockout duration: 30 min
Blue Team: SMB Hardening & Detection
Prevention:
- Enable SMB signing on all systems (GPO:
Microsoft network server: Digitally sign communications (always)) - Disable null sessions (GPO:
Network access: Restrict anonymous access to Named Pipes and Shares) - Remove unnecessary shares; apply least-privilege ACLs
- Disable SMBv1 (known vulnerabilities: EternalBlue family)
Detection:
- Windows Event 4624 (Logon Type 3) with anonymous username indicates null session attempt
- Windows Event 5140 (Network share accessed) — monitor for unusual share access patterns
- Network IDS: Alert on SAMR/LSARPC named pipe access from non-admin workstations
LDAP Enumeration (Ports 389/636)¶
Lightweight Directory Access Protocol provides a wealth of Active Directory information to any authenticated user (and sometimes to anonymous binds).
Key LDAP enumeration targets:
- Domain structure: Domain name, forest structure, trust relationships
- User accounts: sAMAccountName, userPrincipalName, memberOf, lastLogon, pwdLastSet
- Service accounts: Accounts with servicePrincipalName (SPN) set — Kerberoasting targets
- Group memberships: Domain Admins, Enterprise Admins, privileged groups
- Computer accounts: OS version, last logon, organizational unit placement
- GPO enumeration: Group Policy Objects linked to OUs, password policies, logon scripts
- LAPS: Whether Local Administrator Password Solution is deployed
Blue Team: LDAP Monitoring
- Monitor for high-volume LDAP queries from non-admin workstations (Event ID 1644 on DCs with diagnostic logging enabled)
- Alert on queries requesting
servicePrincipalNameattribute across all user objects (Kerberoasting reconnaissance) - Implement LDAP channel binding and signing to prevent relay attacks
SNMP Enumeration (Port 161/UDP)¶
Simple Network Management Protocol often uses default community strings (public, private) and can expose extensive system information including network interfaces, routing tables, running processes, installed software, and ARP caches.
| SNMP Version | Authentication | Encryption | Risk Level |
|---|---|---|---|
| SNMPv1 | Community string (plaintext) | None | Critical |
| SNMPv2c | Community string (plaintext) | None | Critical |
| SNMPv3 | Username/password + auth protocol | Optional (DES/AES) | Low (if configured properly) |
Common Finding: Default SNMP Community Strings
In the synthetic assessment data below, 23% of network devices in the 10.50.0.0/16 range responded to the default public community string. SNMP read access provided full interface listings, ARP tables (revealing additional hosts), and running configuration details on network switches.
Target: 10.50.1.1 (Cisco Catalyst 9300 — Core Switch)
Community String: public (READ)
System Description: Cisco IOS XE Software, Version 17.06.03
System Contact: netops@acmecorp.example.com
Interfaces: 48 (GigabitEthernet1/0/1 through 1/0/48)
ARP Table: 312 entries (reveals additional live hosts)
Routing Table: 15 routes (reveals network topology)
VLAN Database: 8 VLANs (reveals segmentation boundaries)
Phase 4 — Vulnerability Analysis¶
Vulnerability analysis correlates enumeration findings with known vulnerabilities and misconfigurations. This phase bridges enumeration and exploitation.
Vulnerability Categories in Network Testing¶
| Category | Examples | Risk | Common in |
|---|---|---|---|
| Missing patches | EternalBlue (MS17-010), ZeroLogon (CVE-2020-1472), PrintNightmare (CVE-2021-34527) | Critical | Legacy systems, poor patch management |
| Default credentials | SNMP public, Tomcat tomcat:tomcat, IPMI ADMIN:ADMIN | High | Network devices, management interfaces |
| Misconfigurations | SMB signing disabled, LLMNR enabled, unconstrained delegation | High | Default Windows domain configurations |
| Weak protocols | Telnet, FTP, SNMPv1/v2c, NTLM without EPA | Medium-High | Legacy infrastructure |
| Weak credentials | Password1!, Company2024!, service account password reuse | High | Environments with weak password policies |
Prioritization Matrix¶
quadrantChart
title Vulnerability Prioritization
x-axis Low Exploitability --> High Exploitability
y-axis Low Impact --> High Impact
quadrant-1 Exploit Immediately
quadrant-2 Plan Carefully
quadrant-3 Deprioritize
quadrant-4 Quick Wins
ZeroLogon: [0.95, 0.95]
Default SNMP: [0.85, 0.60]
SMB Signing Off: [0.75, 0.80]
LLMNR Enabled: [0.80, 0.70]
Weak SSH Ciphers: [0.30, 0.25]
Missing SMB Patch: [0.65, 0.85]
Telnet Enabled: [0.70, 0.45] Phase 5 — Credential Harvesting¶
Credential harvesting is the process of obtaining valid authentication material — passwords, hashes, tickets, or tokens — that enable deeper access to the target environment. This phase is often the turning point in a network penetration test.
LLMNR/NBT-NS Poisoning¶
Link-Local Multicast Name Resolution (LLMNR) and NetBIOS Name Service (NBT-NS) are fallback name resolution protocols in Windows environments. When DNS fails to resolve a hostname, Windows broadcasts the query via LLMNR (UDP 5355) or NBT-NS (UDP 137). An attacker on the same network segment can respond to these broadcasts, impersonate the requested host, and capture NTLMv2 hashes.
sequenceDiagram
participant V as Victim Workstation<br/>10.50.1.50
participant D as DNS Server<br/>10.50.1.10
participant A as Attacker<br/>10.50.1.100
V->>D: DNS Query: fileserv01.acme.local?
D-->>V: NXDOMAIN (typo, no such host)
V->>V: LLMNR Broadcast: Who has fileserv01?
A-->>V: LLMNR Response: I am fileserv01 (10.50.1.100)
V->>A: SMB Connection with NTLMv2 Auth
A->>A: Capture NTLMv2 Hash
Note over A: Hash captured for offline cracking
A->>A: Offline Cracking or Relay Conceptual flow:
- A user types
\\fileserv01\shared(typo — actual server isfileserver01) - DNS returns NXDOMAIN
- Windows falls back to LLMNR, broadcasting "Who is fileserv01?" to the local subnet
- The attacker's listener responds: "I am fileserv01"
- The victim initiates an SMB connection to the attacker, sending NTLMv2 authentication
- The attacker captures the NTLMv2 hash for offline cracking or relay
Blue Team: LLMNR/NBT-NS Mitigation
Prevention (Critical — Disable These Protocols):
- Disable LLMNR via GPO:
Computer Configuration > Administrative Templates > Network > DNS Client > Turn off Multicast Name Resolution > Enabled - Disable NBT-NS via DHCP option or NIC settings:
NetBIOS over TCP/IP > Disabled - Deploy mDNS carefully — it has similar poisoning risks
Detection:
- Monitor for LLMNR (UDP 5355) and NBT-NS (UDP 137) traffic on the network — in a properly configured environment, this traffic should not exist
- IDS signature: Alert on LLMNR responses from hosts that are not DNS servers
- Honeypot: Deploy a listener that logs any LLMNR/NBT-NS poisoning attempts
NTLM Relay Attacks¶
When SMB signing is not required, an attacker can relay captured NTLM authentication to another host rather than cracking it. This is particularly dangerous because it works with any password complexity — the attacker never needs to know the plaintext password.
Relay attack prerequisites:
- SMB signing is not required on the target (default for Windows workstations)
- The captured credentials have administrative access on the target
- The attacker can trigger an authentication to their machine (LLMNR poisoning, print spooler abuse, etc.)
Conceptual: NTLM Relay Attack Chain
Environment:
- Attacker: 10.50.1.100
- Victim (auth): 10.50.1.50 (j.smith, Domain Admin, logged in)
- Target (relay): 10.50.2.25 (Server, SMB signing disabled)
Step 1: Attacker poisons LLMNR on subnet 10.50.1.0/24
Step 2: j.smith workstation sends NTLMv2 auth to attacker
Step 3: Attacker relays authentication to 10.50.2.25 (port 445)
Step 4: Server accepts authentication (j.smith is local admin)
Step 5: Attacker executes commands on 10.50.2.25 as j.smith
Result: Code execution on server without knowing j.smith password
Blue Team: NTLM Relay Prevention
Prevention:
- Enable SMB signing on all systems — this is the most effective countermeasure
- GPO:
Microsoft network server: Digitally sign communications (always)set to Enabled - GPO:
Microsoft network client: Digitally sign communications (always)set to Enabled - Enable EPA (Extended Protection for Authentication) on all web services
- Implement LDAP channel binding on domain controllers
Detection:
- Monitor for authentication events where the source IP does not match the machine account (Event 4624 — compare Workstation Name with Source Network Address)
- Alert on NTLMv2 authentication to servers from unexpected source IPs
Kerberoasting¶
Kerberoasting targets Active Directory service accounts that have Service Principal Names (SPNs) registered. Any authenticated domain user can request a Kerberos Ticket Granting Service (TGS) ticket for any SPN. The TGS ticket is encrypted with the service account's password hash, making it crackable offline.
sequenceDiagram
participant A as Attacker<br/>(Domain User)
participant DC as Domain Controller<br/>10.50.1.10
participant SA as Service Account<br/>svc-sqlengine
A->>DC: TGS-REQ for SPN: MSSQLSvc/sql01.acme.local:1433
Note over DC: Any authenticated user can<br/>request TGS for any SPN
DC-->>A: TGS-REP (ticket encrypted with svc-sqlengine hash)
A->>A: Extract ticket for offline cracking
Note over A: If svc-sqlengine password is weak:<br/>Cracked in minutes to hours
A->>SA: Authenticate as svc-sqlengine Why Kerberoasting is effective:
- Any domain user can request TGS tickets — no special privileges required
- The attack is nearly invisible in default logging configurations
- Service account passwords are often weak, old, and never rotated
- Service accounts frequently have elevated privileges (local admin on servers, database access)
Blue Team: Kerberoasting Detection & Prevention
Prevention:
- Use Group Managed Service Accounts (gMSA) — 120-character randomly generated passwords, auto-rotated every 30 days
- Enforce 25+ character passwords for traditional service accounts
- Minimize SPNs — remove unused SPNs from accounts
- Use AES256 encryption for service accounts (not RC4/DES)
Detection (High Value):
- Windows Event 4769 (Kerberos Service Ticket Operations):
- Filter:
Ticket Encryption Type = 0x17(RC4) — legitimate services should use AES - Filter: Multiple TGS requests from single user for different SPNs in short timeframe
- Baseline normal TGS request patterns per user account
- Filter:
- Create a honeypot SPN on a decoy service account — any TGS request for this SPN is 100% malicious
AS-REP Roasting¶
AS-REP roasting targets accounts that have Kerberos pre-authentication disabled (DONT_REQUIRE_PREAUTH flag). For these accounts, the KDC returns an AS-REP message encrypted with the user's password hash — without requiring the attacker to know the password first.
| Attribute | Kerberoasting | AS-REP Roasting |
|---|---|---|
| Target | Accounts with SPNs | Accounts without pre-auth |
| Prerequisite | Any domain authentication | Can be unauthenticated if usernames are known |
| Ticket type | TGS (encrypted with service hash) | AS-REP (encrypted with user hash) |
| Detection event | Event 4769 (TGS request) | Event 4768 (AS request) with pre-auth failure type |
| Prevalence | Common (many SPNs exist) | Less common (pre-auth disabled is unusual) |
Blue Team: AS-REP Roasting Prevention
- Audit all accounts with pre-auth disabled using Active Directory queries (conceptual PowerShell:
Get-ADUser -Filter {DoesNotRequirePreAuth -eq $true}) - Enable pre-authentication on all accounts — there is rarely a legitimate reason to disable it
- Monitor Event 4768 for AS requests without pre-authentication from unusual source IPs
Phase 6 — Lateral Movement¶
Lateral movement is the process of moving from one compromised system to another within the target network. This phase leverages harvested credentials to expand access and reach high-value targets.
Pass-the-Hash (PtH)¶
Pass-the-hash allows an attacker to authenticate using an NTLM hash without knowing the plaintext password. This works because Windows NTLM authentication uses the hash directly — the password is never transmitted.
Prerequisites:
- Local administrator access on at least one host (to extract hashes)
- Target host accepts NTLM authentication (not Kerberos-only)
- Target host has a local account with the same password hash, OR the attacker has a domain account hash
Conceptual: Pass-the-Hash Attack Flow
Step 1: Attacker has admin access on WKST-50 (10.50.1.50)
Step 2: Extract local admin NTLM hash from SAM database
Administrator:500:aad3b435b51404eeaad3b435b51404ee:fc525c9683e8fe067095ba2ddc971889
Step 3: Many organizations reuse the local admin password across workstations
Step 4: Use hash to authenticate to WKST-51 (10.50.1.51) without knowing password
Step 5: Commands execute as local Administrator on WKST-51
Blue Team: Pass-the-Hash Mitigation
Prevention:
- Deploy LAPS (Local Administrator Password Solution) — unique random password per workstation, auto-rotated
- Disable NTLM where possible; enforce Kerberos authentication
- Restrict local admin accounts from network logon (GPO:
Deny access to this computer from the network) - Implement Protected Users security group for privileged accounts
- Use Credential Guard on Windows 10/11 to protect credential storage
Detection:
- Event 4624 (Logon Type 3) with
LogonProcessName = NtLmSsp— NTLM network logon - Correlate: same NTLM hash authenticating from multiple source IPs (lateral movement indicator)
- Event 4625 (Failed logon) spikes from a single source — password spraying or hash reuse testing
Pass-the-Ticket (PtT)¶
Pass-the-ticket uses stolen Kerberos tickets (TGT or TGS) to authenticate to services. Unlike pass-the-hash, this technique uses Kerberos and can bypass NTLM restrictions.
Key concepts:
- Golden Ticket: Forged TGT using the KRBTGT account hash — grants access to any resource in the domain for up to 10 years (default TGT lifetime can be overridden)
- Silver Ticket: Forged TGS using a service account hash — grants access to a specific service without contacting the DC
- Diamond Ticket: Modified legitimate TGT — harder to detect than golden tickets because it has valid PAC data
| Ticket Type | Required Hash | Scope | Detection Difficulty |
|---|---|---|---|
| Golden Ticket | KRBTGT hash | Entire domain | Medium (PAC validation, lifetime anomalies) |
| Silver Ticket | Service account hash | Single service | High (no DC interaction to log) |
| Diamond Ticket | KRBTGT hash | Entire domain | Very high (legitimate TGT modification) |
Blue Team: Kerberos Ticket Attack Detection
Prevention:
- Reset KRBTGT password twice (to invalidate all existing tickets) — perform periodically (every 180 days)
- Enable Kerberos armoring (FAST) to protect AS and TGS exchanges
- Implement PAC validation on services
Detection:
- Event 4769: TGS requests with anomalous lifetimes (>10 hours default)
- Event 4768: AS requests with encryption types that do not match account configuration
- Alert on TGT tickets with lifetimes exceeding domain policy
- Monitor for service access without corresponding TGS request at the DC (silver ticket indicator)
Remote Execution Methods¶
Once credentials are obtained, lateral movement requires executing commands on remote systems. Several Windows protocols support remote execution:
| Method | Port(s) | Protocol | Artifacts | Detection |
|---|---|---|---|---|
| PsExec-style | 445 | SMB (named pipes) | Service creation (Event 7045), Logon Event 4624 Type 3 | Event 7045: new service with random name |
| WMI | 135 + dynamic | DCOM/RPC | WMI event logs, process creation | Event 4688: process created via WmiPrvSE.exe |
| WinRM | 5985/5986 | HTTP/HTTPS | PowerShell remoting logs | Event 4688: wsmprovhost.exe, Event 91/168 (WinRM) |
| Scheduled Task | 445 | RPC | Task creation/execution events | Event 4698: new scheduled task |
| DCOM | 135 + dynamic | DCOM/RPC | Process creation events | Event 4688: process spawned by DCOM service |
| SSH | 22 | SSH | Auth logs on Linux targets | /var/log/auth.log: accepted publickey/password |
Blue Team: Lateral Movement Detection Strategy
The most effective lateral movement detection correlates multiple data sources:
- Network: Unusual SMB (445), WinRM (5985/5986), or RPC (135) connections between workstations (workstation-to-workstation lateral movement is rare in most environments)
- Authentication: Event 4624 Type 3 logons from unexpected source hosts
- Process creation: Event 4688 with parent processes like
services.exe,WmiPrvSE.exe, orwsmprovhost.exe - Service creation: Event 7045 with random service names or command-line content
- Behavioral: User accounts authenticating to systems they have never accessed before
Phase 7 — Domain Dominance¶
Domain dominance represents the highest level of access in a Windows Active Directory environment. Achieving domain admin or equivalent privileges gives the tester control over all domain-joined systems, users, and policies.
Active Directory Attack Path Concepts¶
Attack paths in Active Directory are chains of permissions, group memberships, and trust relationships that allow escalation from a low-privilege user to domain admin. Tools like BloodHound (conceptually) map these paths by collecting Active Directory relationship data.
Common attack path elements:
| Element | Description | Example |
|---|---|---|
| Nested group membership | User in Group A, which is member of Group B (Domain Admins) | j.smith > IT-Support > Server-Admins > Domain Admins |
| Local admin rights | User has local admin on a server where a DA is logged in | Dump DA credentials from memory |
| Unconstrained delegation | Computer trusted for delegation can impersonate any user | Capture TGT of any user authenticating to this host |
| Constrained delegation | Service can impersonate users to specific services | Protocol transition: S4U2Self then S4U2Proxy chain |
| ACL abuse | User has WriteDACL, GenericAll, or ForceChangePassword on privileged object | Reset DA password, modify group membership |
| GPO abuse | User can modify a GPO linked to an OU containing privileged users | Deploy logon script that captures credentials |
DCSync Attack Concept¶
DCSync simulates the behavior of a domain controller requesting replication data. An attacker with the Replicating Directory Changes and Replicating Directory Changes All permissions can request password hashes for any account — including KRBTGT.
Conceptual: DCSync Permissions Required
Required permissions on the domain object (NC head):
- DS-Replication-Get-Changes (GUID: 1131f6aa-9c07-11d1-f79f-00c04fc2dcd2)
- DS-Replication-Get-Changes-All (GUID: 1131f6ad-9c07-11d1-f79f-00c04fc2dcd2)
By default, these permissions are held by:
- Domain Admins
- Enterprise Admins
- Domain Controllers group
- Administrators (builtin)
DCSync request extracts:
- NTLM hash for target account
- Kerberos keys (AES256, AES128, DES, RC4)
- Password history (if stored)
- Supplemental credentials
Blue Team: DCSync Detection
Prevention:
- Audit and restrict accounts with replication permissions — only domain controllers should have these rights
- Regular ACL audits on the domain head object
Detection (Critical — High-Fidelity Alert):
- Event 4662 on domain controllers: Access to
DS-Replication-Get-Changes-Allby non-DC machine accounts - Alert on DRS (Directory Replication Service) RPC traffic from non-DC IP addresses
- This detection has very low false-positive rate in properly configured environments
Phase 8 — Post-Exploitation & Evidence Collection¶
Post-exploitation focuses on demonstrating business impact and collecting evidence for the report. The goal is not to cause damage — it is to prove what an attacker could achieve and document the evidence chain.
Evidence Standards¶
| Evidence Type | Purpose | Format |
|---|---|---|
| Screenshots | Visual proof of access | PNG with timestamp, hostname visible |
| Command output | Technical proof of exploitation | Text log with timestamp and context |
| File samples | Proof of data access (synthetic only) | Redacted file metadata — never exfiltrate real PII |
| Network captures | Protocol-level evidence | PCAP filtered to relevant traffic |
| Hash/ticket artifacts | Proof of credential compromise | Hash values (never plaintext passwords in reports) |
| Attack timeline | Chronological attack narrative | Table: timestamp, action, result, ATT&CK technique |
Ethical Obligation: Data Handling
During a network penetration test, the tester may encounter real sensitive data — PII, financial records, intellectual property, healthcare records. The Rules of Engagement (Chapter 41) must define data handling procedures. Best practice:
- Never exfiltrate real PII — use metadata (file name, path, record count) as proof of access
- Encrypt all evidence at rest using AES-256
- Delete all evidence from tester's systems within the agreed timeframe (typically 30-90 days)
- Report data findings to the client immediately if critical data exposure is discovered
MITRE ATT&CK Mapping¶
| Tactic | ID | Technique | Detection |
|---|---|---|---|
| Reconnaissance | TA0043 | T1046 — Network Service Discovery | IDS: Port scan detection, NetFlow analysis |
| Initial Access | TA0001 | T1078 — Valid Accounts | Event 4624: Anomalous logon source/time |
| Credential Access | TA0006 | T1557.001 — LLMNR/NBT-NS Poisoning | Network: LLMNR/NBT-NS traffic monitoring, honeypot |
| Credential Access | TA0006 | T1558.003 — Kerberoasting | Event 4769: RC4 TGS requests, multiple SPN requests |
| Credential Access | TA0006 | T1558.004 — AS-REP Roasting | Event 4768: Pre-auth not required requests |
| Credential Access | TA0006 | T1003.006 — DCSync | Event 4662: Replication permission access by non-DC |
| Credential Access | TA0006 | T1003.001 — LSASS Memory | EDR: Process access to lsass.exe |
| Lateral Movement | TA0008 | T1550.002 — Pass the Hash | Event 4624 Type 3: NTLM from unexpected sources |
| Lateral Movement | TA0008 | T1550.003 — Pass the Ticket | Event 4769: Anomalous ticket lifetimes |
| Lateral Movement | TA0008 | T1021.002 — SMB/Windows Admin Shares | Event 5140: Share access from unusual hosts |
| Lateral Movement | TA0008 | T1021.006 — Windows Remote Management | Event 91/168: WinRM connection from non-admin hosts |
| Lateral Movement | TA0008 | T1021.003 — DCOM | Event 4688: Process via DcomLaunch service |
| Discovery | TA0007 | T1087.002 — Domain Account Discovery | LDAP query volume monitoring |
| Discovery | TA0007 | T1069.002 — Domain Groups Discovery | SAMR/LDAP enumeration from non-admin hosts |
| Privilege Escalation | TA0004 | T1078.002 — Domain Accounts | Event 4728/4756: Privileged group membership changes |
Tools Reference (Conceptual Overview)¶
Educational Context
The following tools are described conceptually for educational purposes. This chapter does not provide working exploit code or step-by-step attack instructions. All tools should only be used in authorized penetration testing engagements with proper written authorization.
| Tool | Purpose | Category |
|---|---|---|
| Nmap | Host discovery, port scanning, service enumeration, NSE scripts | Reconnaissance |
| Metasploit Framework | Exploit development framework, payload delivery, post-exploitation modules | Exploitation |
| Impacket | Python library for network protocols — SMB, Kerberos, LDAP, DCOM, WMI | Credential attacks, lateral movement |
| Responder | LLMNR/NBT-NS/mDNS poisoner, credential capture | Credential harvesting |
| CrackMapExec/NetExec | Network-wide credential validation, SMB enumeration, lateral movement automation | Enumeration, lateral movement |
| BloodHound | Active Directory relationship mapping, attack path analysis | Discovery, privilege escalation |
| Rubeus | Kerberos interaction — Kerberoasting, AS-REP roasting, ticket manipulation | Credential access |
| Mimikatz | Credential extraction from Windows memory — hashes, tickets, keys | Credential access |
| Certipy | Active Directory Certificate Services (AD CS) attack tool | Privilege escalation |
| Hashcat/John | Offline password hash cracking | Credential access |
Exam Prep & Certifications¶
Relevant Certifications
The topics in this chapter align with the following certifications:
Review Questions¶
Review Questions
-
Explain the difference between a TCP SYN scan and a TCP Connect scan. What are the detection implications of each? Why might a penetration tester prefer one over the other?
-
Describe the LLMNR/NBT-NS poisoning attack chain from initial broadcast to credential capture. What are the three most effective mitigations, and which one eliminates the attack entirely?
-
Compare Kerberoasting and AS-REP roasting. What prerequisites does each require? What Active Directory attributes are targeted? How should defenders detect each?
-
Explain why SMB signing prevents NTLM relay attacks. What is the difference between SMB signing being "supported" versus "required"? What Group Policy settings enforce SMB signing?
-
What is a DCSync attack and what permissions are required? Why is this considered a high-fidelity detection opportunity? Write a conceptual detection rule.
-
Describe three lateral movement techniques and their corresponding detection artifacts. For each, identify the Windows Event IDs that would reveal the activity.
-
Why are Group Managed Service Accounts (gMSA) effective against Kerberoasting? What other mitigations reduce Kerberoasting risk for organizations that cannot yet migrate to gMSA?
-
Design a network penetration test scope document for a hypothetical organization. The target is a hospital with 500 workstations, an Active Directory domain, a PACS imaging system, and an IoT network of patient monitors. What would you include in scope? What would you exclude? What special considerations apply?
Key Takeaways¶
Key Takeaways
-
Methodology drives quality — a structured approach from host discovery through domain dominance ensures comprehensive coverage and reproducible results that provide genuine value to the client.
-
Credential harvesting is the pivot point — most successful network compromises rely on credential theft (LLMNR poisoning, Kerberoasting, cached credentials) rather than software exploits. Defenders should prioritize credential hygiene.
-
LLMNR and NBT-NS should be disabled in every environment — these legacy name resolution protocols provide trivial credential capture opportunities with no meaningful business justification in modern networks.
-
SMB signing prevents relay attacks — enforcing SMB signing across all systems eliminates an entire class of NTLM relay attacks. This single configuration change has outsized security impact.
-
Service accounts are the weakest link in Active Directory — Kerberoasting succeeds because service accounts have weak passwords, excessive privileges, and SPNs. Group Managed Service Accounts (gMSA) eliminate this risk.
-
Every offensive technique has a detection opportunity — pass-the-hash generates Event 4624 Type 3, Kerberoasting generates Event 4769, DCSync generates Event 4662. Purple team integration ensures these detections are operational.
-
Lateral movement detection requires correlation — no single log source reveals lateral movement. Effective detection correlates authentication events, network connections, service creation, and process execution across multiple hosts.