xxx-what-uses-sha1.txt 7.3 KB

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