πŸ”§Miscellaneous Misconfigurations

🎯 HTB Academy: Active Directory Enumeration & Attacks

πŸ“ Overview

Miscellaneous Misconfigurations represent a broad collection of Active Directory vulnerabilities and attack vectors that may be encountered during assessments. These techniques exploit various design flaws, legacy features, and administrative oversights that can lead to domain compromise. Understanding these diverse attack vectors helps penetration testers think outside the box and discover issues that others might miss, providing comprehensive coverage of potential AD weaknesses.


πŸ”— Attack Chain Context

Complete Active Directory Assessment Timeline:

Standard Techniques β†’ Miscellaneous Misconfigurations β†’ Additional Attack Vectors β†’ Comprehensive Coverage
   (Core Methods)         (Diverse Vulnerabilities)        (Edge Cases)          (Complete Assessment)

Coverage Areas:

  • Exchange-related vulnerabilities: PrivExchange, group memberships

  • Protocol flaws: Printer Bug (MS-RPRN), MS14-068 Kerberos

  • Legacy features: GPP passwords, ASREPRoasting

  • Administrative oversights: DNS records, SYSVOL scripts, description fields

  • Group Policy abuse: GPO misconfigurations and exploitation


Exchange Security Model Overview

Critical Exchange Groups

Group Name
Privileges
Attack Potential

Exchange Windows Permissions

Write DACL to domain object

Can grant DCSync privileges

Organization Management

Full Exchange control ("Domain Admins" of Exchange)

Access all mailboxes, modify security groups

Account Operators

Can add accounts to Exchange groups

Lateral movement vector

Exchange Windows Permissions Exploitation

Attack Methodology

Privilege Escalation via Exchange Groups

  1. Identify Exchange group memberships: Enumerate current user's group memberships

  2. Leverage DACL misconfiguration: If member of Exchange Windows Permissions

  3. Grant DCSync privileges: Modify domain object ACL to include DCSync rights

  4. Execute DCSync attack: Extract domain credentials using secretsdump.py or Mimikatz

Common Attack Vectors

  • DACL misconfiguration: Direct addition to Exchange Windows Permissions group

  • Account Operators abuse: Add accounts to Exchange groups

  • Credential dumping: Exchange servers contain numerous cached credentials

  • OWA exploitation: Outlook Web Access credential harvesting

Exchange Server Compromise Impact

  • Domain Admin privileges: Exchange servers often lead to full domain compromise

  • Credential harvesting: 10s to 100s of cleartext credentials/NTLM hashes in memory

  • OWA credential caching: User logons cached after successful authentication

  • Mailbox access: Organization Management can access all domain user mailboxes


πŸƒ PrivExchange Attack

Vulnerability Overview

  • Flaw: Exchange Server PushSubscription feature vulnerability

  • Impact: Any domain user with mailbox can force Exchange server authentication

  • Protocol: HTTP authentication to attacker-controlled host

  • Privilege: Exchange service runs as SYSTEM with WriteDacl privileges (pre-2019 CU)

Attack Methodology

LDAP Relay Attack

Prerequisites

  • Domain user account: Any authenticated domain user with mailbox

  • Exchange vulnerability: Pre-2019 Cumulative Update installations

  • Network positioning: Ability to perform NTLM relay attacks

  • LDAP relay capability: Access to domain controller LDAP service

Exploitation Process

  1. Force Exchange authentication: Use PushSubscription feature to coerce authentication

  2. NTLM relay setup: Configure ntlmrelayx.py targeting domain controller LDAP

  3. Credential extraction: Dump NTDS database via relayed SYSTEM privileges

  4. Domain compromise: Use extracted credentials for full domain access


πŸ–¨οΈ Printer Bug (MS-RPRN)

MS-RPRN Protocol Vulnerability

Technical Details

  • Protocol: MS-RPRN (Print System Remote Protocol)

  • Function: Print job processing and print system management

  • Vulnerability: RpcOpenPrinter and RpcRemoteFindFirstPrinterChangeNotificationEx abuse

  • Impact: Force server authentication to attacker-controlled host over SMB

Attack Prerequisites

  • Domain user access: Any domain user can connect to spooler's named pipe

  • Spooler service: Runs as SYSTEM, installed by default on Windows servers

  • Desktop Experience: Required for spooler service installation

Exploitation Methods

Method 1: LDAP Relay for DCSync

Method 2: RBCD (Resource-Based Constrained Delegation)

Vulnerability Assessment

Enumeration with SecurityAssessment.ps1

Alternative Detection Tools

  • Get-SpoolStatus module: Check individual hosts for vulnerability

  • Specialized Python tools: Automated MS-RPRN vulnerability scanning

  • Network enumeration: Identify systems with spooler service enabled

Cross-Forest Attack Applications

  • Forest trust exploitation: Attack across forest boundaries

  • Unconstrained delegation: Target systems with unconstrained delegation

  • Trust relationship abuse: Leverage TGT delegation in trusted environments


🎫 MS14-068 Kerberos Vulnerability

Kerberos PAC Forging Vulnerability

Technical Background

  • Vulnerability: Kerberos Privilege Attribute Certificate (PAC) validation flaw

  • Impact: Standard domain user β†’ Domain Admin privilege escalation

  • Mechanism: Forged PAC accepted as legitimate by KDC

  • Authentication: Uses secret keys to validate PAC integrity

Exploitation Process

  1. PAC manipulation: Create fake PAC presenting user as Domain Administrator

  2. KDC bypass: Exploit validation flaw to accept forged PAC

  3. Privilege escalation: Gain Domain Admin or other privileged group membership

  4. Ticket generation: Create legitimate tickets with forged privileges

Exploitation Tools

Python Kerberos Exploitation Kit (PyKEK)

Impacket Toolkit

Defense and Remediation

  • Patching: Only defense against MS14-068 is applying security updates

  • Legacy systems: Often found on older, unpatched domain controllers

  • Assessment value: Demonstrates critical importance of patch management


πŸ” Sniffing LDAP Credentials

Application and Device Vulnerabilities

Common Credential Storage Locations

  • Web admin consoles: Applications storing LDAP credentials for domain connectivity

  • Network printers: LDAP authentication credentials in device configuration

  • Service applications: Software requiring domain authentication

  • Legacy systems: Older applications with poor credential management

Attack Methodology

Method 1: Cleartext Credential Discovery

Method 2: Test Connection Exploitation

Method 3: Full LDAP Server Simulation

Credential Privilege Assessment

  • Service accounts: Often highly privileged for application functionality

  • Initial foothold: May provide first domain access in external assessments

  • Lateral movement: Credentials may be reused across multiple systems

  • Privilege escalation: Service accounts sometimes have elevated permissions


🌐 Enumerating DNS Records

DNS Enumeration with adidnsdump

Tool Overview

  • Purpose: Enumerate all DNS records in Active Directory domain

  • Access requirement: Valid domain user account

  • Method: LDAP queries to extract DNS zone information

  • Advantage: Bypasses normal DNS query limitations

Why DNS Enumeration Matters

Practical DNS Enumeration

Basic DNS Enumeration

Analyzing Initial Results

Advanced Resolution with -r Flag

Strategic Value of DNS Enumeration

  • Target identification: Discover purpose of non-descriptive hostnames

  • Hidden services: Uncover services not found through normal enumeration

  • Infrastructure mapping: Understand network architecture and services

  • Attack planning: Prioritize targets based on discovered services


πŸ” Other Misconfigurations

Password in Description Field

Common Administrative Oversight

Enumeration with PowerView

Analysis and Exploitation

  • Export to CSV: For large domains, export data for offline analysis

  • Password patterns: Look for obvious password patterns in descriptions

  • Historical passwords: Old passwords may be reused elsewhere

  • Service accounts: Often contain current or legacy passwords

PASSWD_NOTREQD Field Analysis

UserAccountControl Attribute

Enumeration and Testing

Testing Strategy

  • Empty password testing: Attempt authentication with blank passwords

  • Weak password testing: Try common weak passwords

  • Password spraying: Use discovered accounts in password spray attacks

  • Documentation: Include findings in comprehensive assessments

Credentials in SMB Shares and SYSVOL Scripts

SYSVOL Share Enumeration

Script Discovery

Script Analysis Example

Credential Validation


πŸ”‘ Group Policy Preferences (GPP) Passwords

GPP Vulnerability Overview

Historical Context

  • Creation: GPP creates .xml files in SYSVOL share

  • Caching: Files cached locally on endpoints where GP applies

  • Encryption: AES-256 bit encryption with published private key

  • Patch: MS14-025 (2014) prevented new GPP passwords but didn't remove existing ones

Vulnerable File Types

File Name
Purpose
Credential Risk

drives.xml

Map network drives

Username/password for drive access

printers.xml

Printer configurations

Service account credentials

services.xml

Service creation/updates

Service account passwords

scheduledtasks.xml

Scheduled task creation

Task execution credentials

groups.xml

Local user management

Local administrator passwords

GPP Password Extraction

Manual Decryption

Automated Tools

CrackMapExec Modules

GPP Password Extraction

GPP Autologon Discovery

Alternative Tools

  • Get-GPPPassword.ps1: PowerShell script for GPP password extraction

  • GPP Metasploit Post Module: MSF module for automated GPP hunting

  • Python/Ruby scripts: Various custom tools for GPP password discovery

Strategic Considerations

  • Legacy accounts: GPP passwords often for disabled/locked accounts

  • Password reuse: Discovered passwords worth testing across domain

  • Local admin passwords: High value for lateral movement

  • Persistence: Files remain even after GPO deletion if not properly cleaned


🎫 ASREPRoasting

Kerberos Pre-Authentication Bypass

Technical Background

  • Target: Accounts with "Do not require Kerberos pre-authentication" enabled

  • Method: Request AS-REP (Authentication Service Reply) without pre-auth

  • Encryption: AS-REP encrypted with account's password

  • Attack: Offline password attack on retrieved AS-REP

Pre-Authentication vs. ASREPRoasting

Account Enumeration

PowerView Enumeration

Active Directory Module

AS-REP Extraction

Method 1: Rubeus (Windows)

Method 2: Kerbrute (Automatic Discovery)

Method 3: GetNPUsers.py (Linux)

Password Cracking

Hashcat Offline Cracking

Forced ASREPRoasting

  • GenericWrite/GenericAll: Can enable DONT_REQ_PREAUTH on target account

  • Attack workflow: Enable attribute β†’ Extract AS-REP β†’ Crack password β†’ Disable attribute

  • Stealth considerations: Temporary attribute modification may be logged


πŸ›οΈ Group Policy Object (GPO) Abuse

GPO Security Model Overview

GPO Attack Potential

  • Lateral movement: Modify GPOs affecting multiple hosts

  • Privilege escalation: Add rights to controlled user accounts

  • Domain compromise: GPO modifications can lead to full domain control

  • Persistence: GPO changes persist across reboots and user sessions

Common GPO Abuse Techniques

Attack Type
Method
Impact

User Rights Assignment

Add SeDebugPrivilege, SeTakeOwnershipPrivilege

Privilege escalation

Local Administrator Addition

Add user to local admins group

Host compromise

Scheduled Task Creation

Create immediate scheduled task

Code execution

Startup Script Modification

Modify computer startup scripts

Persistence

GPO Enumeration

PowerView GPO Discovery

Built-in PowerShell Cmdlets

GPO Permission Analysis

Domain Users Group Rights Assessment

GPO GUID to Name Resolution

BloodHound GPO Analysis

  • Visual representation: GPO relationships and affected objects

  • Affected systems: Identify which OUs and computers are impacted

  • Attack path planning: Determine best GPO targets for specific goals

  • Permission visualization: Understand complex permission structures

GPO Exploitation Tools

SharpGPOAbuse

OPSEC Considerations

  • Scope awareness: GPO changes affect ALL computers in linked OUs

  • Detection risk: GPO modifications often logged and monitored

  • Rollback procedures: Plan for reverting changes post-exploitation

  • Target selection: Choose GPOs with limited scope when possible


🎯 HTB Academy Lab Solutions

Lab Environment Details

  • Target Host: RDP to target with htb-student:Academy_student_AD!

  • Windows Attack Host: MS01 for Windows-based tools

  • Linux Access: SSH to 172.16.5.225 with htb-student:HTB_@cademy_stdnt!

πŸ” Question 1: "Find another user with the passwd_notreqd field set. Submit the samaccountname as your answer. The samaccountname starts with the letter 'y'."

Complete Solution Walkthrough:

Step 1: RDP Connection to Target

Step 2: PowerShell Preparation

Step 3: PASSWD_NOTREQD Enumeration

🎯 Answer: ygroce

Analysis: The user ygroce has both PASSWD_NOTREQD and DONT_REQ_PREAUTH flags set, making it vulnerable to multiple attack vectors.

🎫 Question 2: "Find another user with the 'Do not require Kerberos pre-authentication setting' enabled. Perform an ASREPRoasting attack against this user, crack the hash, and submit their cleartext password as your answer."

Complete Solution Walkthrough:

Step 1: Enumerate Users with Pre-Authentication Not Required

Step 2: AS-REP Hash Extraction with Rubeus

Step 3: Hash Cracking with Hashcat

🎯 Answer: Pass@word

Analysis: The user ygroce has both vulnerability flags (PASSWD_NOTREQD and DONT_REQ_PREAUTH) set, allowing for multiple attack vectors. The ASREPRoasting attack successfully extracted the AS-REP hash which was cracked to reveal the weak password "Pass@word".


πŸ“Š Key Takeaways

Technical Mastery Achieved

  1. Diverse Attack Vectors: Proficiency with numerous AD misconfiguration types

  2. Legacy Vulnerability Exploitation: GPP passwords, ASREPRoasting, MS14-068

  3. Administrative Oversight Discovery: Password fields, SYSVOL scripts, DNS records

  4. Group Policy Abuse: Understanding GPO security model and exploitation techniques

Professional Skills Developed

  • Comprehensive Assessment: Ability to find obscure misconfigurations others miss

  • Historical Vulnerability Knowledge: Understanding of legacy AD security issues

  • Client Communication: Explaining diverse findings with appropriate risk ratings

  • Remediation Guidance: Providing actionable fixes for various misconfiguration types

Attack Methodology Excellence

Defensive Insights

  • Administrative Training: Importance of secure AD administration practices

  • Legacy Cleanup: Need to remove old GPP passwords and unused accounts

  • Configuration Reviews: Regular audits of user account flags and GPO permissions

  • Monitoring Requirements: Detection strategies for unusual authentication patterns

πŸ”‘ Complete mastery of miscellaneous Active Directory misconfigurations - from Exchange vulnerabilities through legacy features to administrative oversights - representing comprehensive enterprise penetration testing capabilities for discovering hidden attack vectors!


Last updated