Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:it-security:smb-hardening [2023/12/23 00:33] – removed psycore | en:it-security:smb-hardening [2024/02/05 08:34] (current) – old revision restored (2024/02/04 23:30) psycore | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | {{tag> | ||
+ | ====== SMB Hardening ====== | ||
+ | ===== Technical background to the SMB protocol ===== | ||
+ | |||
+ | [[wpde> | ||
+ | The SMB signing explicitly assigns each initiated session to the client. This means that it is still possible to hijack the authentication, | ||
+ | |||
+ | In SMBv1, SMB signing is deactivated by default. This protocol is outdated, error-prone, | ||
+ | SMBv2 activates SMB signing as the default value, but only uses it if the server or client require it as a prerequisite. This is usually not the case. | ||
+ | |||
+ | ^ ^ Server ^ ^ ^ | ||
+ | ^ Client ^ Requires ^ Activated ^ Deactivated (SMBv1) ^ | ||
+ | | Required | @lightgreen: | ||
+ | | Enabled | @lightgreen: | ||
+ | | Disabled (SMBv1) | @lightgrey: | ||
+ | |||
+ | This means that SMB signing must be activated on the server as a prerequisite. | ||
+ | |||
+ | ===== Procedure ===== | ||
+ | |||
+ | < | ||
+ | flowchart | ||
+ | Z[Flow] | ||
+ | A[Disable SMBv1] | ||
+ | B[SMB signing] | ||
+ | C(Client) | ||
+ | D(Server) | ||
+ | E(optional activation) | ||
+ | F(forced activation) | ||
+ | Z--Step 1-->A | ||
+ | Z-->B | ||
+ | B-->C | ||
+ | B-->D | ||
+ | C--Step 2-->E | ||
+ | D--Step 3-->F | ||
+ | </ | ||
+ | |||
+ | ==== Step 1 - Deactivate SMBv1 ==== | ||
+ | |||
+ | === Clients === | ||
+ | |||
+ | Clients can be managed via the login script. The status can be queried via Powershell (admin rights required) as follows: | ||
+ | |||
+ | <code powershell> | ||
+ | |||
+ | SMBv1 can also be deactivated via Powershell (restart required): | ||
+ | |||
+ | <code powershell> | ||
+ | |||
+ | |||
+ | === Server === | ||
+ | |||
+ | The same commands apply to servers. A restart should be scheduled in advance. | ||
+ | |||
+ | ==== Step 2 - Optionally activate SMB signing on the client side ==== | ||
+ | |||
+ | In the next step, SMB signing is optionally activated on the client side. A global group policy can be set for this purpose. | ||
+ | The corresponding guidelines can be found here: | ||
+ | |||
+ | < | ||
+ | Computerkonfiguration | ||
+ | | ||
+ | Sicherheitseinstellungen | ||
+ | | ||
+ | Sicherheitsoptionen | ||
+ | </ | ||
+ | |||
+ | {{it-security: | ||
+ | |||
+ | Alternatively, | ||
+ | |||
+ | <code reg> | ||
+ | Windows Registry Editor Version 5.00 | ||
+ | |||
+ | [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters] | ||
+ | " | ||
+ | " | ||
+ | </ | ||
+ | |||
+ | ==== Step 3 - Force SMB signing on the server side ==== | ||
+ | |||
+ | === Option 1: via group policy === | ||
+ | |||
+ | <code text> | ||
+ | Computerkonfiguration | ||
+ | | ||
+ | Sicherheitseinstellungen | ||
+ | | ||
+ | Sicherheitsoptionen | ||
+ | </ | ||
+ | |||
+ | {{it-security: | ||
+ | |||
+ | === Option 2: via Powershell === | ||
+ | |||
+ | == Retrieve status == | ||
+ | |||
+ | <code powershell> | ||
+ | Get-SmbClientConfiguration | select RequireSecuritySignature, | ||
+ | Get-SmbServerConfiguration | select RequireSecuritySignature, | ||
+ | </ | ||
+ | |||
+ | == Enable force == | ||
+ | |||
+ | <code powershell> | ||
+ | Set-SmbClientConfiguration -EnableSecuritySignature $true | ||
+ | Set-SmbServerConfiguration -EnableSecuritySignature $true | ||
+ | Set-SmbServerConfiguration -RequireSecuritySignature $true | ||
+ | Set-SmbClientConfiguration -RequireSecuritySignature $true | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | References | ||
+ | |||
+ | <sup> | ||
+ | https:// | ||
+ | </ | ||
+ | |||
+ | <sup> | ||
+ | https:// | ||
+ | </ |