105-handshake-revision.txt 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. Filename: 105-handshake-revision.txt
  2. Title: Version negotiation for the Tor protocol.
  3. Version: $Revision$
  4. Last-Modified: $Date$
  5. Author: Nick Mathewson, Roger Dingledine
  6. Created:
  7. Status: Open
  8. Overview:
  9. This document was extracted from a modified version of tor-spec.txt that we
  10. had written before the proposal system went into place. It adds two new
  11. cells types to the Tor link connection setup handshake: one used for
  12. version negotiation, and another to prevent MITM attacks.
  13. This is an open proposal.
  14. Motivation:
  15. Our *current* approach to versioning the Tor protocol(s) has been as
  16. follows:
  17. - All changes must be backward compatible.
  18. - It's okay to add new cell types, if they would be ignored by previous
  19. versions of Tor.
  20. - It's okay to add new data elements to cells, if they would have been
  21. ignored by previous versions of Tor.
  22. - For forward compatibility, Tor must ignore cell types it doesn't
  23. recognize, and ignore data in those cells it doesn't expect.
  24. - Clients can inspect the version of Tor declared in the platform line
  25. of a router's descriptor, and use that to learn whether a server
  26. supports a given feature. Servers, however, aren't assumed to all
  27. know about each other, and so don't know the version of who they're
  28. talking to.
  29. This system has these problems:
  30. - It's very hard to change fundamental aspects of the protocol, like the
  31. cell format, the link protocol, any of the various encryption schemes,
  32. and so on.
  33. - The router-to-router link protocol has remained more-or-less frozen
  34. for a long time, since we can't easily have an OR use new features
  35. unless it knows the other OR will understand them.
  36. We need to resolve these problems because:
  37. - Our cipher suite is showing its age: SHA1/AES128/RSA1024/DH1024 will
  38. not seem like the best idea for all time.
  39. - There are many ideas circulating for multiple cell sizes; while it's
  40. not obvious whether these are safe, we can't do them at all without a
  41. mechanism to permit them.
  42. - There are many ideas circulating for alternative cell relay rules:
  43. they don't work unless they can coexist in the current network.
  44. - If our protocol changes a lot, it's hard to describe any coherent
  45. version of it: we need to say "the version that Tor versions W through
  46. X use when talking to versions Y through Z". This makes analysis
  47. harder.
  48. Proposal:
  49. 1.0. Version numbers
  50. The node-to-node TLS-based "OR connection" protocol and the multi-hop
  51. "circuit" protocol are versioned quasi-independently. (Certain versions
  52. of the circuit protocol may require a minimum version of the connection
  53. protocol to be used.)
  54. Version numbers are incremented for backward-incompatible protocol changes
  55. only. Backward-compatible changes are generally implemented by adding
  56. additional fields to existing structures; implementations MUST ignore
  57. fields they do not expect.
  58. 2.1. VERSIONS cells
  59. When a Tor connection is established, both parties normally send a
  60. VERSIONS cell before sending any other cells. (But see below.)
  61. NumVersions [1 byte]
  62. Versions [NumVersions bytes]
  63. "Versions" is a sequence of NumVersions link connection protocol versions,
  64. each one byte long. Parties should list all of the versions which they
  65. are able and willing to support. Parties can only communicate if they
  66. have some connection protocol version in common.
  67. Version 0.1.x.y-alpha and earlier don't understand VERSIONS cells,
  68. and therefore don't support version negotiation. Thus, waiting until
  69. the other side has sent a VERSIONS cell won't work for these servers:
  70. if they send no cells back, it is impossible to tell whether they
  71. have sent a VERSIONS cell that has been stalled, or whether they have
  72. dropped our own VERSIONS cell as unrecognized. Thus, immediately after
  73. a TLS connection has been established, the parties check whether the
  74. other side has an obsolete certificate (organizationName equal to "Tor"
  75. or "TOR"). If the other party presented an obsolete certificate,
  76. we assume a v1 connection. Otherwise, both parties send VERSIONS
  77. cells listing all their supported versions. Upon receiving the
  78. other party's VERSIONS cell, the implementation begins using the
  79. highest-valued version common to both cells. If the first cell from
  80. the other party is _not_ a VERSIONS cell, we assume a v1 protocol.
  81. Implementations MUST discard cells that are not the first cells sent on a
  82. connection.
  83. 2.2. MITM-prevention and time checking
  84. If we negotiate a v2 connection or higher, the first cell we send SHOULD
  85. be a NETINFO cell. Implementations SHOULD NOT send NETINFO cells at other
  86. times.
  87. A NETINFO cell contains:
  88. Timestamp [4 bytes]
  89. This OR's address [variable]
  90. Other OR's address [variable]
  91. Timestamp is the OR's current Unix time, in seconds since the epoch. If
  92. an implementation receives time values from many validated ORs that
  93. indicate that its clock is skewed, it SHOULD try to warn the
  94. administrator.
  95. Each address contains Type/Length/Value as used in Section 6.4. The first
  96. address is the address of the interface the party sending the VERSIONS cell
  97. used to connect to or accept connections from the other -- we include it
  98. to block a man-in-the-middle attack on TLS that lets an attacker bounce
  99. traffic through his own computers to enable timing and packet-counting
  100. attacks.
  101. The second address is the one that the party sending the VERSIONS cell
  102. believes the other has -- it can be used to learn what your IP address
  103. is if you have no other hints.