home *** CD-ROM | disk | FTP | other *** search
/ ftp.microsoft.com / 2002-07-02_ftp.microsoft.com.zip / developr / drg / CIFS / CIFS-Security-Considerations.txt < prev    next >
Text File  |  1997-03-25  |  19KB  |  493 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.                   CIFS Security Considerations Update
  9.  
  10.                              Paul J. Leach
  11.  
  12.                                Microsoft
  13.  
  14.                     Preliminary Draft - do not cite
  15.  
  16.                            Author's draft: 4
  17.  
  18. This is a preliminary draft of an update to the security considerations
  19. section of the CIFS specification, corresponding to an update to the
  20. security protocols described in companion documents. It is supplied here
  21. as a standalone document for ease of review; if accepted and
  22. implemented, it will be incorporated into a future release of the CIFS
  23. specification. (This specification may change without notice, and should
  24. not be construed as a product commitment from Microsoft Corporation.)
  25.  
  26.  
  27. 1  Security Considerations
  28.  
  29. There are four authentication mechanisms, each with their own strengths
  30. and weaknesses, as well as attacks that are independent of the
  31. authentication protocol.
  32.  
  33. If the CIFS authentication protocol is correctly implemented, then for
  34. all the attacks and weaknesses listed, there are client or server
  35. configurations or other countermeasures to defend against them. At the
  36. highest configurable security setting, with well-chosen passwords, the
  37. best known attack is as hard as attacking DES with chosen plaintext.
  38.  
  39. This section is for the guidance of implementers, to help them avoid
  40. implementation pitfalls, and for system administrators, to help them
  41. choose a security configuration that meets their installation's security
  42. requirements.
  43.  
  44.  
  45. 1.1 Security models
  46.  
  47. There are two security models - share level security and user level
  48. security. Even though the models are different, each model involves
  49. users demonstrating knowledge of a password to gain access, and the
  50. authentication protocols that prove knowledge of the password are the
  51. same for both models.
  52.  
  53.  
  54. 1.1.1     Share level security
  55.  
  56. When using share level security, there are no per-user passwords;
  57. instead, knowledge of the read or write password is what gives read or
  58. write access to a share. A session is established by connecting to a
  59. share using the SMB_TREE_CONNECT request, using one of the session
  60. authentication mechanisms described below.
  61.  
  62. Since the same passwords must be disclosed to many people to be used,
  63. and hence known by many people, while the authentication protocols are
  64.  
  65.  
  66. Paul J. Leach, Microsoft  [Page 1]                  03/25/97
  67.  
  68.  
  69. Preliminary     CIFS Security ConsiderationsMay change without notice
  70.  
  71.  
  72. as strong as for user-level protection, share level security is much
  73. weaker that user level security in practice. This scheme may be
  74. appropriate for small workgroups of trusted/cooperative users, and where
  75. the overhead of managing user accounts is deemed to be too high. The
  76. fewer the number of people who know any given password, the better; this
  77. is especially true for administrative passwords.
  78.  
  79. Share level protection is at the discretion of the server, and does not
  80. compromise the ability of any other client or server to use stronger
  81. security amongst themselves.
  82.  
  83.  
  84. 1.1.2     User level security
  85.  
  86. When using user level security, users authenticate themselves by proving
  87. that they know a password which is known only to that user. A session is
  88. established by connecting to a server using the SMB_SESSION_SETUP_ANDX
  89. request, using one of the session authentication mechanisms described
  90. below. Thereafter, the identity of the user determines the access
  91. allowed to the resources on the server, not knowledge of the password.
  92.  
  93. As discussed above, user level security is usually preferable to  share
  94. level security. In addition, it can allow access control at a per-
  95. resource granularity, instead of at the granularity of the whole share.
  96.  
  97.  
  98. 1.2 Attacks on session authentication with plaintext passwords
  99.  
  100. This authentication protocol sends the client's password in the clear.
  101. It is thus completely open to an eavesdropping attack. If eavesdropping
  102. is not possible, clients can have their passwords stolen by counterfeit
  103. servers. Password guessing attacks are possible, with success dependant
  104. on how well-chosen the passwords are.
  105.  
  106. Passwords sent to such servers should never be the same as passwords
  107. used for more secure servers.
  108.  
  109. It should be used only when absolutely needed for backwards
  110. compatibility, and only where the risks of eavesdropping is deemed
  111. acceptable, such as relatively isolated networks or on networks with
  112. secure (encrypted and/or authenticated) link layers.
  113.  
  114. In general, unless there are very special and well considered reasons,
  115. this protocol should not be used.
  116.  
  117.  
  118. 1.3 Attacks on session authentication using LM session key
  119.  
  120. This authentication protocol is more secure than plaintext password
  121. authentication, because passwords are never seen in the clear on the
  122. network.
  123.  
  124. The following sections analyze the vulnerability of this protocol to
  125. attack using the following techniques:
  126.  
  127. Paul J. Leach, Microsoft  [Page 2]                  03/25/97
  128.  
  129.  
  130. Preliminary     CIFS Security ConsiderationsMay change without notice
  131.  
  132.  
  133. o Eavesdropping/ brute force attacks
  134.  
  135. o Chosen plaintext attack
  136.  
  137. o Dictionary attacks
  138.  
  139. These attacks, if successful, compromise the client's password, and
  140. allow the attacker access to the client's files even after the client's
  141. session has ended. Because the same protocol using the NT session key is
  142. stronger, its use is recommended except where backwards compatibility is
  143. required.
  144.  
  145.  
  146.      1.3.1     Eavesdropping/ brute force attacks
  147.  
  148. With the session authentication protocol , an eavesdropper can acquire
  149. challenge/response pairs. It can then test a password by using it to
  150. generate a key, encrypting the challenge, and comparing it to the
  151. corresponding response; by exhaustively trying all possible passwords,
  152. the correct one will eventually be found. This is as hard as finding a
  153. DES key given a known plaintext/cryptext pair.
  154.  
  155.  
  156.      1.3.2     Chosen plaintext attacks
  157.  
  158. With the session authentication protocol, a "man-in-the-middle" or a
  159. counterfeit server can choose the challenge which the client will then
  160. encrypt using a key derived from the client's password. The ability to
  161. choose the plaintext to be encrypted is known to make breaking many
  162. ciphers much easier, and it is possible that it also may help break
  163. cipher-based one-way functions such as the one used to compute the LM
  164. session key.
  165.  
  166. However, no way to break the DES one-way function used in the session
  167. authentication protocol using chosen plaintext is currently known.
  168.  
  169.  
  170.      1.3.3     Dictionary attacks
  171.  
  172.  
  173.       1.3.3.1  Online dictionary attacks
  174.  
  175. If the attacker can eavesdrop, but can not execute a chosen plaintext
  176. attack, then it can test any overheard challenge/response pair against a
  177. list of common words. Such a list is usually much smaller than the total
  178. number of possible passwords. The cost of computing the response for
  179. each password on the list is paid once for each challenge.
  180.  
  181.  
  182.       1.3.3.2  Stored dictionary attacks
  183.  
  184. If the attacker can execute a chosen plaintext attack, the attacker can
  185. compute the session key for many common words and use it to precompute
  186. the response to a challenge of its choice, and store a dictionary of
  187.  
  188. Paul J. Leach, Microsoft  [Page 3]                  03/25/97
  189.  
  190.  
  191. Preliminary     CIFS Security ConsiderationsMay change without notice
  192.  
  193.  
  194. (response, password) pairs. Such precomputation can often be done in
  195. parallel on many machines. It can then use the chosen plaintext attack
  196. to acquire a response corresponding to that challenge, and just look up
  197. the password in the dictionary. Even if most passwords are not in the
  198. dictionary, some might be. Since the attacker gets to pick the
  199. challenge, the cost of computing the response for each password on the
  200. list can be amortized over many passwords.
  201.  
  202. The countermeasure against both these types of dictionary attack is to
  203. require users to choose passwords that are not common words. For the
  204. second type of attack, if the key space derived from passwords is large
  205. enough, then it will be infeasible to store the dictionary.
  206.  
  207.  
  208.      1.3.4     Small key space resulting from badly chosen passwords
  209.  
  210. Even when passwords are not allowed to be common words, the combination
  211. of the use of only uppercase characters, the usual user practice of
  212. choosing passwords that have alpha and perhaps numeric characters, plus
  213. the fact that the LM session key construction treats the upper and lower
  214. halves of the 14 bytes key almost identically means that the key space
  215. may be rather small. Enumerating 7 uppercase characters and digits leads
  216. to a key space of 36**7, or 78.3 billion combinations. When this
  217. mechanism was introduced nearly a decade ago, this was probably an
  218. adequately large key space, but with today's much more powerful systems,
  219. it would now be small enough to make a brute force search expensive but
  220. feasible upon a challenge/response pair obtained via an eavesdropping
  221. attack if the attacker had many powerful hosts available or special
  222. purpose hardware.
  223.  
  224. The countermeasure to this problem is to require users to choose
  225. passwords that lead to more possible combinations. For example, just
  226. requiring one randomly chosen punctuation character in a password
  227. increases the key space by a factor of 13. If all characters of the
  228. password are chosen at random, there are 68**7, or 6.7 trillion,
  229. combinations. If this is still inadequate, then the NT session key
  230. should be used.
  231.  
  232.  
  233.     1.4   Attacks on session authentication using NT session keys
  234.  
  235. The session authentication protocol using NT session keys is the same as
  236. when using LM session keys; only the key construction is different. As a
  237. result, it may be attacked using the same techniques. However, because
  238. it uses MD4 to generate the keying material from the password, and
  239. because it preserves the password's case, the key space of this protocol
  240. is essentially the full 56 bits that single DES allows; this is probably
  241. an acceptable length for most purposes (although future dialects may use
  242. triple-DES for more assurance). It is still subject to the same chosen
  243. plaintext and dictionary attacks as above, and these will be feasible if
  244. passwords are badly chosen. As above, the countermeasure is to make sure
  245. that passwords are well-chosen, and long enough to have at least 56 bits
  246. of randomness.
  247.  
  248.  
  249. Paul J. Leach, Microsoft  [Page 4]                  03/25/97
  250.  
  251.  
  252. Preliminary     CIFS Security ConsiderationsMay change without notice
  253.  
  254.  
  255. Other considerations:
  256.  
  257. o Transforming the password into Unicode leaves a pattern of
  258.   alternating zeros and characters in the input to MD4.  It is possible
  259.   that this may allow MD4 to be reversed much more easily, although
  260.   there is currently no known way to exploit this.
  261.  
  262. o MD4 is known to be weak with respect to collisions, compared to MD5
  263.   and SHA.  It is possible that there may be a way to exploit this to
  264.   attack its one-wayness, or to exploit the collision properties to
  265.   limit key search time, although there is currently no known way to do
  266.   so.
  267.  
  268.  
  269. 1.5 Other attacks
  270.  
  271.  
  272. 1.5.1     Connection hijacking
  273.  
  274. Any attacker that can inject packets into the network that appear to the
  275. server to be coming from a particular client, can hijack that client's
  276. connection. Once a connection is set up and the client has
  277. authenticated, if subsequent packets are not authenticated the attacker
  278. can inject requests to read, write, or delete files to which the client
  279. has access.
  280.  
  281. Doing so requires that the injected packets have the right transport
  282. level sequence numbers. If the attacker can not eavesdrop, this will
  283. have very low probability of success, since the 32 bit initial sequence
  284. numbers may be randomly chosen. Even if it can eavesdrop, then it needs
  285. "gag" the client, otherwise the client will start getting packets with
  286. bad sequence numbers and reset the connection. This requires that the
  287. attacker is on a host on the same LAN segment as the client or server
  288. and has modified the hosts OS to get direct access to its network card,
  289. or has taken over a router between the client and the server. It is
  290. significantly more difficult to hijack a connection than to eavesdrop,
  291. and doing so only permits the attacker to access files as the client for
  292. the duration of the session. (See RFC 1948.)
  293.  
  294. The countermeasure against connection hijacking is to configure the
  295. client or server to require the use of message authentication.
  296.  
  297.  
  298. 1.5.2     Downgrade attacks
  299.  
  300. If a client is not appropriately configured, a "man-in-the-middle" can
  301. remove the bit in the SMB_COM_NEGPROT response that says the server
  302. supports challenge/response, thus fooling a client into thinking that it
  303. should supply a plaintext password.
  304.  
  305. The countermeasure against downgrade attacks is to configure the client
  306. or server to require either session or message authentication.
  307.  
  308.  
  309.  
  310. Paul J. Leach, Microsoft  [Page 5]                  03/25/97
  311.  
  312.  
  313. Preliminary     CIFS Security ConsiderationsMay change without notice
  314.  
  315.  
  316. 1.5.3     Rogue servers and spoofing by counterfeit servers
  317.  
  318. A counterfeit server is one that spoofs the DNS name resolution process
  319. so that the client gets the counterfeit's IP address instead of the
  320. genuine server's IP address, thus fooling the client into connecting to
  321. the counterfeit while believing it is connecting to the genuine server.
  322.  
  323. A rogue server is a server that entices a client into accessing it, and
  324. uses some aspect of the interaction to try to mount an attack.
  325.  
  326. Counterfeit and rogue servers are not detectable by the session
  327. authentication mechanism, which only authenticates clients to servers.
  328.  
  329. If a client is not appropriately configured, a rogue or counterfeit
  330. server can use the downgrade attack above to obtain a client's password.
  331. A counterfeit server can also execute a denial of service attack by
  332. ignoring the client's requests or returning bogus results.
  333.  
  334. A rogue or counterfeit server can authenticate to a real server as any
  335. client that attempts to log in to it, by getting the client to respond
  336. to the challenge from the real server.
  337.  
  338. The countermeasure against rogue or counterfeit servers is to require
  339. use of the message authentication protocol., which provides mutual
  340. authentication. Also, such attacks can be mitigated by deployment of
  341. DNSSEC.
  342.  
  343.  
  344. 1.5.4     Active message modification attacks
  345.  
  346. If a client or server not appropriately configured, a router or a host
  347. on a LAN segment between the client and server may be able mount an
  348. "active message modification attack": it may be able to modify messages
  349. sent between the client and server.
  350.  
  351. The countermeasure to such attacks is to use the message authentication
  352. protocol. Active message modification attacks are prevented, because
  353. unless the MAC key is known, tampering with the message will cause the
  354. MAC to fail to validate.
  355.  
  356.  
  357. 1.5.5     MAC key attacks
  358.  
  359. The best attack on the MAC key is to attack the session authentication
  360. protocol using one of the techniques above to obtain the password, and
  361. then just compute the MAC key per the specification - which reduces to
  362. brute force search of the key space. (Message authentication is intended
  363. to provide mutual authentication on each message, not increased password
  364. strength.)
  365.  
  366. The next best attack is a brute force search of the 128 bit key space.
  367. The message authentication protocol does not send the complete output of
  368. the keyed-MD5 hash; only half of it. As a result, it does not expose a
  369. full (plaintext, cryptext) pair to an attacker. This will make discovery
  370.  
  371. Paul J. Leach, Microsoft  [Page 6]                  03/25/97
  372.  
  373.  
  374. Preliminary     CIFS Security ConsiderationsMay change without notice
  375.  
  376.  
  377. of the MAC key more difficult, since there should be many potential MAC
  378. keys K' with the property that  it produces the same first 8 bytes of
  379. the hash as the actual key K.  However, if an attacker sees a second
  380. authenticated message, then the chances that K' produces the MACs on
  381. both of them correctly will be 1 in 2**128, so K' is then quite likely
  382. the actual key.
  383.  
  384. Since the key is formed from both the session key (which is per-user and
  385. long-lived) and the response (which is per-session), large quantities of
  386. data are not hashed using a long-lived key, which might subject it to
  387. attack.
  388.  
  389. See RFC 1828 for an example of keyed MD5 applied to IP security. If not
  390. used properly, keyed MD5 may have weaknesses as a MAC. Iterative hashes
  391. such as MD5 may be subject to message extension attacks and to
  392. cryptanalysis [Kal 95].  The CIFS MAC construction is not subject to the
  393. problems identified in [Kal 95], because the text contains an explicit
  394. length, which prevents message extension attacks; and because there are
  395. always two iterations of the compression function, and only 64 bits of
  396. the hash are output, which prevents known cryptanalysis techniques.
  397.  
  398.  
  399. 1.5.6     Replay attacks
  400.  
  401. An attacker who can eavesdrop and send packets can attempt a replay
  402. attack: resend a request or response previously overheard.
  403.  
  404. The countermeasure against replay attacks is to use the message
  405. authentication protocol. Replay is prevented, because each request and
  406. response has a unique, strictly increasing sequence number which is
  407. incorporated into the computation of the MAC. (Multi-message requests
  408. and responses all have the same request or response sequence number, but
  409. contain a unique fragment sequence number which prevents replay.)
  410.  
  411.  
  412. 1.6 Other considerations
  413.  
  414.  
  415. 1.6.1     Privacy
  416.  
  417. This version of the CIFS protocol does not support privacy protection.
  418. In order to obtain it, one may use a privacy protecting network layer
  419. protocol (such as IPSec, PPTP, or L2F) or a privacy protecting transport
  420. layer protocol (such as SSL or TLS) to transport CIFS protocol messages.
  421.  
  422.  
  423. 1.6.2     Performance
  424.  
  425. The use of message authentication causes the complete contents of each
  426. message to be hashed using MD5, which can decrease performance. Very
  427. high speed implementations of MD5 are available (20 megabytes/sec on a
  428. 166 mhz Pentium) that can minimize the impact.
  429.  
  430.  
  431.  
  432. Paul J. Leach, Microsoft  [Page 7]                  03/25/97
  433.  
  434.  
  435. Preliminary     CIFS Security ConsiderationsMay change without notice
  436.  
  437.  
  438. 1.7 Storing Passwords Securely
  439.  
  440. The passwords used in any of the authentication mechanisms used by this
  441. protocol have to be protected from access from over the network and from
  442. physical access. If the server does not support access control at the
  443. individual file level, but only at the file tree level, then password
  444. files can not be placed in a file tree that is accessible from the
  445. network, as all files in such a tree have to be at least equally
  446. readable.
  447.  
  448.  
  449. References
  450.  
  451. [FIPS 81] DES, FIPS PUB xxx
  452.  
  453. [RFC 1320] RFC 1320, R. Rivest, The MD4 Message-Digest Algorithm
  454.  
  455. [RFC 1321] RFC 1321, R. Rivest, The MD5 Message-Digest Algorithm
  456.  
  457. [RFC 1828] RFC 1828, P. Metzger, W. Simpson, "IP Authentication using
  458. Keyed MD5", August 1995
  459.  
  460. {Kal 95] B. Kaliski, M.Robshaw,  "Message Authentication with MD5",
  461. CryptoBytes, Sping 1995, RSA Inc,
  462. (http://www.rsa.com/rsalabs/pubs/cryptobytes/spring95/md5.htm)
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493. Paul J. Leach, Microsoft  [Page 8]                  03/25/97