πŸ”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 :CanPSRemote relationship

2. RDP Access Rights

  • Protocol: Remote Desktop Protocol (RDP)

  • Port: 3389 (default)

  • Requirements: Remote Desktop Users group membership

  • Usage: Interactive desktop sessions

  • Detection: BloodHound :CanRDP relationship

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 :AdminTo relationship

Why Privileged Access Matters

  1. Lateral Movement: Access additional systems in the domain

  2. Credential Harvesting: Extract credentials from new systems

  3. Persistence: Establish multiple access points

  4. Data Exfiltration: Access sensitive data on various servers

  5. Network Mapping: Understand infrastructure layout

  6. 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

  1. Click "Upload Data" in BloodHound interface

  2. Select ZIP file ending with "_BloodHound"

  3. Wait for import to complete

  4. 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

  1. Default/Weak Credentials: sa account, service accounts

  2. SQL Injection: Application vulnerabilities leading to SQL access

  3. Credential Reuse: Domain credentials with SQL privileges

  4. Service Account Compromise: Kerberoasting SQL service accounts

  5. 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.107

  • RDP 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:

  1. User with CanPSRemote rights: bdavis

  2. Host accessible via WinRM: ACADEMY-EA-DC01

  3. Flag 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

  1. BloodHound Proficiency: Advanced Cypher queries for privilege discovery

  2. WinRM Exploitation: Multiple methods for PowerShell remoting abuse

  3. SQL Server Compromise: Complete administrative access via xp_cmdshell

  4. 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