xxx-what-uses-sha1.txt 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. Filename: xxx-what-uses-sha1.txt
  2. Title: Where does Tor use SHA-1 today?
  3. Authors: Nick Mathewson, Marian
  4. Created: 30-Dec-2008
  5. Status: Meta
  6. Introduction:
  7. Tor uses SHA-1 as a message digest. SHA-1 is showing its age:
  8. theoretical attacks for finding collisions against it get better
  9. every year or two, and it will likely be broken in practice before
  10. too long.
  11. According to smart crypto people, the SHA-2 functions (SHA-256, etc)
  12. share too much of SHA-1's structure to be very good. RIPEMD-160 is
  13. also based on flawed past hashes. Some people think other hash
  14. functions (e.g. Whirlpool and Tiger) are not as bad; most of these
  15. have not seen enough analysis to be used yet.
  16. Here is a 2006 paper about hash algorithms.
  17. http://www.sane.nl/sane2006/program/final-papers/R10.pdf
  18. (Todo: Ask smart crypto people.)
  19. By 2012, the NIST SHA-3 competition will be done, and with luck we'll
  20. have something good to switch too. But it's probably a bad idea to
  21. wait until 2012 to figure out _how_ to migrate to a new hash
  22. function, for two reasons:
  23. 1) It's not inconceivable we'll want to migrate in a hurry
  24. some time before then.
  25. 2) It's likely that migrating to a new hash function will
  26. require protocol changes, and it's easiest to make protocol
  27. changes backward compatible if we lay the groundwork in
  28. advance. It would suck to have to break compatibility with
  29. a big hard-to-test "flag day" protocol change.
  30. This document attempts to list everything Tor uses SHA-1 for today.
  31. This is the first step in getting all the design work done to switch
  32. to something else.
  33. This document SHOULD NOT be a clearinghouse of what to do about our
  34. use of SHA-1. That's better left for other individual proposals.
  35. Why now?
  36. The recent publication of "MD5 considered harmful today: Creating a
  37. rogue CA certificate" by Alexander Sotirov, Marc Stevens, Jacob
  38. Appelbaum, Arjen Lenstra, David Molnar, Dag Arne Osvik, and Benne de
  39. Weger has reminded me that:
  40. * You can't rely on theoretical attacks to stay theoretical.
  41. * It's quite unpleasant when theoretical attacks become practical
  42. and public on days you were planning to leave for vacation.
  43. * Broken hash functions (which SHA-1 is not quite yet AFAIU)
  44. should be dropped like hot potatoes. Failure to do so can make
  45. one look silly.
  46. Triage
  47. How severe are these problems? Let's divide them into these
  48. categories:
  49. PREIMAGE -- A SHA-1 usage that only depends on preimage
  50. resistance
  51. COLLISION<role> -- A SHA-1 usage that depends on collision
  52. resistance, but the only party who could mount a
  53. collision-based attack is already in a trusted role
  54. (like a distribution signer or a directory authority).
  55. COLLISION -- A SHA-1 usage that depends on collision resistance
  56. and doesn't need the attacker to have any special keys.
  57. There is no need to put much effort into fixing PREIMAGE usages in
  58. the near-term: even _MD5_ is still preimage resistant. To fix
  59. COLLISION<code-signing> usages is not too important either, since
  60. anyone who has the key to sign the code can mount far worse
  61. attacks. It would be good to fix COLLISION<authority> usages,
  62. since we try to resist. The COLLISION usages are the most
  63. important to fix.
  64. Additionally, we need to consider the impact of a successful attack
  65. in each of these cases. SHA-1 collisions are still expensive even
  66. if recent results are verified, and anybody with the resources to
  67. compute one also has the resources to mount a decent Sybil attack.
  68. Let be pessimistic, and not assume that producing collisions of a given
  69. format is actually any harder than producing collisions at all.
  70. What Tor uses hashes for today:
  71. 1. Infrastructure.
  72. A. Our X.509 certificates are signed with SHA-1.
  73. COLLSION
  74. B. TLS uses SHA-1 (and MD5) internally to generate keys.
  75. PREIMAGE?
  76. C. Some of the TLS ciphersuites we allow use SHA-1.
  77. PREIMAGE?
  78. D. When we sign our code with GPG, it might be using SHA-1.
  79. COLLISION<code-signing>
  80. E. Our GPG keys might be authenticated with SHA-1.
  81. COLLISION<code-signing-key-signing>
  82. F. OpenSSL's random number generator uses SHA-1, I believe.
  83. PREIMAGE
  84. 2. The Tor protocol
  85. A. Everything we sign, we sign using SHA-1-based OAEP-MGF1.
  86. PREIMAGE?
  87. B. Our CREATE cell format uses SHA-1 for: OAEP padding.
  88. PREIMAGE?
  89. C. Our EXTEND cells use SHA-1 to hash the identity key of the
  90. target server.
  91. COLLISION
  92. D. Our CREATED cells use SHA-1 to hash the derived key data.
  93. ??
  94. E. The data we use in CREATE_FAST cells to generate a key is the
  95. length of a SHA-1.
  96. NONE
  97. F. The data we send back in a CREATED/CREATED_FAST cell is the length
  98. of a SHA-1.
  99. NONE
  100. G. We use SHA-1 to derive our circuit keys from the negotiated g^xy
  101. value.
  102. NONE
  103. H. We use SHA-1 to derive the digest field of each RELAY cell, but that's
  104. used more as a checksum than as a strong digest.
  105. NONE
  106. 3. Directory services
  107. [All are COLLISION or COLLISION<authority> ]
  108. A. All signatures are generated on the SHA-1 of their corresponding
  109. documents, using PKCS1 padding.
  110. * In dir-spec.txt, section 1.3, it states,
  111. "SIGNATURE" Object contains a signature (using the signing key)
  112. of the PKCS1-padded digest of the entire document, taken from
  113. the beginning of the Initial item, through the newline after
  114. the Signature Item's keyword and its arguments."
  115. So our attacker, Malcom, could generate a collision for the hash
  116. that is signed. Thus, a second pre-image attack is possible.
  117. Vulnerable to regular collision attack only if key is stolen.
  118. If the key is stolen, Malcom could distribute two different
  119. copies of the document which have the same hash. Maybe useful
  120. for a partitioning attack?
  121. B. Router descriptors identify their corresponding extra-info documents
  122. by their SHA-1 digest.
  123. * A third party might use a second pre-image attack to generate a
  124. false extra-info document that has the same hash. The router
  125. itself might use a regular collision attack to generate multiple
  126. extra-info documents with the same hash, which might be useful
  127. for a partitioning attack.
  128. C. Fingerprints in router descriptors are taken using SHA-1.
  129. * The fingerprint must match the public key. Not sure what would
  130. happen if two routers had different public keys but the same
  131. fingerprint. There could perhaps be unpredictable behaviour.
  132. D. In router descriptors, routers in the same "Family" may be listed
  133. by server nicknames or hexdigests.
  134. * Does not seem critical.
  135. E. Fingerprints in authority certs are taken using SHA-1.
  136. F. Fingerprints in dir-source lines of votes and consensuses are taken
  137. using SHA-1.
  138. G. Networkstatuses refer to routers identity keys and descriptors by their
  139. SHA-1 digests.
  140. H. Directory-signature lines identify which key is doing the signing by
  141. the SHA-1 digests of the authority's signing key and its identity key.
  142. I. The following items are downloaded by the SHA-1 of their contents:
  143. XXXX list them
  144. J. The following items are downloaded by the SHA-1 of an identity key:
  145. XXXX list them too.
  146. 4. The rendezvous protocol
  147. A. Hidden servers use SHA-1 to establish introduction points on relays,
  148. and relays use SHA-1 to check incoming introduction point
  149. establishment requests.
  150. B. Hidden servers use SHA-1 in multiple places when generating hidden
  151. service descriptors.
  152. C. Hidden servers performing basic-type client authorization for their
  153. services use SHA-1 when encrypting introduction points contained in
  154. hidden service descriptors.
  155. D. Hidden service directories use SHA-1 to check whether a given hidden
  156. service descriptor may be published under a given descriptor
  157. identifier or not.
  158. E. Hidden servers use SHA-1 to derive .onion addresses of their
  159. services.
  160. F. Clients use SHA-1 to generate the current hidden service descriptor
  161. identifiers for a given .onion address.
  162. G. Hidden servers use SHA-1 to remember digests of the first parts of
  163. Diffie-Hellman handshakes contained in introduction requests in order
  164. to detect replays.
  165. H. Hidden servers use SHA-1 during the Diffie-Hellman key exchange with
  166. a connecting client.
  167. 5. The bridge protocol
  168. XXXX write me
  169. 6. The Tor user interface
  170. A. We log information about servers based on SHA-1 hashes of their
  171. identity keys.
  172. COLLISION
  173. B. The controller identifies servers based on SHA-1 hashes of their
  174. identity keys.
  175. COLLISION
  176. C. Nearly all of our configuration options that list servers allow SHA-1
  177. hashes of their identity keys.
  178. COLLISION
  179. E. The deprecated .exit notation uses SHA-1 hashes of identity keys
  180. COLLISION