121-hidden-service-authentication.txt 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. Filename: 121-hidden-service-authentication.txt
  2. Title: Hidden Service Authentication
  3. Version: $LastChangedRevision$
  4. Last-Modified: $LastChangedDate$
  5. Author: Tobias Kamm, Thomas Lauterbach, Karsten Loesing, Ferdinand Rieger,
  6. Christoph Weingarten
  7. Created: 10-Sep-2007
  8. Status: Open
  9. Change history:
  10. 26-Sep-2007 Initial proposal for or-dev
  11. 08-Dec-2007 Incorporated comments by Nick posted to or-dev on 10-Oct-2007
  12. Overview:
  13. This proposal deals with some possibilities to implement authentication
  14. for restricted access to hidden services. This way we try to increase the
  15. security level for the service provider (Bob) by giving him the ability
  16. to exclude non-authorized users from using his service. It is based on
  17. proposal 114-distributed-storage but is better suited for a fine grained
  18. way of authentication, because it is less resource-consuming. Whenever we
  19. refer to service descriptors and cell formats, we are talking about the
  20. definitions found in 114-distributed-storage unless otherwise stated.
  21. We discuss password and public-key authentication for the Onion Proxy
  22. (OP) of Bob's hidden service (HS). Furthermore a challenge-response
  23. authentication mechanism is introduced at the introduction point.
  24. These modifications aim at:
  25. - increasing the security of hidden services by limiting access only to
  26. authorized users (specification see details) and
  27. - reducing the traffic in the network by rejecting unauthorized access
  28. requests earlier.
  29. Motivation:
  30. The currently used implementation of hidden services does not provide any
  31. kind of authentication. The v2 implementation adds an authentication
  32. mechanism at the directory server. Security can be further improved by
  33. adding two more authentication authorities at the introduction point
  34. (IPo) and the OP.
  35. Although the service descriptors are already designed to carry
  36. authentication information the existing fields are not used so far.
  37. Moreover one can find a couple of notes at the specification of cell
  38. formats (rend-spec) which point at adding authentication information but
  39. no fields are specified yet. It would be preferable to extend the Tor
  40. network with authentication features to offer a solution for all
  41. services. This would also provide means to authorize access to services
  42. that currently do not support authentication mechanisms. Moreover, Bob's
  43. authentication administration for all services could be performed
  44. centralized in the Tor application, and the implementation overhead for
  45. developers would be significantly reduced. Another benefit would be the
  46. reduced traffic by checking authentication data and dropping unauthorized
  47. requests as soon as possible. For example unauthorized requests could
  48. already be discarded at the introduction points.
  49. In addition to that, our implementation is able to hide the service from
  50. users, who still have access to the secret cookie (see
  51. 114-distributed-storage) but should no longer be authorized. Bob can now
  52. not only hide his location, but also to a certain degree his presence
  53. towards unauthorized clients given that none of his IPo's are corrupted.
  54. Details:
  55. [XXX Restructure this section in separate patch:
  56. A) The general mechanisms to perform authentication at three
  57. authentication points (directory, service, introduction point)
  58. B) A specific authentication protocol based on secret cookies. -KL]
  59. [XXX Describe use of descriptor cookie as "/0/ Client authentication at
  60. directory". Optional encryption/decryption using a descriptor cookie is
  61. understood since proposal 114, but not used by servers and clients. -KL]
  62. /1/ Client authentication at the hidden service
  63. In proposal 114 a client (Alice) who has a valid secret cookie, which may
  64. be considered as a form of authentication, and a service ID is able to
  65. connect to Bob if he is online. He can not distinguish between Alice
  66. being intentionally authorized by himself or being an attacker.
  67. Integrating authentication in Tor HS will ensure Bob that Alice is only
  68. able to use the service if she is authorized by him.
  69. Authentication data will be transmitted via the RELAY_INTRODUCE1 cell
  70. from Alice to Bob that is forwarded by the IPo. For this message several
  71. format versions are specified in the rend-spec in section 1.8. We will
  72. use the format version 3, which is specified, but not implemented by
  73. December 2007. This specification already contains the fields
  74. "AUTHT" (to specify the authentication method), "AUTHL" (length of the
  75. authentication data), and "AUTHD" (the authentication data) that will be
  76. used to store authentication data. Since these fields are encrypted with
  77. the service's public key, sniffing attacks will fail. Bob will only build
  78. the circuit to the rendezvous point if the provided authentication data
  79. is valid, otherwise he will drop the cell. This will improve security due
  80. to preventing communication between Bob and Alice if she is an attacker.
  81. Especially, it prevents the attack described by Øverlier and Syverson in
  82. their paper "Locating Hidden Servers", even without the need for guards.
  83. As a positive side effect it reduces network traffic because it avoids
  84. Bob from building unnecessary circuits to the rendezvous points.
  85. Authentication at the HS should be the last gatekeeper and the number of
  86. cases in which a client successfully passes the introduction point, but
  87. fails at the HS should be almost zero. Therefore it is very important to
  88. perform fine-grained access control already at the IPo (but without
  89. relying on it).
  90. The first authentication mechanism that will be supported is password
  91. (symmetric secret) authentication. "AUTHT" is set to "1" for this
  92. authentication method while the "AUTHL" field is set to "20", the length
  93. of the SHA-1 digest of the password.
  94. (1) Alice creates a password x and sends the password digest h(x) to Bob
  95. out of band.
  96. [XXX Don't distinguish between x and h(x), so that both Alice and Bob
  97. can be the initiator of the password exchange. -KL]
  98. (2) Alice sends h(x) to Bob, encrypted with Bob's fresh service key (not
  99. subject to this proposal, see proposal 114).
  100. (3) Bob decrypts Alice's message using his private service key (see
  101. proposal 114) and compares the contained h(x) with what he knows what
  102. Alice's password digest h(x) should be.
  103. This kind of authentication is well-known. It has the known disadvantage
  104. of weak passwords that are vulnerable to dictionary or brute-force
  105. attacks. Nevertheless it seems to be an appropriate solution since safe
  106. passwords can be randomly generated by Tor. Cracking methods that rely on
  107. guessing passwords should not be effective in the constantly changing
  108. network infrastructure. A usability advantage is that this method is easy
  109. to perform even for unexperienced users. The authentication data will be
  110. the SHA-1 secure hash (see tor-spec) of the shared secret (password).
  111. The premise to use password authentication is that Bob must send the
  112. password to Alice -- or the other way around -- outside Tor.
  113. If at the same time the secret cookie is
  114. transmitted and the message is intercepted the attacker can gain access
  115. to the service. Therefore, a secure way to exchange this information must
  116. be established.
  117. [Removed public-key authentication protocol. -KL]
  118. After validating the provided "AUTHD" Bob builds a circuit to the
  119. rendezvous point and starts interacting with Alice. If Bob cannot
  120. identify the client he must refuse the request by not connecting to the
  121. rendezvous point.
  122. [XXX Bob should discard an IPo after a certain number of cells containing
  123. bad auth data. But any denouncement by other IPos or clients, e.g. by
  124. replaying cells, must be inhibited. Maybe Bob should keep a history of
  125. connection attempts within a certain time and discard an IPo after a
  126. specific threshold. And maybe authentication to the service should be
  127. based on a nonce, so that the service can differentiate between a replay
  128. attack by an introduction point and regular reconnection attempts. More
  129. thoughts needed here. -KL]
  130. It will also still be possible to establish v2 hidden services without
  131. authentication. Therefore the "AUTHT" field must be set to "0". "AUTHL"
  132. and "AUTHD" are not provided by the client in that case.
  133. /2/ Client authentication at the introduction point
  134. In addition to authentication at the HS OP, the IPo should be able to
  135. detect and abandon all unauthorized requests. This would help to raise
  136. the level of privacy and therefore also the level of security for Bob by
  137. better hiding his online activity from unauthorized users. Especially if
  138. Alice still has access to the secret cookie. This can be the case if she
  139. had access to the service earlier, but is no longer authorized or the
  140. directory is outdated. Another advantage of this additional "gate keeper"
  141. would be reduced traffic in the network, because unauthorized requests
  142. could already be detected and declined at the IPo.
  143. It is important to notice that the IPo may not be trustworthy, and
  144. therefore can not replace authentication at the HS OP itself. Nor should
  145. the IPo get hold of critical authentication information (because it could
  146. try to access the service itself).
  147. A challenge-response authentication protocol is used to address these
  148. issues. This means that a challenge is needed to be solved by Alice to
  149. get forwarded to Bob by the IPo.
  150. Two types of authentication are supported and need to be preconfigured by
  151. Bob when creating the service: password and public-key authentication.
  152. Again it is up to Alice what kind of authentication mechanism she wants
  153. to use, given that Bob knows both her password and her public key.
  154. If Alice uses a password to authenticate herself at the IPo, the
  155. authentication is based on a symmetric challenge-response authentication
  156. protocol. In this case the challenge for Alice is to send h(x|y) where x
  157. is a user-specific password, which should be different from the password
  158. needed for authentication at the hidden service and y is a randomly
  159. generated value. Alice gets hold of her password out of band.
  160. With the initial RELAY_ESTABLISH_INTRO cell, the IPo gets a list of
  161. h(x|y)'s which it stores locally. Upon a request of Alice it compares her
  162. provided authentication data with the list entries. If there is a
  163. matching entry in its list, Alice's request is valid and can be forwarded
  164. to Bob. To generate the hash, Alice needs to know the password (which she
  165. will get out of band) and the random value y. This value is contained in
  166. the cookie-encrypted part of the hidden service descriptor which Alice
  167. can retrieve from the directory using her secret cookie.
  168. (1) Alice creates a password x and sends the password digest h(x) to Bob
  169. out of band.
  170. (2) Bob creates a random value y, computes h(h(x)|y), and sends the
  171. result to the introduction point.
  172. [XXX There should be a separate y for each introduction point, so
  173. that none of them may impersonate Alice to any of the other
  174. introduction points. -KL]
  175. (3) Bob encrypts y with a secret cookie (see proposal 114) and writes it
  176. to a rendezvous service descriptor.
  177. (4) Alice fetches Bob's rendezvous service descriptor, decrypts y using
  178. the secret cookie (see proposal 114), computes h(h(x)|y), encrypts
  179. it with the public key of the introduction point, and sends it to
  180. that introduction point.
  181. (5) The introduction point decrypts h(h(x)|y) from Alice's message and
  182. compares it to the value it knows from Bob (from step 2).
  183. [Removed public-key authentication protocol. -KL]
  184. To remove a user from a group, Bob needs to update the random value list
  185. at the IPo's.
  186. The changes needed in Tor to realize these two challenge-response
  187. variations affect the RELAY_ESTABLISH_INTRO and RELAY_INTRODUCE1 relay
  188. cells, the service descriptor and the code parts in Tor where these cells
  189. and the descriptor are handled.
  190. The RELAY_ESTABLISH_INTRO cell is now structured as follows:
  191. V Format byte: set to 255 [1 octet]
  192. V Version byte: set to 2 [1 octet]
  193. KL Key length [2 octets]
  194. PK Bob's public key [KL octets]
  195. HS Hash of session info [20 octets]
  196. AUTHT The auth type that is supported [1 octet]
  197. AUTHL Length of auth data [2 octets]
  198. AUTHD Auth data [variable]
  199. SIG Signature of above information [variable]
  200. "AUTHT" is set to "1" for password/public-key authentication.
  201. "AUTHD" is a list of 20 octet long challenges for clients.
  202. The service descriptor as specified in 114-distributed-storage is used in
  203. our implementation.
  204. For password authentication "authentication" auth-type is set to "1" and
  205. auth-data contains the 20 octets long string used by clients to construct
  206. the response to the challenge for authentication at the IPo.
  207. When using public-key authentication the auth-type is set to "2" and
  208. auth-data holds a list of 148 octets long blank separated values. The
  209. first 20 octets of each value is the hash of the public key of a certain
  210. client and used by Alice to determine her entry in the list. The
  211. remaining 128 octets contain the PK-encrypted token needed to
  212. authenticate to the IPo.
  213. [XXX Handle space limitation problem, either by using fewer space, by
  214. sending multiple cells, or by finding a protocol that is
  215. space-independent here. -KL]
  216. The part of the RELAY_INTRODUCE1 cell that can be read by the IPo has the
  217. following fields added:
  218. AUTHT The auth type that is supported [1 octet]
  219. AUTHL Length of auth data [1 octets]
  220. AUTHD Auth data [variable]
  221. [XXX Insert a version field, so that we won't be facing the same problems
  222. again when specifying the next version of INTRODUCE1 cells. -KL]
  223. The AUTHT and AUTHL fields are provided to allow extensions of the
  224. protocol. Currently, we set AUTHT to 1 for password/public-key
  225. authentication and AUTHL to 20 for the length of the authorization token.
  226. [XXX Insert file format containing auth data here. -KL]
  227. Security implications:
  228. In addition to the security features proposed in 114-distributed-storage
  229. a new way of authentication is added at the OP of Bob. Moreover, the
  230. authentication at the IPo's is improved to support a fine-grained access
  231. control. Corrupted IPo's may easily bypass this authentication, but given
  232. the case that the majority of IPo's is acting as expected we still
  233. consider this feature as being useful.
  234. Bob can now decide whether he wants to allow Alice to use his services or
  235. not. This gives him the possibility to offer his services only to known
  236. and trusted users that need to identify by a password or by signing their
  237. messages. The anonymity of the client towards the service provider is
  238. thereby reduced to pseudonymity.
  239. Changing of access rights now involves all three authorization authorities
  240. depending on what changes should be made:
  241. - The user configures his changes at the local OP. Therefore he can
  242. edit the cookie files that were extended to support multiple users.
  243. Moreover he can edit the new user files that were added to specify
  244. authentication information for every user.
  245. - Whenever local changes occur, this information needs to be either
  246. passed to the responsible IPo's, the directory servers, or both
  247. depending on the authorization method and operation used. It is
  248. important to have consistent authorization results at all authorities
  249. at the same time, to create a trustworthy system with good user
  250. acceptance. As these reconfigurations always follow local changes
  251. they can be done automatically by the new Tor implementation and
  252. therefore no user interaction is needed.
  253. - The secret cookies proposed in 114-distributed-storage are used for
  254. group management in our implementation as their use would be far to
  255. costly for a user-based authorization. That is because right now one
  256. descriptor is generated and uploaded for every secret cookie. Changes
  257. in this configuration should therefore be rare (maybe never) and only
  258. a few groups should exist. Provided that this is the case the costs
  259. for changes seem acceptable. As there is currently no possibility to
  260. make a directory remove the descriptor for a group an updated
  261. descriptor without any IPo should be uploaded to the directory
  262. servers.
  263. Local changes to access rights can now be done faster than by changing
  264. service descriptors which reduces the directory server load and network
  265. traffic. Still every configuration change remains costly and users should
  266. carefully choose how detailed the access right configuration should be.
  267. Attacking clients now need to bypass two more authentication steps to
  268. reach the service implementation. Compared to the current state it is
  269. more likely that attackers can be stopped even before they are able to
  270. contact Bob's OP. We expect that the possibility of an attack is thereby
  271. significantly reduced. Another positive side effect is that network
  272. traffic and router load is reduced by discarding unauthorized cells which
  273. should lower the effectiveness of denial of service attacks.
  274. Compatibility:
  275. When using our authentication for hidden services the implementation of
  276. IPo's needs to be extended. Therefore we use version information provided
  277. in router descriptors to be sure that we only send modified
  278. RELAY_ESTABLISH_INTRO cells to routers that can handle them. Clients and
  279. service providers will have to update their Tor installation if they
  280. want to be able to use the service.