LAN Manager Authentication Level คืออะไร?
การตั้งค่าใน Windows (Local Security Policy / Group Policy) ที่กำหนด Authentication Protocol ที่ Client และ Server จะใช้สื่อสารกันใน Workgroup/Domain Environment — ส่งผลต่อความปลอดภัยของ Credential (Password Hash) ที่ส่งผ่านเครือข่าย
ระดับ Authentication Protocols (จากเก่า → ใหม่ / อ่อน → แข็ง)
| Level / Setting | Protocols Allowed | ความปลอดภัย | สถานะ |
|---|---|---|---|
| Send LM & NTLM responses | LM, NTLM, NTLMv2 | ต่ำมาก (LM = No Salt, Uppercase, 14-char split → 易破解) | ห้ามใช้ |
| Send LM & NTLM - use NTLMv2 session security if negotiated | LM, NTLM, NTLMv2 (with Session Security) | ต่ำ (LM ยังส่งได้) | ห้ามใช้ |
| Send NTLM response only | NTLM, NTLMv2 | ปานกลาง (NTLMv1 = Vulnerable to Relay, Replay) | Legacy Only |
| Send NTLMv2 response only | NTLMv2 only | ดี (NTLMv2 = HMAC-MD5, Client/Server Challenge, Timestamp) | Minimum Baseline |
| Send NTLMv2 response only / Refuse LM & NTLM | NTLMv2 only, Reject LM & NTLMv1 | ดีที่สุดในกลุ่ม NTLM | แนะนำ (Baseline) |
| Undefined / Not Defined | Default: Send NTLMv2 response only / Refuse LM & NTLM (Win 7/2008R2+) | - | Default |
วิธีตั้งค่า LAN Manager Authentication Level = NTLMv2
วิธีที่ 1: Local Security Policy (secpol.msc) — Standalone / Workgroup
- Win+R → พิมพ์
secpol.msc→ Enter - ไป: Security Settings → Local Policies → Security Options
- หา: Network security: LAN Manager authentication level
- Double-click → เลือก: Send NTLMv2 response only / Refuse LM & NTLM
- OK → Reboot หรือ
gpupdate /force
วิธีที่ 2: Group Policy (GPO) — Domain Environment (แนะนำ)
- เปิด Group Policy Management (gpmc.msc)
- สร้าง/แก้ไข GPO → Link ไป OU ที่ต้องการ (Domain, Domain Controllers OU, Server OU, Workstation OU)
- Edit GPO → Computer Configuration → Policies → Windows Settings → Security Settings → Local Policies → Security Options
- หา: Network security: LAN Manager authentication level
- Define this policy setting → Send NTLMv2 response only / Refuse LM & NTLM
- OK → Link GPO →
gpupdate /forceบน Client/Server หรือรอ Refresh (90-120 นาที)
วิธีที่ 3: Registry (สคริปต์/Automation)
Path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
Value: LmCompatibilityLevel (REG_DWORD)
Data:
0 = Send LM & NTLM responses
1 = Send LM & NTLM - use NTLMv2 session security if negotiated
2 = Send NTLM response only
3 = Send NTLMv2 response only
4 = Send NTLMv2 response only / Refuse LM & NTLM ← **แนะนำ (Value = 5 ในบาง Doc แต่ Microsoft ใช้ 4)**
5 = Send NTLMv2 response only / Refuse LM, NTLM, and NTLMv2 (Kerberos Only) — Extreme
PowerShell (Run as Admin):
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa" -Name "LmCompatibilityLevel" -Value 4 -Type DWord -Force
# ต้อง Reboot
NTLMv2: ทำไมถึงปลอดภัยกว่า?
- Client & Server Challenge: ป้องกัน Replay Attack
- HMAC-MD5 (vs LM: DES, NTLMv1: MD4/DES): Cryptographically Stronger
- Timestamp & Target Info: ป้องกัน Relay Attack (บางส่วน)
- Case-sensitive Password: รองรับ Unicode, ยาว 128 chars
⚠️ หมายเหตุ: NTLMv2 ยังมีช่องโหว่ NTLM Relay / Pass-the-Hash — แก้ได้ด้วย EPA (Extended Protection for Authentication), SMB Signing, LDAP Signing/Channel Binding, และที่ดีที่สุดคือ Disable NTLM ทั้งหมด ใช้ Kerberos แทน
Disable NTLM ทั้งหมด (Advanced Hardening)
- GPO: Network security: Restrict NTLM: NTLM authentication in this domain → Deny All (หรือ Deny All Domain Accounts)
- GPO: Network security: Restrict NTLM: Add server exceptions in this domain → เพิ่ม Server ที่ยังต้องการ NTLM (Legacy Apps)
- Audit First: Network security: Restrict NTLM: Audit NTLM authentication in this domain → Enable All → ดู Event 4624 (Logon Type 3, NTLM) ใน Security Log / Forward to SIEM
- วิเคราะห์ Log 1-4 สัปดาห์ → ระบุ App/Server ที่ยังใช้ NTLM → Remediate (Upgrade, Kerberos, Certificate, Modern Auth)
- Enforce Deny All → Monitor Exceptions
Kerberos: มาตรฐานที่ควรใช้แทน NTLM
- Mutual Authentication (Client ↔ Server)
- Tickets (TGT, Service Tickets) — ไม่ส่ง Password Hash ผ่าน Network
- Delegation (Constrained / Resource-based) — ควบคุมได้ละเอียด
- Integration: Azure AD / Entra ID (Kerberos Cloud Trust), Linux (SSSD, realmd, FreeIPA), Mac (Directory Utility)
ทดสอบและตรวจสอบ (Verification)
- Event Viewer → Security Log → Event 4624: ดู Authentication Package = NTLM / Kerberos / Negotiate
- Network Capture (Wireshark): Filter
ntlmsspหรือkerberosดู Handshake - PowerShell:
klist(Kerberos Tickets),nltest /sc_query:domain(Secure Channel) - Microsoft NTLM Blocking Tool / NTLM Auditing Scripts
สรุป Checklist
- [ ] Set LAN Manager Authentication Level = Send NTLMv2 response only / Refuse LM & NTLM (Level 4) ทุกเครื่อง (GPO)
- [ ] Enable NTLM Auditing → Analyze 2-4 Weeks
- [ ] Migrate Legacy Apps to Kerberos / Modern Auth (OIDC/SAML/Certificate)
- [ ] Enforce Restrict NTLM: Deny All (with Exceptions for Legacy Only)
- [ ] Enable SMB Signing (Required), LDAP Signing/Channel Binding, EPA
- [ ] Disable SMBv1 (Default Off Win 10/Server 2016+)
- [ ] Document Exceptions + Review Quarterly