πPrivileged Access
π HTB Academy: Active Directory Enumeration & Attacks
π Overview
Privileged Access represents the lateral movement and privilege expansion phase following domain compromise. After achieving DCSync capabilities and extracting domain credentials, the next step is identifying and exploiting remote access rights across the enterprise. This module covers BloodHound enumeration for privileged access, WinRM/PSRemote exploitation, and SQL Server administrative access abuse.
π Attack Chain Progression
Complete Active Directory Compromise Timeline:
ACL Enumeration β ACL Abuse β DCSync β Privileged Access β Full Infrastructure Control
(Discovery) (Exploit) (Extract) (Lateral Move) (Domain Domination)Prerequisites from Previous Modules:
Domain credentials extracted: Via DCSync attack
Administrative access established: From ACL abuse tactics
Domain understanding achieved: Through enumeration phases
π§ Privileged Access Concepts
Types of Remote Access Rights
1. WinRM/PSRemote Access
Protocol: Windows Remote Management (WinRM)
Port: 5985 (HTTP), 5986 (HTTPS)
Authentication: Kerberos, NTLM, Basic
Privileges: Allows PowerShell remoting and command execution
Detection: BloodHound
:CanPSRemoterelationship
2. RDP Access Rights
Protocol: Remote Desktop Protocol (RDP)
Port: 3389 (default)
Requirements: Remote Desktop Users group membership
Usage: Interactive desktop sessions
Detection: BloodHound
:CanRDPrelationship
3. SQL Server Administrative Access
Service: Microsoft SQL Server
Privileges: sysadmin role membership
Capabilities: Command execution via xp_cmdshell
Common accounts: Service accounts with elevated SQL privileges
Detection: Manual enumeration, credential testing
4. Local Administrator Rights
Scope: Local machine administrative privileges
Methods: Local Administrators group membership
Usage: Full system control, credential extraction
Detection: BloodHound
:AdminTorelationship
Why Privileged Access Matters
Lateral Movement: Access additional systems in the domain
Credential Harvesting: Extract credentials from new systems
Persistence: Establish multiple access points
Data Exfiltration: Access sensitive data on various servers
Network Mapping: Understand infrastructure layout
Attack Path Expansion: Find additional privilege escalation opportunities
π©Έ BloodHound for Privileged Access Enumeration
SharpHound Data Collection
Complete Domain Enumeration
Expected Output:
SharpHound Collection Methods
Group: Group membership relationships
LocalAdmin: Local administrator privileges
Session: Active user sessions
Trusts: Domain trust relationships
ACL: Access Control List permissions
Container: OU and container permissions
RDP: Remote Desktop access rights
ObjectProps: Object properties and attributes
DCOM: DCOM execution rights
SPNTargets: Service Principal Names
PSRemote: PowerShell remoting capabilities
BloodHound GUI Analysis
Starting BloodHound
Importing SharpHound Data
Click "Upload Data" in BloodHound interface
Select ZIP file ending with "_BloodHound"
Wait for import to complete
Verify data loaded in database
Cypher Queries for Privileged Access
WinRM/PSRemote Access Enumeration
RDP Access Rights
Local Administrator Rights
DCOM Execution Rights
All High-Privilege Paths
π» WinRM/PSRemote Exploitation
Understanding WinRM Architecture
WinRM Service Components
WS-Management Protocol: Web Services for Management
HTTP/HTTPS Transport: Ports 5985/5986
Authentication Methods: Kerberos, NTLM, Basic, Certificate
PowerShell Remoting: Built on WinRM infrastructure
Security Context: Commands run as authenticated user
WinRM Configuration Requirements
PSRemote Privilege Verification
Using PowerShell Remoting
Using Evil-WinRM (Linux)
Common PSRemote Attack Vectors
1. Credential Spraying
2. Pass-the-Hash via WinRM
3. Golden/Silver Ticket Usage
ποΈ SQL Server Administrative Access
SQL Server Privilege Escalation Overview
SQL Server Roles and Permissions
sysadmin: Full administrative privileges
db_owner: Database ownership privileges
db_ddladmin: DDL administrative privileges
public: Default role for all users
xp_cmdshell: Extended stored procedure for command execution
Common SQL Server Attack Vectors
Default/Weak Credentials: sa account, service accounts
SQL Injection: Application vulnerabilities leading to SQL access
Credential Reuse: Domain credentials with SQL privileges
Service Account Compromise: Kerberoasting SQL service accounts
Linked Server Abuse: Pivoting through SQL server links
SQL Server Enumeration and Exploitation
Using Impacket mssqlclient.py
Basic SQL Server Enumeration
Enabling xp_cmdshell
Command Execution via xp_cmdshell
Advanced SQL Server Exploitation
Linked Server Exploitation
SQL Server Agent Jobs
CLR Integration Abuse
π― HTB Academy Lab Solutions
Lab Environment Details
Target IP:
10.129.149.107RDP Credentials:
htb-student:Academy_student_AD!Linux Attack Host:
172.16.5.225(SSH:htb-student:HTB_@cademy_stdnt!)
π Question 1: "What other user in the domain has CanPSRemote rights to a host?"
Solution Steps:
1. RDP Connection:
2. SharpHound Data Collection:
Real Lab Output:
3. BloodHound Analysis:
4. Data Import and Query:
Upload Data: Click "Upload Data" and select the generated ZIP file
Wait for Import: Allow BloodHound to process the data
Execute Cypher Query:
Lab Result: The query reveals that bdavis has CanPSRemote rights to a host.
π― Answer: bdavis
π» Question 2: "What host can this user access via WinRM? (just the computer name)"
Solution Steps:
Using the same BloodHound session and Cypher query from Question 1:
Analysis: Examining the graph visualization or query results shows that bdavis has CanPSRemote access to ACADEMY-EA-DC01.
π― Answer: ACADEMY-EA-DC01
ποΈ Question 3: "Leverage SQLAdmin rights to authenticate to the ACADEMY-EA-DB01 host (172.16.5.150). Submit the contents of the flag at C:\Users\damundsen\Desktop\flag.txt."
Solution Steps:
1. SSH to Linux Attack Host:
Real Lab Output:
2. SQL Server Authentication:
Real Lab Output:
3. Enable xp_cmdshell and Execute Commands:
Real Lab Output:
π― Answer: 1m_the_sQl_@dm1n_n0w!
π HTB Academy Lab Summary
Verified Lab Answers:
User with CanPSRemote rights:
bdavisHost accessible via WinRM:
ACADEMY-EA-DC01Flag contents:
1m_the_sQl_@dm1n_n0w!
Key Lab Techniques:
SharpHound data collection for comprehensive domain enumeration
BloodHound Cypher queries for privileged access discovery
mssqlclient.py Windows authentication for SQL Server access
xp_cmdshell command execution for system-level access
Attack Chain Demonstrated:
π‘οΈ Detection and Defensive Measures
WinRM/PSRemote Detection
Event Monitoring
PowerShell Logging
SQL Server Security Hardening
xp_cmdshell Disable
SQL Server Monitoring
General Defensive Recommendations
1. Privileged Access Management (PAM)
2. Network Segmentation
3. Monitoring and Detection
4. Regular Security Assessments
π Advanced Privileged Access Techniques
BloodHound Advanced Queries
Complex Attack Path Discovery
Privileged Service Account Discovery
Automated Privilege Escalation
PowerShell Empire Integration
Cobalt Strike Integration
Cross-Platform Attack Chaining
Linux to Windows Pivoting
Multi-Domain Exploitation
π Key Takeaways
Technical Mastery Achieved
BloodHound Proficiency: Advanced Cypher queries for privilege discovery
WinRM Exploitation: Multiple methods for PowerShell remoting abuse
SQL Server Compromise: Complete administrative access via xp_cmdshell
Lateral Movement: Systematic approach to expanding domain access
Professional Skills Developed
Graph Database Analysis: Understanding relationship-based attack paths
Multi-Platform Operations: Seamless Linux/Windows tool integration
Service-Specific Exploitation: SQL Server administrative abuse
Detection Awareness: Understanding defensive signatures and countermeasures
Attack Chain Mastery
Defensive Insights
Monitoring Requirements: WinRM, SQL Server, and privileged account activity
Preventive Measures: Service hardening, privilege minimization, network segmentation
Detection Strategies: Behavioral analysis, unusual authentication patterns
Response Procedures: Incident containment for privileged access abuse
π Complete lateral movement and privilege expansion mastery achieved - from domain compromise through privileged access discovery to multi-service exploitation - representing advanced Active Directory penetration testing capabilities for enterprise environments!
Last updated