105-handshake-revision.txt 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. Overview:
  8. This document was extracted from a modified version of tor-spec.txt that we
  9. had written before the proposal system went into place. It adds two new
  10. cells types to the Tor link connection setup handshake: one used for
  11. version negotiation, and another to prevent MITM attacks.
  12. This is an open proposal.
  13. Proposal:
  14. 1.0. Version numbers
  15. The node-to-node TLS-based "OR connection" protocol and the multi-hop
  16. "circuit" protocol are versioned quasi-independently. (Certain versions
  17. of the circuit protocol may require a minimum version of the connection
  18. protocol to be used.)
  19. Version numbers are incremented for backward-incompatible protocol changes
  20. only. Backward-compatible changes are generally implemented by adding
  21. additional fields to existing structures; implementations MUST ignore
  22. fields they do not expect.
  23. 2.1. VERSIONS cells
  24. When a Tor connection is established, both parties normally send a
  25. VERSIONS cell before sending any other cells. (But see below.)
  26. NumVersions [1 byte]
  27. Versions [NumVersions bytes]
  28. "Versions" is a sequence of NumVersions link connection protocol versions,
  29. each one byte long. Parties should list all of the versions which they
  30. are able and willing to support. Parties can only communicate if they
  31. have some connection protocol version in common.
  32. Version 0.1.x.y-alpha and earlier don't understand VERSIONS cells,
  33. and therefore don't support version negotiation. Thus, waiting until
  34. the other side has sent a VERSIONS cell won't work for these servers:
  35. if they send no cells back, it is impossible to tell whether they
  36. have sent a VERSIONS cell that has been stalled, or whether they have
  37. dropped our own VERSIONS cell as unrecognized. Thus, immediately after
  38. a TLS connection has been established, the parties check whether the
  39. other side has an obsolete certificate (organizationName equal to "Tor"
  40. or "TOR"). If the other party presented an obsolete certificate,
  41. we assume a v1 connection. Otherwise, both parties send VERSIONS
  42. cells listing all their supported versions. Upon receiving the
  43. other party's VERSIONS cell, the implementation begins using the
  44. highest-valued version common to both cells. If the first cell from
  45. the other party is _not_ a VERSIONS cell, we assume a v1 protocol.
  46. Implementations MUST discard cells that are not the first cells sent on a
  47. connection.
  48. 2.2. MITM-prevention and time checking
  49. If we negotiate a v2 connection or higher, the first cell we send SHOULD
  50. be a NETINFO cell. Implementations SHOULD NOT send NETINFO cells at other
  51. times.
  52. A NETINFO cell contains:
  53. Timestamp [4 bytes]
  54. This OR's address [variable]
  55. Other OR's address [variable]
  56. Timestamp is the OR's current Unix time, in seconds since the epoch. If
  57. an implementation receives time values from many validated ORs that
  58. indicate that its clock is skewed, it SHOULD try to warn the
  59. administrator.
  60. Each address contains Type/Length/Value as used in Section 6.4. The first
  61. address is the address of the interface the party sending the VERSIONS cell
  62. used to connect to or accept connections from the other -- we include it
  63. to block a man-in-the-middle attack on TLS that lets an attacker bounce
  64. traffic through his own computers to enable timing and packet-counting
  65. attacks.
  66. The second address is the one that the party sending the VERSIONS cell
  67. believes the other has -- it can be used to learn what your IP address
  68. is if you have no other hints.