Active Directory Pentest — วิธีทดสอบเจาะระบบ AD และป้องกัน
Active Directory (AD) เป็นหัวใจของระบบ IT ในองค์กรส่วนใหญ่ — จัดการ Authentication, Authorization และ Policy สำหรับ User, Computer และ Resource ทั้งหมดในเครือข่าย ด้วยเหตุนี้ AD จึงเป็น เป้าหมายหลัก (Primary Target) ของ Attacker ทุกราย เพราะการ Compromise Domain Admin เท่ากับ ควบคุมทุกอย่าง ในองค์กร
Active Directory คืออะไร — ทำไมเป็นเป้าหมายหลัก
Active Directory คือ Directory Service ของ Microsoft ที่ใช้จัดการ:
- Authentication — ยืนยันตัวตน User ทั้งองค์กรผ่าน Kerberos/NTLM
- Authorization — กำหนดสิทธิ์เข้าถึง File Share, Application, Resource ต่าง ๆ
- Group Policy — ควบคุม Configuration ของ Computer และ User ทั้ง Domain
- DNS — เป็น DNS Server หลักของ Internal Network
ทำไม AD เป็นเป้าหมาย?
| เหตุผล | คำอธิบาย |
|---|---|
| Single Point of Control | Domain Admin = ควบคุมทุก User, Computer, Server ใน Domain |
| Trust Relationships | Domain Trust ทำให้ Compromise Domain หนึ่ง → เข้าถึง Domain อื่นได้ |
| Legacy Protocols | NTLM, LLMNR, NBT-NS ยังคงเปิดใช้งานในหลายองค์กร |
| Misconfiguration | สิทธิ์เกินจำเป็น, Service Account ที่มี Password ไม่แข็งแรง, ACL ที่ผิดพลาด |
| Credential Reuse | Password เดียวกันใช้หลาย Service → Compromise ที่เดียวลามทั้ง Domain |
AD Attack Chain — จาก Reconnaissance สู่ Domain Admin
การโจมตี Active Directory มักเป็น Chain ที่เชื่อมโยงหลายเทคนิคเข้าด้วยกัน [1]:
┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Reconnaissance│ → │ Credential │ → │ Lateral │ → │ Domain │
│ & Enumeration│ │ Access │ │ Movement │ │ Admin │
└──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘
│ │ │ │
• Domain Enum • Kerberoasting • Pass-the-Hash • DCSync
• User Enum • AS-REP Roasting • NTLM Relay • Golden Ticket
• BloodHound • Password Spray • WMI/PSRemoting • Silver Ticket
• SMB/LDAP Scan • Credential Dump • RDP Hijacking • AdminSDHolder
Phase 1: Reconnaissance & Enumeration
เป้าหมาย: Map ทั้ง Domain — ค้นหา User, Group, Computer, Trust Relationship และ Attack Path
| เทคนิค | คำอธิบาย | เครื่องมือ |
|---|---|---|
| Domain Enumeration | ค้นหา Domain Name, Domain Controller, DNS Record | nxc smb 10.10.10.0/24, enum4linux-ng |
| User Enumeration | รายชื่อ User ทั้งหมด, Admin Group Member, Service Account | GetADUsers.py, ldapsearch |
| BloodHound Collection | Graph ทุก Relationship ใน AD → หา Shortest Path to Domain Admin | bloodhound-python, SharpHound |
| SMB Signing Check | ตรวจว่า SMB Signing ถูกบังคับหรือไม่ (ถ้าไม่ → NTLM Relay ได้) | nxc smb --gen-relay-list |
| SPN Enumeration | ค้นหา Service Principal Name เพื่อระบุเป้าหมาย Kerberoasting | GetUserSPNs.py |
Phase 2: Credential Access
เป้าหมาย: ได้ Credential (Password, Hash, Ticket) ของ User ที่มีสิทธิ์สูงขึ้น
| เทคนิค | คำอธิบาย | เครื่องมือ |
|---|---|---|
| Kerberoasting | Request TGS Ticket สำหรับ Service Account → Crack Offline [2] | GetUserSPNs.py, Rubeus |
| AS-REP Roasting | โจมตี User ที่ Disable Kerberos Pre-Authentication → Crack Offline | GetNPUsers.py, Rubeus |
| Password Spraying | ทดสอบ Password ทั่วไป (เช่น Company2026!) กับ User หลายราย | nxc smb -u users.txt -p 'Company2026!' |
| LLMNR/NBT-NS Poisoning | Capture NTLM Hash จาก Broadcast Protocol ที่ไม่ปลอดภัย | Responder, Inveigh |
| Credential Dumping | ดึง Password/Hash จาก Memory (LSASS) หรือ Registry (SAM) | Mimikatz, secretsdump.py |
Phase 3: Lateral Movement
เป้าหมาย: เคลื่อนที่ข้าม Network ไปยัง Machine ที่มี Credential ที่ต้องการ
| เทคนิค | คำอธิบาย | เครื่องมือ |
|---|---|---|
| Pass-the-Hash (PtH) | ใช้ NTLM Hash (ไม่ต้องรู้ Password) Authenticate ไปยัง Machine อื่น [3] | nxc smb -H <hash>, psexec.py |
| NTLM Relay | Relay NTLM Authentication ไปยัง Target ที่ไม่บังคับ SMB Signing | ntlmrelayx.py, Responder |
| WMI Execution | Execute Command บน Remote Machine ผ่าน WMI | wmiexec.py |
| PSRemoting/WinRM | Remote Execution ผ่าน PowerShell Remoting | evil-winrm |
| RDP Hijacking | Hijack Active RDP Session โดยไม่ต้อง Password | tscon.exe |
Phase 4: Domain Admin & Persistence
เป้าหมาย: ได้ Domain Admin และ ฝัง Persistence เพื่อเข้าถึงได้ในอนาคต
| เทคนิค | คำอธิบาย | เครื่องมือ |
|---|---|---|
| DCSync | จำลองเป็น Domain Controller เพื่อ Replicate Password Hash ของทุก User (รวม krbtgt) [4] | secretsdump.py, Mimikatz |
| Golden Ticket | สร้าง TGT ปลอมจาก krbtgt Hash → เข้าถึง Domain ได้ไม่จำกัดเวลา | Mimikatz, Rubeus |
| Silver Ticket | สร้าง TGS ปลอมสำหรับ Service เฉพาะ (เช่น CIFS, HTTP) | Mimikatz, Rubeus |
| AdminSDHolder Abuse | เพิ่ม User เข้า Protected Group → SDProp จะ Restore สิทธิ์ทุก 60 นาที | PowerView |
| Skeleton Key | ติดตั้ง Backdoor บน DC → ใช้ Master Password Login ได้ทุก Account | Mimikatz |
เครื่องมือสำคัญสำหรับ AD Pentest
| เครื่องมือ | ภาษา | ใช้ทำอะไร |
|---|---|---|
| BloodHound CE | Go/JS | Graph AD Relationship → หา Attack Path to Domain Admin [5] |
| Impacket | Python | ชุดเครื่องมือ SMB, Kerberos, NTLM, WMI — ใช้ได้ตั้งแต่ Enum ถึง DCSync |
| NetExec (CrackMapExec) | Python | Swiss Army Knife สำหรับ AD — Spray, Enum, Execute, Dump |
| Mimikatz | C | Credential Extraction จาก Windows Memory (LSASS) |
| Rubeus | C# | Kerberos Attack Toolkit — Kerberoast, AS-REP, Ticket Manipulation |
| Responder | Python | LLMNR/NBT-NS/mDNS Poisoning เพื่อ Capture NTLM Hash |
| Certipy | Python | Active Directory Certificate Services (ADCS) Attack — ESC1 ถึง ESC8 |
วิธีป้องกัน — 10 มาตรการสำคัญ
1. Tiered Administration Model
แบ่ง Admin Account เป็น 3 Tier — Admin Account แต่ละ Tier ห้ามข้าม Tier [6]:
| Tier | ครอบคลุม | ตัวอย่าง |
|---|---|---|
| Tier 0 | Domain Controller, AD Infrastructure | Domain Admins, Enterprise Admins |
| Tier 1 | Server, Application | Server Admins, SQL Admins |
| Tier 2 | Workstation, End-User Device | Helpdesk, Desktop Admins |
หลักการ: Admin ของ Tier 0 ห้าม Login บน Tier 1/2 Machine — ป้องกัน Credential Exposure
2. Privileged Access Workstation (PAW)
- ใช้ เครื่องเฉพาะ (Dedicated Workstation) สำหรับ Admin Task เท่านั้น
- ไม่มี Internet Access, Email บน PAW
- Hardened ตาม Security Baseline (CIS Benchmark, Microsoft SCT)
- ใช้คู่กับ Just-In-Time Access — ให้สิทธิ์ Admin เฉพาะเมื่อต้องใช้
3. LAPS (Local Administrator Password Solution)
- LAPS สร้าง Password ไม่ซ้ำกัน สำหรับ Local Admin Account ของทุก Machine
- ป้องกัน Pass-the-Hash — เพราะ Local Admin Hash ของแต่ละ Machine ต่างกัน
- Windows LAPS (Built-in ตั้งแต่ Windows Server 2019+) รองรับ Encryption และ Password History
4. Group Managed Service Accounts (gMSA)
- ใช้ gMSA แทน Service Account ที่ตั้ง Password เอง
- Password ถูก จัดการอัตโนมัติ โดย AD (120 Characters, Rotate ทุก 30 วัน)
- ป้องกัน Kerberoasting — เพราะ Password ซับซ้อนเกินกว่าจะ Crack ได้
5. Disable NTLM (เมื่อเป็นไปได้)
- Audit NTLM Usage ก่อน — ดูว่าระบบไหนยังพึ่ง NTLM
- Block NTLMv1 ทันที — ไม่มีเหตุผลที่ควรเปิด
- Restrict NTLMv2 — อนุญาตเฉพาะ System ที่จำเป็น
- เปิด SMB Signing บนทุก Machine — ป้องกัน NTLM Relay
6. Disable LLMNR/NBT-NS/mDNS
- LLMNR และ NBT-NS เป็น Broadcast Protocol ที่ Attacker ใช้ Poisoning
- Disable ผ่าน Group Policy: Computer Configuration → Administrative Templates → Network → DNS Client
- ใช้ DNS อย่างเดียวสำหรับ Name Resolution
7. Monitor Kerberos Activity
ตรวจจับ Attack ผ่าน Windows Event Log:
| Event ID | ความหมาย | Attack ที่ตรวจจับ |
|---|---|---|
| 4769 | Kerberos Service Ticket Request | Kerberoasting (RC4 Encryption Type 0x17) |
| 4768 | Kerberos TGT Request | AS-REP Roasting |
| 4771 | Kerberos Pre-Authentication Failed | Password Spray |
| 4662 | Directory Service Access | DCSync (DS-Replication-Get-Changes) |
| 4624 Type 3 | Network Logon | Pass-the-Hash Lateral Movement |
8. Protect Kerberos
- กำหนด Password ที่แข็งแรง สำหรับ
krbtgtAccount (เปลี่ยนทุก 6–12 เดือน) - เปิด Kerberos Armoring (FAST) เพื่อป้องกัน Pre-Authentication Bypass
- ใช้ AES Encryption สำหรับ Kerberos — ปิด RC4 เมื่อเป็นไปได้
- จำกัด Delegation — ปิด Unconstrained Delegation
9. Active Directory Certificate Services (ADCS) Hardening
ADCS Misconfiguration เป็น Attack Vector ที่ได้รับความนิยมเพิ่มขึ้น (ESC1–ESC8):
- Audit Certificate Template — ตรวจสอบว่า Template ไหนอนุญาตให้ Request Certificate ที่ Impersonate User อื่น
- จำกัด Enrollment Permission — เฉพาะ Group ที่จำเป็น
- เปิด CA Audit Logging — ตรวจสอบ Certificate Request ที่ผิดปกติ
10. Regular AD Pentest
- ทำ AD Penetration Testing อย่างน้อยปีละครั้ง
- ทดสอบทั้ง Authenticated และ Unauthenticated Scenario
- ใช้ BloodHound ตรวจสอบ Attack Path เป็นประจำ (ไม่ต้องรอ Pentest)
- แก้ไข Critical Finding ภายใน 30 วัน
AD Pentest vs Vulnerability Assessment — ต่างกันอย่างไร
| มิติ | Vulnerability Assessment | AD Penetration Testing |
|---|---|---|
| ขอบเขต | สแกนหา Known Vulnerability | ทดสอบ Attack Chain ทั้งหมด |
| Depth | ตื้น — สแกน + Report | ลึก — Exploit + Lateral Movement + Domain Admin |
| เทคนิค | Automated Scanner | Manual + Automated (BloodHound, Impacket, Mimikatz) |
| ผลลัพธ์ | รายการ CVE + Severity | Attack Path + Business Impact + Proof of Concept |
| เวลา | 1–3 วัน | 5–15 วัน |
| คุณค่า | รู้ว่ามีช่องโหว่อะไร | รู้ว่า Attacker เข้าถึง Domain Admin ได้อย่างไร |
สรุป
Active Directory เป็นเป้าหมายหลักเพราะเป็น กุญแจที่เปิดทุกประตู ในองค์กร การโจมตี AD ทำตาม Chain ที่ชัดเจน: Enumerate → Credential Access → Lateral Movement → Domain Admin — และทุกขั้นตอนมี เทคนิคและเครื่องมือ ที่ Attacker ใช้จริง
การป้องกันต้อง ผสมผสานหลายมาตรการ: Tiered Admin, LAPS, gMSA, Disable NTLM, Monitor Kerberos — ไม่ใช่แค่ Antivirus หรือ Firewall
ติดต่อ ITSL เพื่อทำ Active Directory Penetration Testing — ทดสอบว่า Attacker สามารถไปถึง Domain Admin ได้หรือไม่ และองค์กรมีการป้องกันที่เพียงพอหรือไม่
อ่านเพิ่มเติม:
แหล่งอ้างอิง:
[1] RedFox Security, “Active Directory Attack Playbook for Red Teamers 2026,” 2026. https://www.redfoxsec.com/blog/active-directory-attack-playbook-for-red-teamers
[2] Pentest Mindmap, “Active Directory Cheatsheet 2026,” 2026. https://pentestmindmap.com/active-directory-cheatsheet
[3] Cayosoft, “Active Directory Security Guide,” 2025. https://www.cayosoft.com/active-directory-management-tools/active-directory-security
[4] Hive Security, “BloodHound CE: Map Active Directory Attack Paths to Domain Admin,” 2026. https://hivesecurity.gitlab.io/blog/bloodhound-practical-guide-ad-attack-paths
[5] BloodHound CE, “BloodHound Community Edition,” SpecterOps. https://github.com/SpecterOps/BloodHound
[6] AdminDroid, “How to Implement Tiered Model in Active Directory,” 2025. https://blog.admindroid.com/active-directory-tiering-model
[7] Specops Software, “Active Directory Security Best Practices for 2025,” 2025. https://specopssoft.com/blog/active-directory-security-best-practices