Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> ระบบเครือข่าย >> ความปลอดภัยเครือข่าย

เปิดใช้งาน Network Security: LAN Manager Authentication Level = NTLMv2 บน Windows

LAN Manager Authentication Level คืออะไร?

การตั้งค่าใน Windows (Local Security Policy / Group Policy) ที่กำหนด Authentication Protocol ที่ Client และ Server จะใช้สื่อสารกันใน Workgroup/Domain Environment — ส่งผลต่อความปลอดภัยของ Credential (Password Hash) ที่ส่งผ่านเครือข่าย

ระดับ Authentication Protocols (จากเก่า → ใหม่ / อ่อน → แข็ง)

Level / SettingProtocols Allowedความปลอดภัยสถานะ
Send LM & NTLM responsesLM, NTLM, NTLMv2ต่ำมาก (LM = No Salt, Uppercase, 14-char split → 易破解)ห้ามใช้
Send LM & NTLM - use NTLMv2 session security if negotiatedLM, NTLM, NTLMv2 (with Session Security)ต่ำ (LM ยังส่งได้)ห้ามใช้
Send NTLM response onlyNTLM, NTLMv2ปานกลาง (NTLMv1 = Vulnerable to Relay, Replay)Legacy Only
Send NTLMv2 response onlyNTLMv2 onlyดี (NTLMv2 = HMAC-MD5, Client/Server Challenge, Timestamp)Minimum Baseline
Send NTLMv2 response only / Refuse LM & NTLMNTLMv2 only, Reject LM & NTLMv1ดีที่สุดในกลุ่ม NTLMแนะนำ (Baseline)
Undefined / Not DefinedDefault: Send NTLMv2 response only / Refuse LM & NTLM (Win 7/2008R2+)-Default

วิธีตั้งค่า LAN Manager Authentication Level = NTLMv2

วิธีที่ 1: Local Security Policy (secpol.msc) — Standalone / Workgroup

  1. Win+R → พิมพ์ secpol.msc → Enter
  2. ไป: Security Settings → Local Policies → Security Options
  3. หา: Network security: LAN Manager authentication level
  4. Double-click → เลือก: Send NTLMv2 response only / Refuse LM & NTLM
  5. OK → Reboot หรือ gpupdate /force

วิธีที่ 2: Group Policy (GPO) — Domain Environment (แนะนำ)

  1. เปิด Group Policy Management (gpmc.msc)
  2. สร้าง/แก้ไข GPO → Link ไป OU ที่ต้องการ (Domain, Domain Controllers OU, Server OU, Workstation OU)
  3. Edit GPO → Computer Configuration → Policies → Windows Settings → Security Settings → Local Policies → Security Options
  4. หา: Network security: LAN Manager authentication level
  5. Define this policy setting → Send NTLMv2 response only / Refuse LM & NTLM
  6. 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)

  1. GPO: Network security: Restrict NTLM: NTLM authentication in this domain → Deny All (หรือ Deny All Domain Accounts)
  2. GPO: Network security: Restrict NTLM: Add server exceptions in this domain → เพิ่ม Server ที่ยังต้องการ NTLM (Legacy Apps)
  3. 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
  4. วิเคราะห์ Log 1-4 สัปดาห์ → ระบุ App/Server ที่ยังใช้ NTLM → Remediate (Upgrade, Kerberos, Certificate, Modern Auth)
  5. 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