105-handshake-revision.txt 3.8 KB

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