Trên Windows Server 2016/2019 và Windows 10 (từ build 1709), giao thức mạng Server Message Block 1.0 (SMBv1) dùng truy cập shared folder bị tắt mặc định. Trong hầu hết trường hợp, giao thức này cần để truy cập shared folder trên hệ thống cũ, như Windows XP, Windows Server 2003 không còn hỗ trợ và OS cũ hơn. Bài viết hướng dẫn bật/tắt hỗ trợ SMBv1 client và server trên Windows 10 và Windows Server 2016/2019.
Nếu không còn client SMB 1.x trong mạng, phải tắt hoàn toàn SMBv1 trên mọi thiết bị Windows. Tắt SMB 1.0 bảo vệ máy tính Windows khỏi nhiều lỗ hổng trong giao thức legacy này (exploit nổi tiếng nhất cho SMBv1 là EternalBlue). Kết quả, thiết bị sẽ dùng phiên bản SMB mới hơn, hiệu quả, bảo mật và chức năng hơn khi truy cập network share.
Bài trước đãshow bảng tương thích phiên bản SMB client/server. Theo bảng, client cũ (XP, Server 2003 và một số *nix client) chỉ truy cập network share qua SMB v1.0. Nếu không có client như vậy trong mạng, có thể tắt hoàn toàn SMB 1.0 phía file server (kể cả AD domain controller) và desktop client.
Trên Windows 10 và Windows Server 2016, giao thức SMBv1 tách thành 2 component riêng biệt — SMB client và SMB server, có thể bật/tắt độc lập.
Nội dung chính
- Audit truy cập shared folder qua SMB v1.0
- Bật/tắt SMB 1.0 trên Windows Server 2016/2019
- Cách bật/tắt SMBv1 trên Windows 10
- Tắt SMBv1 Client và Server qua Group Policy
Audit truy cập shared folder qua SMB v1.0
Trước khi tắt hoặc xóa hoàn toàn driver SMB 1.0 phía SMB file server, nên chắc chắn không có legacy client dùng nó trong mạng. Bật audit truy cập file server qua SMB v1.0 bằng lệnh PowerShell:
Set-SmbServerConfiguration –AuditSmb1Access $true
Sau vài ngày, mở Event Viewer trên server, kiểm tra log Applications and Services → Microsoft → Windows → SMBServer → Audit xem có client nào truy cập file server qua SMB1 không.
Mẹo. Hiển thị danh sách event từ event log này bằng PowerShell: Get-WinEvent -LogName Microsoft-Windows-SMBServer/Audit
Ví dụ tìm thấy event EventID 3000 từ source SMBServer. Event chỉ client 192.168.1.10 đang thử truy cập server dùng SMB1 protocol.
SMB1 access Client Address: 192.168.1.10 Guidance: This event indicates that a client attempted to access the server using SMB1. To stop auditing SMB1 access, use the Windows PowerShell cmdlet Set-SmbServerConfiguration.
Cần tìm máy tính/thiết bị này trong mạng và cập nhật OS hoặc firmware lên phiên bản hỗ trợ SMB protocol mới hơn: SMBv2 hoặc SMBv3. Ví dụ bỏ qua thông tin này, nhưng nhớ sau client này không truy cập được shared folder trên SMB server này.
Bật/tắt SMB 1.0 trên Windows Server 2016/2019
Trên Windows Server 2016 từ build 1709 và Windows Server 2019, SMBv1 tắt mặc định. Để bật hỗ trợ giao thức SMBv1 client trên Windows Server mới, cài tính năng riêng SMB 1.0/CIFS File Sharing Support.
Cài tính năng SMBv1 qua Server Manager hoặc PowerShell.
Kiểm tra SMBv1 đã bật bằng PowerShell: Get-WindowsFeature | Where-Object {$_.name -eq "FS-SMB1"} | ft Name,Installstate
Cài tính năng FS-SMB1: Install-WindowsFeature FS-SMB1
Gỡ cài đặt SMBv1 client feature (cần reboot): Uninstall-WindowsFeature –Name FS-SMB1 –Remove
Lệnh PowerShell khác cũng xóa feature SMB1Protocol: Disable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol -Remove
Để server xử lý truy cập SMBv1.0 client, cần bật hỗ trợ SMBv1 ở cấp SMB file server ngoài component FS-SMB1. Kiểm tra SMBv1 access có bật cho network share trên server: Get-SmbServerConfiguration
Dòng "EnableSMB1Protocol: True" nghĩa là cho phép truy cập shared folder trên server này dùng SMBv1. Tắt hỗ trợ SMBv1 server trên Windows Server: Set-SmbServerConfiguration -EnableSMB1Protocol $false -Force
Kiểm tra lại bằng Get-SmbServerConfiguration đảm bảo SMB1 server đã tắt. Bật hỗ trợ SMBv1 trên server: Set-SmbServerConfiguration -EnableSMB1Protocol $True -Force
Trên Windows 7/8 và Windows Server 2008 R2/2012, tắt SMB 1.0 client bằng lệnh: sc.exe config lanmanworkstation depend= bowser/mrxsmb20/nsi
sc.exe config mrxsmb10 start= disabled
Cách bật/tắt SMBv1 trên Windows 10
Như đã nói, trên build Windows 10 mới (từ 1709) hỗ trợ SMB1 protocol bị tắt (guest access qua SMBv2 cũng tắt).
Trên Windows 10, kiểm tra trạng thái component SMBv1 bằng DISM: Dism /online /Get-Features /format:table | find "SMB1Protocol"
Ví dụ thấy tất cả feature SMBv1 đều Disabled:
SMB1Protocol | Disabled SMB1Protocol-Client | Disabled SMB1Protocol-Server | Disabled SMB1Protocol-Deprecation | Disabled
Trên Windows 10, cũng quản lý SMB 1 feature từ Control Panel (optionalfeatures.exe). Mở rộng SMB 1.0 /CIFS File Sharing Support. 3 component SMBv1 có sẵn:
- SMB 1.0/CIFS Automatic Removal
- SMB 1.0/CIFS Client
- SMB 1.0/CIFS Server
Bật SMBv1 client và server trên Windows 10 từ cửa sổ quản lý feature hoặc lệnh: Dism /online /Enable-Feature /FeatureName:"SMB1Protocol"
Dism /online /Enable-Feature /FeatureName:"SMB1Protocol-Client"
Dism /online /Enable-Feature /FeatureName:"SMB1Protocol-Server"
Cũng bật SMBv1 server và client Windows 10 qua PowerShell: Enable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol-Server
Enable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol-Client
Nếu sau khi bật SMBv1 client, không dùng quá 15 ngày, nó tự động tắt. Tự động xóa SMBv1 client là one-time operation. Nếu admin bật thủ công SMBv1 lại, nó không tự tắt.
Tắt hỗ trợ SMB1 client và server Windows 10 bằng DISM: Dism /online /Disable-Feature /FeatureName:"SMB1Protocol"
Dism /online /Disable-Feature /FeatureName:"SMB1Protocol-Client"
Dism /online /Disable-Feature /FeatureName:"SMB1Protocol-Server"
Nếu tắt SMBv1 client Windows 10, khi truy cập shared folder trên file server chỉ hỗ trợ SMBv1 (SMBv2/v3 tắt hoặc không hỗ trợ), có thể gặp lỗi:
0x80070035 The network path was not found;
Unable to connect to file shares because it is not secure. This share requires the obsolete SMB1 protocol, which is not secure and could expose your system to attacks;
You can't connect to the file share because it's not secure. This share requires the obsolete SMB1 protocol, which is unsafe and could expose your system to attack. Your system requires SMB2 or higher.
Xem thêm bài Unable to access shared folder on Windows 10.
Thêm vào đó, nếu tắt SMBv1 client, dịch vụ Computer Browser (dùng legacy NetBIOS protocol khám phá thiết bị mạng) ngừng hoạt động. Để hiển thị đúng computer lân cận trên mạng Windows 10, cấu hình dịch vụ Feature Discovery Provider Host (xem bài liên quan).
Tắt SMBv1 Client và Server qua Group Policy
Trong môi trường Active Directory domain, tắt SMBv1 trên tất cả server và máy tính dùng Group Policies (GPO). Vì không có policy cấu hình SMB riêng trong Group Policies tiêu chuẩn Windows, phải tắt qua registry policy.
- Mở Group Policy Management console (
gpmc.msc), tạo GPO mới (disableSMBv1) link đến OU chứa máy tính cần tắt SMB1; - Chuyển chế độ edit policy. Mở rộng GPO section Computer Configuration → Preferences → Windows Settings → Registry;
- Tạo Registry Item mới với cài đặt:
Action:Update
Hive:HKEY_LOCAL_MACHINE
Key Path:SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters
Value name:SMB1
Value type:REG_DWORD
Value data:0
Policy này tắt hỗ trợ component SMBv1 server qua registry trên mọi máy tính. Có thể loại trừ một số phiên bản Windows khỏi policy dùng WMI filter.
Muốn tắt SMB client trên domain computer qua GPO, tạo 2 registry parameter thêm:
- Tham số Start (kiểu REG_DWORD) giá trị 4 tại registry key HKLM\SYSTEM\CurrentControlSet\services\mrxsmb10;
- Tham số DependOnService (kiểu REG_MULTI_SZ) giá trị Bowser, MRxSmb20, NSI (mỗi giá trị dòng mới) tại reg key HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation.
Cập nhật Group Policy setting trên client (gpupdate /force) sau reboot đảm bảo component SMBv1 hoàn toàn tắt.
Security Baseline GPOs từ Microsoft Security Compliance Toolkit có administrative template riêng MS Security Guide (SecGuide.adml và SecGuide.admx) với tùy chọn tắt riêng SMB server và client:
- Configure SMB v1 server;
- Configure SMB v1 client driver.