LAN Manager Authentication Level là gì?
Cài đặt bảo mật Windows (`Network security: LAN Manager authentication level`) quy định giao thức xác thực (authentication protocol) mà máy tính Windows sử dụng khi xác thực mạng (SMB, RPC, WinRM, domain join, file share, printer share). Có 5 mức độ (từ yếu đến mạnh):
| Mức (Level) | Mô tả | Giao thức cho phép | Đánh giá |
|---|---|---|---|
| 0 - Send LM & NTLM responses | Gửi cả LM và NTLM | LM, NTLMv1, NTLMv2 | RẤT YẾU – LM hash dễ crack (DES 56-bit, không salt, split 7+7). |
| 1 - Send LM, NTLM, NTLMv2 | Gửi LM, NTLM, NTLMv2 | LM, NTLMv1, NTLMv2 | YẾU – Vẫn gửi LM hash. |
| 2 - Send NTLM only | Chỉ gửi NTLM (v1/v2) | NTLMv1, NTLMv2 | Trung bình – NTLMv1 vẫn dễ relay/brute-force. |
| 3 - Send NTLMv2 only | Chỉ gửi NTLMv2 | NTLMv2 only | KHUYẾN NGHỊ TỐI THIỂU – NTLMv2 có HMAC-MD5, client challenge, timestamp. |
| 4 - Send NTLMv2 only, refuse LM/NTLM | Chỉ NTLMv2, từ chối LM/NTLMv1 | NTLMv2 only + Server refuse LM/NTLMv1 | MẠNH NHẤT (Default Win 7/2008R2+) – Chặn hoàn toàn LM/NTLMv1. |
| 5 - Send NTLMv2 only, refuse LM/NTLM, require 128-bit encryption | Mức 4 + yêu cầu session signing/sealing 128-bit | NTLMv2 + Signing/Sealing | Mạnh nhất, nhưng có thể break legacy app (old NAS, printer, Linux Samba cũ). |
Tại sao nên đặt Level 4 hoặc 5 (NTLMv2 only)?
- Chặn LM hash (cực yếu, rainbow table crack tức thì).
- Chặn NTLMv1 (dễ bị NTLM Relay, Pass-the-Hash, brute-force).
- NTLMv2 thêm: Client challenge (ngẫu nhiên), Timestamp, HMAC-MD5, Target Info (domain, server name, DNS) – chống replay attack tốt hơn.
- Mặc định từ Windows 7 / Server 2008 R2 là Level 3 (Send NTLMv2 only). Level 4/5 an toàn hơn.
Cách cấu hình qua Local Security Policy (secpol.msc)
- Win + R → gõ
secpol.msc→ Enter. - Đường dẫn: Local Policies → Security Options → Network security: LAN Manager authentication level.
- Chuột phải → Properties → chọn Send NTLMv2 response only. Refuse LM & NTLM (Level 4) hoặc Send NTLMv2 response only. Refuse LM, NTLM & require 128-bit encryption (Level 5).
- OK → Khởi động lại máy (hoặc `gpupdate /force`).
Cách cấu hình qua Group Policy (GPO) – Doanh nghiệp
- Mở Group Policy Management (gpmc.msc).
- Tạo/GPO edit: Computer Configuration → Policies → Windows Settings → Security Settings → Local Policies → Security Options.
- Tìm: Network security: LAN Manager authentication level.
- Enable → chọn Level 4 hoặc 5 → OK.
- Link GPO đến OU chứa máy tính/server cần áp dụng.
- Client: `gpupdate /force` hoặc reboot.
Cách reset về mặc định (nếu gây lỗi ứng dụng cũ)
- Tải file registry fix (hoặc tự tạo):
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]
"LmCompatibilityLevel"=dword:00000003
(Level 3 = Send NTLMv2 only – mặc định Win 7+).
- Double-click file `.reg` → Yes → Reboot.
NTLMv2 dùng cho gì?
- Xác thực domain join, login mạng (SMB/CIFS file share, printer share).
- Xác thực cross-forest trust (Active Directory).
- Windows Integrated Authentication (IIS, SQL Server, WinRM, PowerShell Remoting).
- Không dùng cho: Web app modern (nên dùng Kerberos, OAuth/OIDC, SAML, Certificate).
Vấn đề tương thích (Compatibility Issues)
| Hệ thống/App cũ | Vấn đề | Giải pháp |
|---|---|---|
| NAS cũ (Synology/QNAP firmware cũ), Samba < 3.6 | Chỉ hỗ trợ NTLMv1/LM | Cập nhật firmware/Samba. Nếu không thể: tách VLAN, isolate, compensating control. |
| Java app cũ (JCIFS/SMBJ) | Không hỗ trợ NTLMv2 tốt | Upgrade thư viện, config `jcifs.smb.client.useExtendedSecurity=true`. |
| Linux mount.cifs (kernel cũ) | Mount fail với sec=ntlmv2 | Kernel ≥ 3.0 hỗ trợ tốt. Thêm option `vers=2.1,sec=ntlmv2`. |
| Printer/MFP cũ (scan to SMB) | Chỉ support NTLMv1 | Firmware update. Hoặc dùng FTP/SFTP/Email thay SMB. |
Khuyến nghị hiện đại: Vượt qua NTLM hoàn toàn
- Kerberos (AES256-CTS-HMAC-SHA1-96): Default cho domain environment – mutual auth, delegation, PAC, không dễ relay.
- Kerberos Armoring (FAST) / AES encryption: Bảo vệ ticket khỏi offline cracking.
- Windows Hello for Business / FIDO2 / Certificate Auth: Passwordless – loại bỏ NTLM hoàn toàn.
- Restricted Admin Mode / Remote Credential Guard (RDP): Không truyền credential ra network.
- GPO: Network security: Restrict NTLM → `NTLM authentication in this domain: Deny All` (hoặc Deny All Domain Accounts) –Audit mode trước để kiểm tra tác động.
Kiểm tra NTLMv1/v2 đang dùng trong môi trường
- Bật Audit: GPO → Advanced Audit Policy → Logon/Logoff → Audit NTLM (Success/Failure).
- Event Viewer → Security → Event ID 4624 (Logon) → Field Authentication Package: `NTLM V1` / `NTLM V2` / `Kerberos`.
- Hoặc: `Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4624} | Select-Object @{N='User';E={$_.Properties[5].Value}}, @{N='AuthPkg';E={$_.Properties[9].Value}}`.
Kết luận
Đặt LAN Manager Authentication Level = Level 4 (Send NTLMv2 only, refuse LM/NTLM) là baseline bảo mật tối thiểu cho mọi môi trường Windows hiện đại. Level 5 thêm yêu cầu signing/sealing 128-bit. Mục tiêu chiến lược: Loại bỏ NTLM hoàn toàn bằng Kerberos, Certificate, FIDO2, Passwordless. Triển khai qua GPO, audit bằng Event 4624, quản trị exception cho legacy system trong VLAN cô lập.