124-tls-certificates.txt 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. Filename: 124-tls-certificates.txt
  2. Title: Blocking resistant TLS certificate usage
  3. Author: Steven J. Murdoch
  4. Created: 2007-10-25
  5. Status: Superseded
  6. Overview:
  7. To be less distinguishable from HTTPS web browsing, only Tor servers should
  8. present TLS certificates. This should be done whilst maintaining backwards
  9. compatibility with Tor nodes which present and expect client certificates, and
  10. while preserving existing security properties. This specification describes
  11. the negotiation protocol, what certificates should be presented during the TLS
  12. negotiation, and how to move the client authentication within the encrypted
  13. tunnel.
  14. Motivation:
  15. In Tor's current TLS [1] handshake, both client and server present a
  16. two-certificate chain. Since TLS performs authentication prior to establishing
  17. the encrypted tunnel, the contents of these certificates are visible to an
  18. eavesdropper. In contrast, during normal HTTPS web browsing, the server
  19. presents a single certificate, signed by a root CA and the client presents no
  20. certificate. Hence it is possible to distinguish Tor from HTTP by identifying
  21. this pattern.
  22. To resist blocking based on traffic identification, Tor should behave as close
  23. to HTTPS as possible, i.e. servers should offer a single certificate and not
  24. request a client certificate; clients should present no certificate. This
  25. presents two difficulties: clients are no longer authenticated and servers are
  26. authenticated by the connection key, rather than identity key. The link
  27. protocol must thus be modified to preserve the old security semantics.
  28. Finally, in order to maintain backwards compatibility, servers must correctly
  29. identify whether the client supports the modified certificate handling. This
  30. is achieved by modifying the cipher suites that clients advertise support
  31. for. These cipher suites are selected to be similar to those chosen by web
  32. browsers, in order to resist blocking based on client hello.
  33. Terminology:
  34. Initiator: OP or OR which initiates a TLS connection ("client" in TLS
  35. terminology)
  36. Responder: OR which receives an incoming TLS connection ("server" in TLS
  37. terminology)
  38. Version negotiation and cipher suite selection:
  39. In the modified TLS handshake, the responder does not request a certificate
  40. from the initiator. This request would normally occur immediately after the
  41. responder receives the client hello (the first message in a TLS handshake) and
  42. so the responder must decide whether to request a certificate based only on
  43. the information in the client hello. This is achieved by examining the cipher
  44. suites in the client hello.
  45. List 1: cipher suites lists offered by version 0/1 Tor
  46. From src/common/tortls.c, revision 12086:
  47. TLS1_TXT_DHE_RSA_WITH_AES_128_SHA
  48. TLS1_TXT_DHE_RSA_WITH_AES_128_SHA : SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA
  49. SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA
  50. Client hello sent by initiator:
  51. Initiators supporting version 2 of the Tor connection protocol MUST
  52. offer a different cipher suite list from those sent by pre-version 2
  53. Tors, contained in List 1. To maintain compatibility with older Tor
  54. versions and common browsers, the cipher suite list MUST include
  55. support for:
  56. TLS_DHE_RSA_WITH_AES_256_CBC_SHA
  57. TLS_DHE_RSA_WITH_AES_128_CBC_SHA
  58. SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA
  59. SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA
  60. Client hello received by responder/server hello sent by responder:
  61. Responders supporting version 2 of the Tor connection protocol should compare
  62. the cipher suite list in the client hello with those in List 1. If it matches
  63. any in the list then the responder should assume that the initiatior supports
  64. version 1, and thus should maintain the version 1 behavior, i.e. send a
  65. two-certificate chain, request a client certificate and do not send or expect
  66. a VERSIONS cell [2].
  67. Otherwise, the responder should assume version 2 behavior and select a cipher
  68. suite following TLS [1] behavior, i.e. select the first entry from the client
  69. hello cipher list which is acceptable. Responders MUST NOT select any suite
  70. that lacks ephemeral keys, or whose symmetric keys are less then KEY_LEN bits,
  71. or whose digests are less than HASH_LEN bits. Implementations SHOULD NOT
  72. allow other SSLv3 ciphersuites.
  73. Should no mutually acceptable cipher suite be found, the connection MUST be
  74. closed.
  75. If the responder is implementing version 2 of the connection protocol it
  76. SHOULD send a server certificate with random contents. The organizationName
  77. field MUST NOT be "Tor", "TOR" or "t o r".
  78. Server certificate received by initiator:
  79. If the server certificate has an organizationName of "Tor", "TOR" or "t o r",
  80. the initiator should assume that the responder does not support version 2 of
  81. the connection protocol. In which case the initiator should respond following
  82. version 1, i.e. send a two-certificate client chain and do not send or expect
  83. a VERSIONS cell.
  84. [SJM: We could also use the fact that a client certificate request was sent]
  85. If the server hello contains a ciphersuite which does not comply with the key
  86. length requirements above, even if it was one offered in the client hello, the
  87. connection MUST be closed. This will only occur if the responder is not a Tor
  88. server.
  89. Backward compatibility:
  90. v1 Initiator, v1 Responder: No change
  91. v1 Initiator, v2 Responder: Responder detects v1 initiator by client hello
  92. v2 Initiator, v1 Responder: Responder accepts v2 client hello. Initiator
  93. detects v1 server certificate and continues with v1 protocol
  94. v2 Initiator, v2 Responder: Responder accepts v2 client hello. Initiator
  95. detects v2 server certificate and continues with v2 protocol.
  96. Additional link authentication process:
  97. Following VERSION and NETINFO negotiation, both responder and
  98. initiator MUST send a certification chain in a CERT cell. If one
  99. party does not have a certificate, the CERT cell MUST still be sent,
  100. but with a length of zero.
  101. A CERT cell is a variable length cell, of the format
  102. CircID [2 bytes]
  103. Command [1 byte]
  104. Length [2 bytes]
  105. Payload [<length> bytes]
  106. CircID MUST set to be 0x0000
  107. Command is [SJM: TODO]
  108. Length is the length of the payload
  109. Payload contains 0 or more certificates, each is of the format:
  110. Cert_Length [2 bytes]
  111. Certificate [<cert_length> bytes]
  112. Each certificate MUST sign the one preceding it. The initator MUST
  113. place its connection certificate first; the responder, having
  114. already sent its connection certificate as part of the TLS handshake
  115. MUST place its identity certificate first.
  116. Initiators who send a CERT cell MUST follow that with an LINK_AUTH
  117. cell to prove that they posess the corresponding private key.
  118. A LINK_AUTH cell is fixed-lenth, of the format:
  119. CircID [2 bytes]
  120. Command [1 byte]
  121. Length [2 bytes]
  122. Payload (padded with 0 bytes) [PAYLOAD_LEN - 2 bytes]
  123. CircID MUST set to be 0x0000
  124. Command is [SJM: TODO]
  125. Length is the valid portion of the payload
  126. Payload is of the format:
  127. Signature version [1 byte]
  128. Signature [<length> - 1 bytes]
  129. Padding [PAYLOAD_LEN - <length> - 2 bytes]
  130. Signature version: Identifies the type of signature, currently 0x00
  131. Signature: Digital signature under the initiator's connection key of the
  132. following item, in PKCS #1 block type 1 [3] format:
  133. HMAC-SHA1, using the TLS master secret as key, of the
  134. following elements concatenated:
  135. - The signature version (0x00)
  136. - The NUL terminated ASCII string: "Tor initiator certificate verification"
  137. - client_random, as sent in the Client Hello
  138. - server_random, as sent in the Server Hello
  139. - SHA-1 hash of the initiator connection certificate
  140. - SHA-1 hash of the responder connection certificate
  141. Security checks:
  142. - Before sending a LINK_AUTH cell, a node MUST ensure that the TLS
  143. connection is authenticated by the responder key.
  144. - For the handshake to have succeeded, the initiator MUST confirm:
  145. - That the TLS handshake was authenticated by the
  146. responder connection key
  147. - That the responder connection key was signed by the first
  148. certificate in the CERT cell
  149. - That each certificate in the CERT cell was signed by the
  150. following certificate, with the exception of the last
  151. - That the last certificate in the CERT cell is the expected
  152. identity certificate for the node being connected to
  153. - For the handshake to have succeeded, the responder MUST confirm
  154. either:
  155. A) - A zero length CERT cell was sent and no LINK_AUTH cell was
  156. sent
  157. In which case the responder shall treat the identity of the
  158. initiator as unknown
  159. or
  160. B) - That the LINK_AUTH MAC contains a signature by the first
  161. certificate in the CERT cell
  162. - That the MAC signed matches the expected value
  163. - That each certificate in the CERT cell was signed by the
  164. following certificate, with the exception of the last
  165. In which case the responder shall treat the identity of the
  166. initiator as that of the last certificate in the CERT cell
  167. Protocol summary:
  168. 1. I(nitiator) <-> R(esponder): TLS handshake, including responder
  169. authentication under connection certificate R_c
  170. 2. I <->: VERSION and NETINFO negotiation
  171. 3. R -> I: CERT (Responder identity certificate R_i (which signs R_c))
  172. 4. I -> R: CERT (Initiator connection certificate I_c,
  173. Initiator identity certificate I_i (which signs I_c)
  174. 5. I -> R: LINK_AUTH (Signature, under I_c of HMAC-SHA1(master_secret,
  175. "Tor initiator certificate verification" ||
  176. client_random || server_random ||
  177. I_c hash || R_c hash)
  178. Notes: I -> R doesn't need to wait for R_i before sending its own
  179. messages (reduces round-trips).
  180. Certificate hash is calculated like identity hash in CREATE cells.
  181. Initiator signature is calculated in a similar way to Certificate
  182. Verify messages in TLS 1.1 (RFC4346, Sections 7.4.8 and 4.7).
  183. If I is an OP, a zero length certificate chain may be sent in step 4;
  184. In which case, step 5 is not performed
  185. Rationale:
  186. - Version and netinfo negotiation before authentication: The version cell needs
  187. to come before before the rest of the protocol, since we may choose to alter
  188. the rest at some later point, e.g switch to a different MAC/signature scheme.
  189. It is useful to keep the NETINFO and VERSION cells close to each other, since
  190. the time between them is used to check if there is a delay-attack. Still, a
  191. server might want to not act on NETINFO data from an initiator until the
  192. authentication is complete.
  193. Appendix A: Cipher suite choices
  194. This specification intentionally does not put any constraints on the
  195. TLS ciphersuite lists presented by clients, other than a minimum
  196. required for compatibility. However, to maximize blocking
  197. resistance, ciphersuite lists should be carefully selected.
  198. Recommended client ciphersuite list
  199. Source: http://lxr.mozilla.org/security/source/security/nss/lib/ssl/sslproto.h
  200. 0xc00a: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
  201. 0xc014: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
  202. 0x0039: TLS_DHE_RSA_WITH_AES_256_CBC_SHA
  203. 0x0038: TLS_DHE_DSS_WITH_AES_256_CBC_SHA
  204. 0xc00f: TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
  205. 0xc005: TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
  206. 0x0035: TLS_RSA_WITH_AES_256_CBC_SHA
  207. 0xc007: TLS_ECDHE_ECDSA_WITH_RC4_128_SHA
  208. 0xc009: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
  209. 0xc011: TLS_ECDHE_RSA_WITH_RC4_128_SHA
  210. 0xc013: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
  211. 0x0033: TLS_DHE_RSA_WITH_AES_128_CBC_SHA
  212. 0x0032: TLS_DHE_DSS_WITH_AES_128_CBC_SHA
  213. 0xc00c: TLS_ECDH_RSA_WITH_RC4_128_SHA
  214. 0xc00e: TLS_ECDH_RSA_WITH_AES_128_CBC_SHA
  215. 0xc002: TLS_ECDH_ECDSA_WITH_RC4_128_SHA
  216. 0xc004: TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
  217. 0x0004: SSL_RSA_WITH_RC4_128_MD5
  218. 0x0005: SSL_RSA_WITH_RC4_128_SHA
  219. 0x002f: TLS_RSA_WITH_AES_128_CBC_SHA
  220. 0xc008: TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA
  221. 0xc012: TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
  222. 0x0016: SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA
  223. 0x0013: SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA
  224. 0xc00d: TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA
  225. 0xc003: TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA
  226. 0xfeff: SSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA (168-bit Triple DES with RSA and a SHA1 MAC)
  227. 0x000a: SSL_RSA_WITH_3DES_EDE_CBC_SHA
  228. Order specified in:
  229. http://lxr.mozilla.org/security/source/security/nss/lib/ssl/sslenum.c#47
  230. Recommended options:
  231. 0x0000: Server Name Indication [4]
  232. 0x000a: Supported Elliptic Curves [5]
  233. 0x000b: Supported Point Formats [5]
  234. Recommended compression:
  235. 0x00
  236. Recommended server ciphersuite selection:
  237. The responder should select the first entry in this list which is
  238. listed in the client hello:
  239. 0x0039: TLS_DHE_RSA_WITH_AES_256_CBC_SHA [ Common Firefox choice ]
  240. 0x0033: TLS_DHE_RSA_WITH_AES_128_CBC_SHA [ Tor v1 default ]
  241. 0x0016: SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA [ Tor v1 fallback ]
  242. 0x0013: SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA [ Valid IE option ]
  243. References:
  244. [1] The Transport Layer Security (TLS) Protocol, Version 1.1, RFC4346, IETF
  245. [2] Version negotiation for the Tor protocol, Tor proposal 105
  246. [3] B. Kaliski, "Public-Key Cryptography Standards (PKCS) #1:
  247. RSA Cryptography Specifications Version 1.5", RFC 2313,
  248. March 1998.
  249. [4] TLS Extensions, RFC 3546
  250. [5] Elliptic Curve Cryptography (ECC) Cipher Suites for Transport Layer Security (TLS)
  251. % <!-- Local IspellDict: american -->