ใน Windows Server 2016/2019 และ Windows 10 (Build 1709 ขึ้นไป) Network Protocol Server Message Block 1.0 (SMBv1) ที่ใช้เข้าถึง Shared Folders ถูก Disable By Default ในส่วนใหญ่ Protocol นี้จำเป็นสำหรับเข้าถึง Shared Folders บน Legacy Systems เช่น Windows XP, Windows Server 2003 และ OS เก่าที่ไม่ได้รับ Support แล้ว บทความนี้แสดงวิธี Enable หรือ Disable SMBv1 Client และ Server Support บน Windows 10 และ Windows Server 2016/2019
หาก Network ไม่มี SMB 1.x Clients เหลืออยู่ ต้อง Disable SMBv1 บน Windows Devices ทั้งหมด การ Disable SMB 1.0 ป้องกัน Windows Computers จาก Vulnerabilities หลากหลายใน Legacy Protocol นี้ (Exploit ชื่อดังสำหรับ SMBv1 คือ EternalBlue) ผลลัพธ์ Devices จะใช้ SMB Protocol Versions ใหม่ที่มีประสิทธิภาพ ปลอดภัย และฟังก์ชันครบถ้วนมากขึ้นเมื่อเข้าถึง Network Shares
ในบทความก่อนหน้าเราแสดงตาราง Client/Server-side SMB Version Compatibility ตามตาราง Old Client Versions (XP, Server 2003 และบาง *nix Clients) เข้าถึง Network Shared Folders ได้เฉพาะ SMB v1.0 Protocol หากไม่มี Clients แบบนี้ใน Network สามารถ Disable SMB 1.0 บน File Servers (รวม AD Domain Controllers) และ Client Desktops ได้หมด
ใน Windows 10 และ Windows Server 2016 SMBv1 Protocol แยกเป็น 2 Components แยกกัน — SMB Client และ SMB Server Enable/Disable แยกกันได้
สารบัญ
- Audit Shared Folder Access ผ่าน SMB v1.0
- Enable/Disable SMB 1.0 บน Windows Server 2016/2019
- Enable/Disable SMBv1 บน Windows 10
- Disable SMBv1 Client และ Server ผ่าน Group Policy
Audit Shared Folder Access ผ่าน SMB v1.0
ก่อน Disable หรือ Remove SMB 1.0 Driver ทั้งหมดฝั่ง SMB File Server ควรตรวจสอบก่อนว่าไม่มี Legacy Clients ใช้ SMBv1 ใน Network Enable Audit File Server Access ผ่าน SMB v1.0 ด้วย PowerShell:
Set-SmbServerConfiguration –AuditSmb1Access $true
หลัง 2-3 วัน เปิด Event Viewer บน Server Check Log Applications and Services → Microsoft → Windows → SMBServer → Audit ดูว่ามี Clients เข้าถึง File Server ผ่าน SMB1 หรือไม่
Tip: แสดง Events จาก Event Log นี้ด้วย PowerShell: Get-WinEvent -LogName Microsoft-Windows-SMBServer/Audit
ตัวอย่างพบ Event ID 3000 จาก Source SMBServer ใน Log Event บ่งชี้ Client 192.168.1.10 พยายามเข้าถึง Server ด้วย 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.
ต้องหา Computer/Device นี้ใน Network Update OS หรือ Firmware เป็น Version รองรับ SMB Protocol ใหม่: SMBv2 หรือ SMBv3
ตัวอย่างเราจะไม่สนใจข้อมูลนี้ แต่ควรจำไว้ว่า Client นี้ภายหลังจะเข้าถึง Shared Folders บน SMB Server นี้ไม่ได้
Enable/Disable SMB 1.0 บน Windows Server 2016/2019
ใน Windows Server 2016 Build 1709 ขึ้นไป และ Windows Server 2019 SMBv1 Disabled By Default เพื่อ Enable SMBv1 Client Protocol ใน Windows Server รุ่นใหม่ ต้อง Install Feature แยก SMB 1.0/CIFS File Sharing Support
Install SMBv1 Feature ผ่าน Server Manager หรือ PowerShell
ตรวจสอบ SMBv1 Enabled ด้วย PowerShell:
Get-WindowsFeature | Where-Object {$_.name -eq "FS-SMB1"} | ft Name,Installstate
Install FS-SMB1 Feature: Install-WindowsFeature FS-SMB1
Uninstall SMBv1 Client Feature (ต้อง Reboot): Uninstall-WindowsFeature –Name FS-SMB1 –Remove
PowerShell Command อีกตัวที่ Remove SMB1Protocol Feature:
Disable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol -Remove
เพื่อให้ Server จัดการ SMBv1.0 Client Access ได้ ต้อง Enable SMBv1 Support ที่ SMB File Server Level เพิ่มจาก Component FS-SMB1 ตรวจสอบว่า SMBv1 Access Enabled สำหรับ Network Shares บน Server:
Get-SmbServerConfiguration
บรรทัด "EnableSMB1Protocol: True" หมายถึงอนุญาตเข้าถึง Shared Folders บน Server นี้ด้วย SMBv1 Protocol Disable SMBv1 Server Support ใน Windows Server:
Set-SmbServerConfiguration -EnableSMB1Protocol $false -Force
ตรวจสอบอีกครั้งด้วย Get-SmbServerConfiguration ให้แน่ใจว่า SMB1 Server Disabled แล้ว
Enable SMBv1 Support บน Server: Set-SmbServerConfiguration -EnableSMB1Protocol $True -Force
บน Windows 7/8 และ Windows Server 2008 R2/2012 เพื่อ Disable SMB 1.0 Client ต้อง Disable Service และ SMBv1 Access Driver:
sc.exe config lanmanworkstation depend= bowser/mrxsmb20/nsi
sc.exe config mrxsmb10 start= disabled
Enable/Disable SMBv1 บน Windows 10
ใน Windows 10 Builds ใหม่ทั้งหมด (1709 ขึ้นไป) SMB1 Protocol Disabled (Guest Access ผ่าน SMBv2 Disabled ด้วย)
ตรวจสอบ Status SMBv1 Protocol Components ด้วย DISM:
Dism /online /Get-Features /format:table | find "SMB1Protocol"
ตัวอย่าง SMBv1 Features ทั้งหมด Disabled:
SMB1Protocol | Disabled SMB1Protocol-Client | Disabled SMB1Protocol-Server | Disabled SMB1Protocol-Deprecation | Disabled
ใน Windows 10 จัดการ SMB 1 Features จาก Control Panel (optionalfeatures.exe) ได้ ขยาย SMB 1.0 /CIFS File Sharing Support จะเห็น 3 SMBv1 Components:
- SMB 1.0/CIFS Automatic Removal
- SMB 1.0/CIFS Client
- SMB 1.0/CIFS Server
Enable SMBv1 Client และ Server บน Windows 10 จาก Feature Management Window หรือคำสั่ง:
Dism /online /Enable-Feature /FeatureName:"SMB1Protocol"
Dism /online /Enable-Feature /FeatureName:"SMB1Protocol-Client"
Dism /online /Enable-Feature /FeatureName:"SMB1Protocol-Server"
Enable ด้วย PowerShell: Enable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol-Server
Enable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol-Client
หาก Enable SMBv1 Client แล้วไม่ได้ใช้งานเกิน 15 วัน จะถูก Disable อัตโนมัติ — Automatic Removal เป็น One-time Operation หาก Admin Enable SMBv1 Manual อีกครั้ง จะไม่ Disable Auto อีก
Disable SMB1 Client และ Server Support ใน Windows 10 ด้วย DISM:
Dism /online /Disable-Feature /FeatureName:"SMB1Protocol"
Dism /online /Disable-Feature /FeatureName:"SMB1Protocol-Client"
Dism /online /Disable-Feature /FeatureName:"SMB1Protocol-Server"
หาก Disable SMBv1 Client ใน Windows 10 แล้วเข้าถึง Shared Folder บน File Server ที่รองรับแค่ SMBv1 (SMBv2/v3 Disabled หรือไม่รองรับ) อาจเจอ Errors:
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.
เพิ่มเติม หาก Disable SMBv1 Client Service Computer Browser (ใช้ Legacy NetBIOS Protocol Discover Devices บน Network) จะหยุดทำงานบน Computer เพื่อแสดง Neighboring Computers บน Windows 10 Network ให้ถูกต้อง ต้องตั้งค่า Service Feature Discovery Provider Host (ดูบทความอื่น)
Disable SMBv1 Client และ Server ผ่าน Group Policy
ใน Active Directory Domain Environment Disable SMBv1 บน Servers และ Computers ทั้งหมดด้วย Group Policies (GPOs) เนื่องจากไม่มี SMB Configuration Policy แยกใน Standard Windows Group Policies ต้อง Disable ผ่าน Registry Policy
- เปิด Group Policy Management Console (
gpmc.msc) สร้าง GPO ใหม่ (disableSMBv1) Link ไป OU ที่มี Computers ที่ต้องการ Disable SMB1 - Switch ไป Edit Mode Expand GPO Section Computer Configuration → Preferences → Windows Settings → Registry
- สร้าง Registry Item ใหม่ Setting:
Action:Update
Hive:HKEY_LOCAL_MACHINE
Key Path:SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters
Value Name:SMB1
Value Type:REG_DWORD
Value Data:0
Policy นี้ Disable SMBv1 Server Component ผ่าน Registry บน Computers ทั้งหมด สามารถ Exclude Windows Versions บางรุ่นด้วย WMI Filter
หากต้องการ Disable SMB Client บน Domain Computers ผ่าน GPO สร้าง Registry Parameters เพิ่ม 2 ตัว:
- Parameter Start (REG_DWORD) Value 4 ใน Registry Key HKLM\SYSTEM\CurrentControlSet\services\mrxsmb10
- Parameter DependOnService (REG_MULTI_SZ) Value Bowser, MRxSmb20, NSI (แต่ละค่าบรรทัดใหม่) ใน Reg Key HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation
Update GPO Settings บน Clients (gpupdate /force) หลัง Reboot ตรวจสอบว่า SMBv1 Components Disabled สมบูรณ์
Security Baseline GPOs จาก Microsoft Security Compliance Toolkit มี Administrative Template แยก MS Security Guide (SecGuide.admlและSecGuide.admx) ที่มี Options แยก Disable SMB Server และ Client:
- Configure SMB v1 server;
- Configure SMB v1 client driver.