NTLM (NT LAN Manager) เป็น Authentication Protocol พื้นฐานของ Microsoft มานานนับสิบปี (ตั้งแต่ Windows NT) 雖然 Microsoft เปิดตัว KerberOS ที่ปลอดภัยกว่าใน Windows 2000 NTLM (โดยทั่วไปคือ NTLMv2) ยังใช้กันอย่างแพร่หลายใน Windows Domain Networks บทความนี้อธิบายการปิด NTLMv1 และ NTLMv2 เพื่อบังคับใช้ Kerberos ใน Active Directory Domain
ปัญหาของ NTLMv1
- Weak Encryption
- เก็บ Password Hash ใน Memory ของ LSA Service → ดึงได้ด้วย Tools อย่าง Mimikatz → ใช้ต่อยอดโจมตี
- ไม่มี Mutual Authentication ระหว่าง Server และ Client → MITM Attacks, Unauthorized Access (Tools อย่าง Responder จับ NTLM Traffic ใช้เข้าถึง Resource)
- Vulnerabilities อื่นๆ
บางส่วนแก้ใน NTLMv2 (Encryption แข็งแกร่งกว่า ป้องกัน NTLM Attacks ยอดนิยม) NTLMv1 และ LM Disabled โดย Default ตั้งแต่ Windows 7 / Server 2008 R2
ตั้งค่า GPO บังคับ NTLMv2
ก่อนปิด NTLM ทั้งหมด ต้องแน่ใจว่าไม่ได้ใช้ NTLMv1 Legacy Devices/Services อาจยังใช้ NTLMv1 (Small Open Source Products, Old Network Scanners, NAS, Old Hardware/Software/OS)
Domain Admin ต้อง Ensure ว่า NTLM และ LM ถูก запрет ใช้ Authentication ใน Domain (Attacker อาจขอ NTLM/LM Response ได้)
ตั้งค่า Authentication Type ผ่าน Domain/Local Policy: gpmc.msc → Edit Default Domain Policy → Computer Configurations → Policies → Windows Settings → Security Settings → Local Policies → Security Options → Network Security: LAN Manager authentication level
6 Options (เรียงตามความปลอดภัย):
- Send LM & NTLM responses
- Send LM & NTLM responses – use NTLMv2 session security if negotiated
- Send NTLM response only
- Send NTLMv2 response only
- Send NTLMv2 response only. Refuse LM
- Send NTLMv2 response only. Refuse LM & NTLM
Default Windows 7+ ใช้ Option 4 (Send NTLMv2 response only) Client ใช้ NTLMv2 แต่ DC ยอมรับ LM/NTLM/NTLMv2
เปลี่ยนเป็น Option 6: Send NTLMv2 response only. Refuse LM & NTLM → DC จะปฏิเสธ LM และ NTLMv1 Requests ทั้งหมด
Registry Way: สร้าง DWORD LmCompatibilityLevel = 0-5 ใน HKLM\SYSTEM\CurrentControlSet\Control\Lsa (Value 5 = Option 6)
Enable Policy Network security: Do not store LAN Manager hash value on next password change (Default Enabled ตั้งแต่ Vista/2008 ป้องกัน LM Hash)
Apply Policy ให้ Domain Controllers
เปิดใช้งาน NTLM Authentication Audit Logging
ก่อนปิด NTLM สนิท ต้องแน่ใจว่าไม่มี Apps ที่ยังต้องการ NTLM
Enable Audit ผ่าน GPO: Computer Configuration → Windows Settings → Security Settings → Local Policies → Security Options
- Network Security: Restrict NTLM: Audit NTLM authentication in this domain = Enable all
- Network Security: Restrict NTLM: Audit Incoming NTLM Traffic = Enable auditing for domain accounts
Events จะปรากฏใน Application and Services Logs → Microsoft → Windows → NTLM ใน Event Viewer
ค้นหา Events Source Microsoft-Windows-Security-Auditing Event ID 4624 (An Account was successfully logged on) ดู Section Detailed Authentication Information → Authentication Package = NTLM → ใช้ NTLM
ดู Package Name (NTLM only) = LM, NTLMv1, NTLMv2 → ระบุ Protocol ที่ใช้
PowerShell Script ค้นหา NTLMv1 Events บน DCs ทั้งหมด (ดูในบทความ)
หลังเจอ Apps/Devices ที่ใช้ NTLM → พยายาม Switch ไป KerberOS (อาจต้อง Config SPN) บาง Apps ต้อง Config เล็กน้อย (ดูบทความ KerberOS Authentication in IIS, Browser KerberOS Config) ประสบการณ์: Commercial Products ใหญ่ๆ ยังใช้ NTLM อยู่ ต้อง Update/Config
Tip ใช้ DNS Name แทน IP Address สำหรับ KerberOS (IP Address → NTLM)
Apps ที่ไม่สามารถใช้ KerberOS → Add Exceptions: Policy Network security: Restrict NTLM: Add server exceptions for NTLM authentication in this domain ใส่ Server Names ที่อนุญาต NTLM (Wildcard * ใช้ได้) ควรว่างเปล่า
ปิด NTLM สนิทใน Active Directory Domain
ทดสอบ Authentication โดยไม่มี NTLM: Add User Accounts เข้า Group Protected Users (มีตั้งแต่ Server 2012 R2) Member ของ Group นี้ Authenticate ได้แค่ KerberOS (NTLM, Digest, CredSSP ห้าม) → Verify KerberOS ทำงานใน Apps ต่างๆ
จากนั้นปิด NTLM ทั้ง Domain: Policy Network Security: Restrict NTLM: NTLM authentication in this domain
5 Options:
- Disable: Policy ปิด (NTLM Allowed)
- Deny for domain accounts to domain servers: DC ปฏิเสธ NTLM สำหรับ Domain Accounts บน Servers → Error "NTLM is blocked"
- Deny for domain accounts: DC ปฏิเสธ NTLM สำหรับ Domain Accounts ทั้งหมด
- Deny for domain servers: ห้าม NTLM Requests สำหรับ Servers ทั้งหมด ยกเว้นใน Exception List
- Deny all: DC บล็อก NTLM Requests ทั้งหมด สำหรับ Servers และ Accounts ทุกตัว
แนะนำอ่านเพิ่ม: Mitigations against Mimikatz Style Attacks, Securing Privileged Administrator Accounts, How to Disable LLMNR and NetBIOS over TCP/IP