2
0

SECURITY2 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. This is the security documentation for tinc, a Virtual Private Network daemon.
  2. Copyright 2001-2006 Guus Sliepen <guus@tinc-vpn.org>,
  3. 2001-2006 Wessel Dankers <wsl@tinc-vpn.org>
  4. Permission is granted to make and distribute verbatim copies of
  5. this documentation provided the copyright notice and this
  6. permission notice are preserved on all copies.
  7. Permission is granted to copy and distribute modified versions of
  8. this documentation under the conditions for verbatim copying,
  9. provided that the entire resulting derived work is distributed
  10. under the terms of a permission notice identical to this one.
  11. $Id$
  12. Proposed new authentication scheme
  13. ----------------------------------
  14. A new scheme for authentication in tinc has been devised, which offers some
  15. improvements over the protocol used in 1.0pre2 and 1.0pre3. Explanation is
  16. below.
  17. daemon message
  18. --------------------------------------------------------------------------
  19. client <attempts connection>
  20. server <accepts connection>
  21. client ID client 12
  22. | +---> version
  23. +-------> name of tinc daemon
  24. server ID server 12
  25. | +---> version
  26. +-------> name of tinc daemon
  27. client META_KEY 5f0823a93e35b69e...7086ec7866ce582b
  28. \_________________________________/
  29. +-> RSAKEYLEN bits totally random string S1,
  30. encrypted with server's public RSA key
  31. server META_KEY 6ab9c1640388f8f0...45d1a07f8a672630
  32. \_________________________________/
  33. +-> RSAKEYLEN bits totally random string S2,
  34. encrypted with client's public RSA key
  35. From now on:
  36. - the client will symmetrically encrypt outgoing traffic using S1
  37. - the server will symmetrically encrypt outgoing traffic using S2
  38. client CHALLENGE da02add1817c1920989ba6ae2a49cecbda0
  39. \_________________________________/
  40. +-> CHALLEN bits totally random string H1
  41. server CHALLENGE 57fb4b2ccd70d6bb35a64c142f47e61d57f
  42. \_________________________________/
  43. +-> CHALLEN bits totally random string H2
  44. client CHAL_REPLY 816a86
  45. +-> 160 bits SHA1 of H2
  46. server CHAL_REPLY 928ffe
  47. +-> 160 bits SHA1 of H1
  48. After the correct challenge replies are recieved, both ends have proved
  49. their identity. Further information is exchanged.
  50. client ACK 655 123 0
  51. | | +-> options
  52. | +----> estimated weight
  53. +--------> listening port of client
  54. server ACK 655 321 0
  55. | | +-> options
  56. | +----> estimated weight
  57. +--------> listening port of server
  58. --------------------------------------------------------------------------
  59. This new scheme has several improvements, both in efficiency and security.
  60. First of all, the server sends exactly the same kind of messages over the wire
  61. as the client. The previous versions of tinc first authenticated the client,
  62. and then the server. This scheme even allows both sides to send their messages
  63. simultaneously, there is no need to wait for the other to send something first.
  64. This means that any calculations that need to be done upon sending or receiving
  65. a message can also be done in parallel. This is especially important when doing
  66. RSA encryption/decryption. Given that these calculations are the main part of
  67. the CPU time spent for the authentication, speed is improved by a factor 2.
  68. Second, only one RSA encrypted message is sent instead of two. This reduces the
  69. amount of information attackers can see (and thus use for a crypto attack). It
  70. also improves speed by a factor two, making the total speedup a factor 4.
  71. Third, and most important:
  72. The symmetric cipher keys are exchanged first, the challenge is done
  73. afterwards. In the previous authentication scheme, because a man-in-the-middle
  74. could pass the challenge/chal_reply phase (by just copying the messages between
  75. the two real tinc daemons), but no information was exchanged that was really
  76. needed to read the rest of the messages, the challenge/chal_reply phase was of
  77. no real use. The man-in-the-middle was only stopped by the fact that only after
  78. the ACK messages were encrypted with the symmetric cipher. Potentially, it
  79. could even send it's own symmetric key to the server (if it knew the server's
  80. public key) and read some of the metadata the server would send it (it was
  81. impossible for the mitm to read actual network packets though). The new scheme
  82. however prevents this.
  83. This new scheme makes sure that first of all, symmetric keys are exchanged. The
  84. rest of the messages are then encrypted with the symmetric cipher. Then, each
  85. side can only read received messages if they have their private key. The
  86. challenge is there to let the other side know that the private key is really
  87. known, because a challenge reply can only be sent back if the challenge is
  88. decrypted correctly, and that can only be done with knowledge of the private
  89. key.
  90. Fourth: the first thing that is send via the symmetric cipher encrypted
  91. connection is a totally random string, so that there is no known plaintext (for
  92. an attacker) in the beginning of the encrypted stream.
  93. Some things to be discussed:
  94. - What should CHALLEN be? Same as RSAKEYLEN? 256 bits? More/less?