119-controlport-auth.txt 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. Filename: 119-protocolinfo-on-controlport.txt
  2. Title: New PROTOCOLINFO command for controllers
  3. Version: $Revision$
  4. Last-Modified: $Date$
  5. Author: Roger Dingledine
  6. Created: 14-Aug-2007
  7. Status: Open
  8. Overview:
  9. Here we describe how to help controllers locate the cookie
  10. authentication file when authenticating to Tor, so we can a) require
  11. authentication by default for Tor controllers and b) still keep
  12. things usable.
  13. The Problem:
  14. When we first added the controller protocol, we wanted to make it
  15. easy for people to play with it, so by default we didn't require any
  16. authentication from controller programs. We allowed requests only from
  17. localhost as a stopgap measure for security.
  18. Due to an increasing number of vulnerabilities based on this approach,
  19. it's time to add authentication in default configurations.
  20. We have a number of goals:
  21. - We want the default Vidalia bundles to transparently work. That
  22. means we don't want the users to have to type in or know a password.
  23. - We want to allow multiple controller applications to connect to the
  24. control port. So if Vidalia is launching Tor, it can't just keep the
  25. secrets to itself.
  26. Right now there are three authentication approaches supported
  27. by the control protocol: NULL, CookieAuthentication, and
  28. HashedControlPassword. See Sec 5.1 in control-spec.txt for details.
  29. There are a couple of challenges here. The first is: if the controller
  30. launches Tor, how should we teach Tor what authentication approach
  31. it should require, and the secret that goes along with it? Next is:
  32. how should this work when the controller attaches to an existing Tor,
  33. rather than launching Tor itself?
  34. Cookie authentication seems most amenable to letting multiple controller
  35. applications interact with Tor. But that brings in yet another question:
  36. how does the controller guess where to look for the cookie file,
  37. without first knowing what DataDirectory Tor it using?
  38. Design:
  39. We should add a new controller command PROTOCOLINFO that can be sent
  40. as a valid first command (the others being AUTHENTICATE and QUIT). If
  41. PROTOCOLINFO is sent as the first command, the second command must be
  42. either a successful AUTHENTICATE or a QUIT.
  43. Spec:
  44. C: PROTOCOLINFO CRLF
  45. S: "250+PROTOCOLINFO" PIVERSION CRLF
  46. S: "250-AUTH" SP "METHODS=" AuthMethod *("," AuthMethod)
  47. [SP "COOKIEFILE=" AuthCookieFile] CRLF
  48. S: "250-VERSION" SP "Tor=" Version [...]
  49. S: "250 OK"
  50. PIVERSION is there in case we drastically change the syntax one day. For
  51. now it should always be "1".
  52. [XXX Is there a better way to do PIVERSION? The above way seems bad,
  53. since what do controllers do if they hear a 2 but don't know what to
  54. do with it? -RD]
  55. Right now only two "topics" (AUTH and VERSION) are included, but more
  56. may be included in the future. Controllers must accept lines with
  57. unexpected topics.
  58. AuthMethod =
  59. "NULL" / ; No authentication is required
  60. "HASHEDPASSWORD" / ; A controller must supply the original password
  61. "COOKIE" / ; A controller must supply the contents of a cookie
  62. AuthCookieFile = QuotedString
  63. AuthMethod is used to specify one or more control authentication
  64. methods that Tor currently accepts.
  65. AuthCookieFile specifies the absolute path and filename of the
  66. authentication cookie that Tor is expecting and is provided only if
  67. the METHODS field contains the method "COOKIE". This field MUST be
  68. enclosed in DQUOTEs, since the absolute path to the cookie file may
  69. contain spaces on some platforms.
  70. The VERSION line contains the Tor version, in DQUOTES. In the future
  71. it might also contain Link versions, Circuit versions, or others as
  72. described in proposal 105.
  73. [What else might we want to include that could be useful? -RD]
  74. Compatibility:
  75. Tor 0.1.2.16 and 0.2.0.4-alpha hang up after the first failed
  76. command. Earlier Tors don't know about this command but don't hang
  77. up. That means controllers will need a mechanism for distinguishing
  78. whether they're talking to a Tor that speaks PROTOCOLINFO or not.
  79. I suggest that the controllers attempt a PROTOCOLINFO. Then:
  80. - If it works, great. Authenticate as required.
  81. - If they get hung up on, reconnect and do a NULL AUTHENTICATE.
  82. - If it's unrecognized but they're not hung up on, do a NULL
  83. AUTHENTICATE.
  84. Unsolved problems:
  85. If Torbutton wants to be a Tor controller one day... talking TCP is
  86. bad enough, but reading from the filesystem is even harder. Is there
  87. a way to let simple programs work with the controller port without
  88. needing all the auth infrastructure?
  89. Once we put this approach in place, the next vulnerability we see will
  90. involve an attacker somehow getting read access to the victim's files
  91. --- and then we're back where we started. This means we still need
  92. to think about how to demand password-based authentication without
  93. bothering the user about it.