πŸ“œPass the Certificate (ESC8 & ADCS)

🎯 Overview

Pass the Certificate is an advanced Active Directory attack technique that leverages X.509 certificates to obtain Ticket Granting Tickets (TGTs) and ultimately achieve domain compromise. This attack primarily exploits:

  • Active Directory Certificate Services (AD CS) vulnerabilities

  • PKINIT authentication mechanism

  • Machine account privileges for DCSync

  • ESC8 NTLM relay attacks against ADCS HTTP endpoints

"Pass-the-Certificate attacks combine ADCS exploitation with Kerberos authentication to achieve domain admin privileges"

πŸ” PKINIT Authentication Architecture

Public Key Cryptography for Initial Authentication

PKINIT is an extension of the Kerberos protocol that enables:

  • X.509 certificate-based authentication

  • Smart card and certificate logons

  • Elimination of password-based pre-authentication

  • Machine account authentication via certificates

Certificate Authentication Flow

Attack Prerequisites

  • ADCS web enrollment enabled (HTTP endpoint accessible)

  • Valid domain credentials for NTLM relay coercion

  • Network access to both CA server and Domain Controller

  • KerberosAuthentication template (or similar machine template)

πŸŽ–οΈ ESC8 - NTLM Relay to ADCS HTTP Endpoint

ESC8 Attack Overview

ESC8 (Escalation 8) is an NTLM relay attack that:

  • Targets ADCS HTTP web enrollment endpoint

  • Relays machine account authentication

  • Obtains machine certificates for domain-joined computers

  • Bypasses PKI security through relay attack

Attack Architecture

πŸš€ ESC8 Attack Execution

Phase 1: Environment Setup

Required Tools Installation

Network Reconnaissance

Phase 2: NTLM Relay Attack Setup

Configure ntlmrelayx Listener

Phase 3: Authentication Coercion

Printer Bug Exploitation

Expected Relay Results

πŸ”§ OpenSSL Troubleshooting (Critical)

Common PKCS12 Generation Error

Package Conflict Issues

Fix Method 1: Downgrade pyOpenSSL

Fix Method 2: Ubuntu Package Method (Tested Working)

Fix Method 2.5: Force Installation (If dpkg errors)

Fix Method 3: Virtual Environment

Common Troubleshooting Scenarios

Port Already in Use Error

Printerbug RPC Errors

ntlmrelayx Hanging on "Getting certificate..."

🎫 PKINITtools Certificate Processing

Environment Setup

Kerberos Configuration

TGT Generation from Certificate

πŸ’Ž DCSync Attack with Machine Account

Machine Account Privileges

Machine accounts in Active Directory have:

  • Replication privileges by default

  • DCSync capability (DRSUAPI access)

  • High privileges for domain operations

  • No interactive logon restrictions

Execute DCSync

Full Domain Dump (Optional)

πŸ‘‘ Administrative Access via Pass-the-Hash

Evil-WinRM Connection

Post-Exploitation

🎯 HTB Academy Lab Walkthrough

Lab Environment

  • Domain: INLANEFREIGHT.LOCAL

  • Domain Controller: dc01.inlanefreight.local (10.129.234.174)

  • Certificate Authority: 10.129.234.172

  • Credentials: wwhite:package5shores_topher1

  • Target: Administrator's flag

Step-by-Step Execution

1. ESC8 NTLM Relay Setup

2. Authentication Coercion

3. PKINITtools Setup

4. DCSync Administrator

5. Administrator Access

Validation and Verification

Confirm Certificate Generation

Validate TGT Generation

Confirm DCSync Success

πŸ›‘οΈ Defense and Detection

Attack Detection

Prevention Strategies

Monitoring Queries

πŸ’‘ Key Takeaways

  1. ADCS is high-value target - Machine certificates = domain admin

  2. OpenSSL compatibility critical - Modern Kali has PKCS12 issues

  3. Machine accounts have DCSync - No privilege escalation needed

  4. NTLM relay still effective - Even in modern environments

  5. Certificate authentication bypasses - Many traditional controls

  6. PKINITtools essential - Converts certificates to Kerberos tickets

  7. Virtual environments solve - Many compatibility issues

  8. HTTPS vs HTTP matters - HTTP ADCS endpoints vulnerable

πŸ” Alternative Attack Vectors

Shadow Credentials

Other ESC Techniques

πŸš€ Quick Reference - ESC8 Attack Chain

Complete Attack Commands

Emergency OpenSSL Fix

🎯 HTB Academy Answer Key

  • Attack Type: ESC8 NTLM Relay to ADCS

  • Certificate Generated: DC01$.pfx (machine certificate)

  • Administrator Hash: fd02e525dd676fd8ca04e200d265f20c

  • Final Flag: a1fc497a8433f5a1b4c18274019a2cdb

  • Critical Fix: pyOpenSSL downgrade to version 22.1.0

Last updated