Hardening Samba as an AD DC: Difference between revisions

From SambaWiki
Line 27: Line 27:
Related to the above, Samba 4.17 has an the <code>allow store nt hash</code> option, allowing Samba to avoid storing the NT hash. Well known for being <strong>unsalted</strong> the NT hash is required for <code>NTLM</code>, <code>NTLMv2</code>, and <code>MSCHAPv2</code> authentication, as well as for <code>arcfour-hmac-md5</code> Kerberos authentication. However in 2023 all of these authentication mechanisms are considered as weak, and should not be used on hardened networks.
Related to the above, Samba 4.17 has an the <code>allow store nt hash</code> option, allowing Samba to avoid storing the NT hash. Well known for being <strong>unsalted</strong> the NT hash is required for <code>NTLM</code>, <code>NTLMv2</code>, and <code>MSCHAPv2</code> authentication, as well as for <code>arcfour-hmac-md5</code> Kerberos authentication. However in 2023 all of these authentication mechanisms are considered as weak, and should not be used on hardened networks.


The purpose of this option is to allow Samba to not store the NT hash that will not be used, as it presents a vulnerability if the DB is exposed. The value <code>never</code> avoids this storage.
The purpose of this option is to allow Samba to not store the NT hash that will not be used, as it presents a vulnerability if the DB is exposed.

A hardened installation will set the value <code>never</code>, which avoids this storage.


==server min protocol, client min protocol, client ipc min protocol==
==server min protocol, client min protocol, client ipc min protocol==

Revision as of 23:58, 31 May 2023

Samba smb.conf options to set/not set

ldap server require strong auth

This smb.conf option was introduced due to the attacks on LDAP known as NTLM forwarding or 'pass the hash' attacks. If ldap server require storong auth it set to no or allow_sasl_over_tls then the authentication to an SMB server by a privileged user or computer can be redirected to our LDAP server, allowing impersonation.

A hardened installation will retain the default value of yes

See also notes on this change.

It is more secure to use Kerberos with Kerberos encryption directly.

Future possible hardening

Microsoft has chosen a different path to addressing this issue, and instead would like AD clients to include a session-specific value in the NTLMv2 response, known a channel binding. Samba doesn't set this as a client nor does it check this as a server, at this time. A future Samba may add a new option here allowing NTLM and Kerberos connections over TLS, when this is sent and checked.

ntlm auth

NTLM authentication is 56-bit encryption at best and compromised badly for well-known word lists.

For a passive attacker, the options no and allow-mschapv2 are at their core equally insecure, as they boil down to the same cryptography, but the latter option is permitted because MSCHAPv2 is harder to eliminate, is not presented on administrative interfaces and may be protected by a TLS tunnel.

A fully hardened installation should set this to disabled, to require Kerberos or simple-bind authentication only, as even NTLMv2 is quite poor security in 2023.

allow store nt hash

Related to the above, Samba 4.17 has an the allow store nt hash option, allowing Samba to avoid storing the NT hash. Well known for being unsalted the NT hash is required for NTLM, NTLMv2, and MSCHAPv2 authentication, as well as for arcfour-hmac-md5 Kerberos authentication. However in 2023 all of these authentication mechanisms are considered as weak, and should not be used on hardened networks.

The purpose of this option is to allow Samba to not store the NT hash that will not be used, as it presents a vulnerability if the DB is exposed.

A hardened installation will set the value never, which avoids this storage.

server min protocol, client min protocol, client ipc min protocol

Modern Samba versions default to SMB2 and above. A hardened Samba installation should not set server min protocol client min protocol or client ipc min protocol to values such as NT1, which enable the old SMB1 support.

Avoiding SMB1 avoids support for NTLMv2 without NTLMSSP, which is not as secure as NTLMv2 as used within NTLMSSP - eg as used in SMB2, as well as a significant body of older C code in Samba. The SMB message signing (integrity protection) protocols are also much better in SMB2.

Protected Users

Protected users, implemented in Samba 4.17 and later, are not permitted to use NTLM, are restricted from Kerberos delegations (were one server can act as the user to another) and have shorter ticket lifetimes. Windows clients also detect protected users and implement local protections for these accounts.