1*7f2fe78bSCy Schubert.. _dictionary: 2*7f2fe78bSCy Schubert 3*7f2fe78bSCy SchubertAddressing dictionary attack risks 4*7f2fe78bSCy Schubert================================== 5*7f2fe78bSCy Schubert 6*7f2fe78bSCy SchubertKerberos initial authentication is normally secured using the client 7*7f2fe78bSCy Schubertprincipal's long-term key, which for users is generally derived from a 8*7f2fe78bSCy Schubertpassword. Using a pasword-derived long-term key carries the risk of a 9*7f2fe78bSCy Schubertdictionary attack, where an attacker tries a sequence of possible 10*7f2fe78bSCy Schubertpasswords, possibly requiring much less effort than would be required 11*7f2fe78bSCy Schubertto try all possible values of the key. Even if :ref:`password policy 12*7f2fe78bSCy Schubertobjects <policies>` are used to force users not to pick trivial 13*7f2fe78bSCy Schubertpasswords, dictionary attacks can sometimes be successful against a 14*7f2fe78bSCy Schubertsignificant fraction of the users in a realm. Dictionary attacks are 15*7f2fe78bSCy Schubertnot a concern for principals using random keys. 16*7f2fe78bSCy Schubert 17*7f2fe78bSCy SchubertA dictionary attack may be online or offline. An online dictionary 18*7f2fe78bSCy Schubertattack is performed by trying each password in a separate request to 19*7f2fe78bSCy Schubertthe KDC, and is therefore visible to the KDC and also limited in speed 20*7f2fe78bSCy Schubertby the KDC's processing power and the network capacity between the 21*7f2fe78bSCy Schubertclient and the KDC. Online dictionary attacks can be mitigated using 22*7f2fe78bSCy Schubert:ref:`account lockout <lockout>`. This measure is not totally 23*7f2fe78bSCy Schubertsatisfactory, as it makes it easy for an attacker to deny access to a 24*7f2fe78bSCy Schubertclient principal. 25*7f2fe78bSCy Schubert 26*7f2fe78bSCy SchubertAn offline dictionary attack is performed by obtaining a ciphertext 27*7f2fe78bSCy Schubertgenerated using the password-derived key, and trying each password 28*7f2fe78bSCy Schubertagainst the ciphertext. This category of attack is invisible to the 29*7f2fe78bSCy SchubertKDC and can be performed much faster than an online attack. The 30*7f2fe78bSCy Schubertattack will generally take much longer with more recent encryption 31*7f2fe78bSCy Schuberttypes (particularly the ones based on AES), because those encryption 32*7f2fe78bSCy Schuberttypes use a much more expensive string-to-key function. However, the 33*7f2fe78bSCy Schubertbest defense is to deny the attacker access to a useful ciphertext. 34*7f2fe78bSCy SchubertThe required defensive measures depend on the attacker's level of 35*7f2fe78bSCy Schubertnetwork access. 36*7f2fe78bSCy Schubert 37*7f2fe78bSCy SchubertAn off-path attacker has no access to packets sent between legitimate 38*7f2fe78bSCy Schubertusers and the KDC. An off-path attacker could gain access to an 39*7f2fe78bSCy Schubertattackable ciphertext either by making an AS request for a client 40*7f2fe78bSCy Schubertprincipal which does not have the **+requires_preauth** flag, or by 41*7f2fe78bSCy Schubertmaking a TGS request (after authenticating as a different user) for a 42*7f2fe78bSCy Schubertserver principal which does not have the **-allow_svr** flag. To 43*7f2fe78bSCy Schubertaddress off-path attackers, a KDC administrator should set those flags 44*7f2fe78bSCy Schuberton principals with password-derived keys:: 45*7f2fe78bSCy Schubert 46*7f2fe78bSCy Schubert kadmin: add_principal +requires_preauth -allow_svr princname 47*7f2fe78bSCy Schubert 48*7f2fe78bSCy SchubertAn attacker with passive network access (one who can monitor packets 49*7f2fe78bSCy Schubertsent between legitimate users and the KDC, but cannot change them or 50*7f2fe78bSCy Schubertinsert their own packets) can gain access to an attackable ciphertext 51*7f2fe78bSCy Schubertby observing an authentication by a user using the most common form of 52*7f2fe78bSCy Schubertpreauthentication, encrypted timestamp. Any of the following methods 53*7f2fe78bSCy Schubertcan prevent dictionary attacks by attackers with passive network 54*7f2fe78bSCy Schubertaccess: 55*7f2fe78bSCy Schubert 56*7f2fe78bSCy Schubert* Enabling :ref:`SPAKE preauthentication <spake>` (added in release 57*7f2fe78bSCy Schubert 1.17) on the KDC, and ensuring that all clients are able to support 58*7f2fe78bSCy Schubert it. 59*7f2fe78bSCy Schubert 60*7f2fe78bSCy Schubert* Using an :ref:`HTTPS proxy <https>` for communication with the KDC, 61*7f2fe78bSCy Schubert if the attacker cannot monitor communication between the proxy 62*7f2fe78bSCy Schubert server and the KDC. 63*7f2fe78bSCy Schubert 64*7f2fe78bSCy Schubert* Using FAST, protecting the initial authentication with either a 65*7f2fe78bSCy Schubert random key (such as a host key) or with :ref:`anonymous PKINIT 66*7f2fe78bSCy Schubert <anonymous_pkinit>`. 67*7f2fe78bSCy Schubert 68*7f2fe78bSCy SchubertAn attacker with active network access (one who can inject or modify 69*7f2fe78bSCy Schubertpackets sent between legitimate users and the KDC) can try to fool the 70*7f2fe78bSCy Schubertclient software into sending an attackable ciphertext using an 71*7f2fe78bSCy Schubertencryption type and salt string of the attacker's choosing. Any of the 72*7f2fe78bSCy Schubertfollowing methods can prevent dictionary attacks by active attackers: 73*7f2fe78bSCy Schubert 74*7f2fe78bSCy Schubert* Enabling SPAKE preauthentication and setting the 75*7f2fe78bSCy Schubert **disable_encrypted_timestamp** variable to ``true`` in the 76*7f2fe78bSCy Schubert :ref:`realms` subsection of the client configuration. 77*7f2fe78bSCy Schubert 78*7f2fe78bSCy Schubert* Using an HTTPS proxy as described above, configured in the client's 79*7f2fe78bSCy Schubert krb5.conf realm configuration. If :ref:`KDC discovery 80*7f2fe78bSCy Schubert <kdc_discovery>` is used to locate a proxy server, an active 81*7f2fe78bSCy Schubert attacker may be able to use DNS spoofing to cause the client to use 82*7f2fe78bSCy Schubert a different HTTPS server or to not use HTTPS. 83*7f2fe78bSCy Schubert 84*7f2fe78bSCy Schubert* Using FAST as described above. 85*7f2fe78bSCy Schubert 86*7f2fe78bSCy SchubertIf :ref:`PKINIT <pkinit>` or :ref:`OTP <otp_preauth>` are used for 87*7f2fe78bSCy Schubertinitial authentication, the principal's long-term keys are not used 88*7f2fe78bSCy Schubertand dictionary attacks are usually not a concern. 89