xxx-pluggable-transport.txt 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. Filename: xxx-pluggable-transport.txt
  2. Title: Pluggable transports for circumvention
  3. Author: Jacob Appelbaum, Nick Mathewson
  4. Created: 15-Oct-2010
  5. Status: Draft
  6. Overview
  7. This is a document about transport plugins; it does not cover
  8. discovery, or bridgedb improvements. Each transport plugin
  9. specification should make clear any external requirements but those
  10. are generally out of scope if they fall into discovery or
  11. infrastructure components.
  12. We should include a description of how to write a good set of plugins,
  13. how to evaluate and how to classify a plugin. For example, if a plugin
  14. is said to be hard to detect on the wire if you know what it is and
  15. how it works, it should say so. If it's easy, it's still possibly
  16. functional for a given network but perhaps it is not well hidden or
  17. automatically filtered. Detection and blocking are not always the same
  18. thing right off. In both cases, a plugin should be quite clear about
  19. its security claims.
  20. Target use-cases[a][b]
  21. Here's some stuff we want to be able to support. We're listing these
  22. in the draft to try to define the problem space. We won't put this
  23. section in the final version.
  24. 1. The 'obfuscated SSH' superencipherment:
  25. http://github.com/brl/obfuscated-openssh/blob/master/README.obfuscation
  26. 2. Big P2P-network style transports where instead of connecting to a
  27. bridge at a known IP, you connect to a bridge by a username, a public
  28. key, or whatever.
  29. 1. We need the ability to have two kinds of proxies - one for
  30. incoming connections and one for outgoing connections. [Sure, but
  31. that's about how we implement stuff arg arg dumb touchpad -NM]
  32. 1. Probably we want to have the ability to get connections
  33. anyway we'll take them
  34. 2. So, bridges use the incoming kind, and clients use the ougoing
  35. kind? Sounds right.-N
  36. 1. Probably also we're a multi-plexed incoming kind of Tor
  37. relay - so we should take connections from say localhost's
  38. little helper and also, we should take connections from
  39. external ips. This would be useful to identify though. I think
  40. this is how we would already work as of today.
  41. 1. You mean, regular non-bridge relays should support this
  42. too? I hadn't considered that. it has seemed pointless
  43. because of IP blocking, but if we have a p2p transport, it
  44. would be useful for regular relays to allow it. Yes -io
  45. 1. Also it would be nice for stats purposes to ensure that
  46. we know what kinds of connections we're handling, even if
  47. we basically treat them exactly the same. Perhaps Karsten
  48. wants to weigh in on how we should have Tor handle these
  49. things? I guess we'll really fuck up his stats collection
  50. if all of sudden he's getting lots of connections from
  51. 127.0.0.1...
  52. 1. Various protocol-impersonation tools
  53. 1. NSTX, iodyne, Ozymandns or such, for the lulz.
  54. 1. DNS tunneling of many types - eg: TXT records or the NULL
  55. protocol trick
  56. 1. HTTP -- many kinds are possible, some may even be right
  57. 1. HTTP POST requests are implemented in Firepass
  58. 1. FTP
  59. 1. Perhaps some kind of anonymous ftp login with sending and
  60. receiving of data would be useful?
  61. 1. Lots to think about before designing off the cuff crappy
  62. protocol covert channels
  63. 1. NTP
  64. 1. Hardly anyone knows about NTP these days - it's almost always
  65. outbound allowed and it's usually not well inspected
  66. 1. That makes it good for short-term circumvention, but bad
  67. for long-term hiding.
  68. 1. Triangle-boy
  69. 2. IPSec look-alike
  70. 3. UDP
  71. 4. IPv6
  72. 1. A forged-RST-ignoring tool
  73. 1. A forged-RST-ignoring tool that pretends that it is getting all
  74. of its connections closed and retrying all the time, when really
  75. it is just carrying on with business as usual. Hooray for
  76. crypto.
  77. 1. Perhaps it's a good idea to mention CCTT?
  78. 1. What else goes here?
  79. 1. We should ask Nextgens about protocol filters from Freenet
  80. 2. http://gray-world.net/papers.shtml
  81. 3. http://gray-world.net/pr_cook_cc.shtml
  82. 4. http://gray-world.net/pr_firepass.shtml
  83. 5. We should ensure we cover the topics and lessons learned from
  84. "FIREWALL RESISTANCE TO METAFEROGRAPHY IN NETWORK COMMUNICATIONS"
  85. - see
  86. https://ritdml.rit.edu/bitstream/handle/1850/12272/RSavacoolThesis5-21-2010.pdf
  87. Here's some stuff that seems out-of-scope:
  88. 1. A generic firewall-breaker that works with all Tor nodes and
  89. bridges. Like, if you're using a VPN to get through your firewall,
  90. and it lets you connect to any Tor node, you can just use it without
  91. any special plug-in support. I think this spec is just for stuff
  92. that requires buy-in from the server side of the connection. Agreed?
  93. 1. Yeah - I think we should simply codify the proxy stuff to ensure
  94. that we plan to remain pluggable for incoming and outgoing connections
  95. in some formal way.
  96. I'm uncertain if we want to support stuff like:
  97. 1. An ssh tunnel that uses openssh to tunnel raw tor packets, with no
  98. actual TLS going on underneath. Promising, but risky. -NM
  99. 1. I think there isn't much to gain by doing this but perhaps so - we
  100. are too dependent on TLS and our certs are trivial to fingerprint -io
  101. 1. Also, Tor-over-TLS-tunneled-over-SSH looks even weirder than
  102. Tor-over-SSH. -N
  103. 2. It might be nice to allow certs [cn] fields to be configurable by
  104. bridge nodes? -io
  105. 1. If we allowed "raw traffic" transports, a transport could get this
  106. trivially by implementing TLS with the right certs. -NM
  107. 1. perhaps we just want a "raw traffic port" where we connect to pass
  108. around cells? thoughts?
  109. 1. A bridge-discovery-and-round-robin p2p tool that connects you to a
  110. randomly chosen one of an unknown number of bridges.
  111. 1. Stackable plugins
  112. 1. Tor over DNS over HTTP Post over Obfuscated Tor to reach the Tor
  113. network to read a copy of uncensored Google News.
  114. 1. Christ, what the fuck world are we building? Or even more,
  115. what kind of world are we resisting?
  116. 1. More like RST-drop plus sshobfs over HTTP over VPN.
  117. Goals & Motivation
  118. Frequently, people want to try a novel circumvention method to help
  119. users connect to Tor bridges. Some of these methods are already
  120. pretty easy to deploy: if the user knows an unblocked VPN or open
  121. SOCKS proxy, they can just use that with the Tor client today.
  122. Less easy to deploy are methods that require participation by both the
  123. client and the bridge. In order of increasing sophistication, we
  124. might want to support:
  125. 1. A protocol obfuscation tool that transforms the output of a TLS
  126. connection into something that looks like HTTP as it leaves the client,
  127. and back to TLS as it arrives at the bridge.
  128. 2. An additional authentication step that a client would need to
  129. perform for a given bridge before being allowed to connect.
  130. 3. An information passing system that uses a side-channel in some
  131. existing protocol to convey traffic between a client and a bridge
  132. without the two of them ever communicating directly.
  133. 4. A set of clients to tunnel client->bridge traffic over an existing
  134. large p2p network, such that the bridge is known by an identifier
  135. in that network rather than by an IP address.
  136. We could in theory support these almost fine with Tor as it stands
  137. today: every Tor client can take a SOCKS proxy to use for its outgoing
  138. traffic, so a suitable client proxy could handle the client's traffic
  139. and connections on its behalf, while a corresponding program on the
  140. bridge side could handle the bridge's side of the protocol
  141. transformation. Nevertheless, there are some reasons to add support
  142. for transportation plugins to Tor itself:
  143. 1. It would be good for bridges to have a standard way to advertise
  144. which transports they support, so that clients can have multiple
  145. local transport proxies, and automatically use the right one for
  146. the right bridge.
  147. 2. There are some changes to our architecture that we'll need for a
  148. system like this to work. For testing purposes, if a bridge blocks
  149. off its regular ORPort and instead has an obfuscated ORPort, the
  150. bridge authority has no way to test it. Also, unless the bridge
  151. has some way to tell that the bridge-side proxy at 127.0.0.1 is not
  152. the origin of all the connections it is relaying, it might decide
  153. that there are too many connections from 127.0.0.1, and start
  154. paring them down to avoid a DoS.
  155. 3.
  156. 4. (what else?)
  157. Non-Goals
  158. We're not going to talk about automatic verification of plugin
  159. correctness and safety via sandboxing, proof-carrying code, or
  160. whatever.
  161. We need to do more with discovery and distribution, but that's not
  162. what this proposal is about. We're pretty convinced that the problems
  163. are sufficiently orthogonal that we should be fine so long as we don't
  164. preclude a single program from implementing both transport and
  165. discovery extensions.
  166. This proposal is not about what transport plugins are the best ones
  167. for people to write.
  168. We've considered issues involved with completely replacing Tor's TLS
  169. with another encryption layer, rather than layering it inside the
  170. obfuscation layer. We describe how to do this in an appendix to the
  171. current proposal, though we are not currently sure whether it's a good
  172. idea to implement.
  173. Design overview
  174. Clients run one or more "Transport client" programs that act like
  175. SOCKS proxies. They accept connections on localhost on different
  176. ports. Each one implements one or more transport methods. Parameters
  177. are passed from Tor inside the regular username/password parts of the
  178. SOCKS protocol.
  179. Bridges (and maybe relays) run one or more programs that act like
  180. stunnel-server (or whatever the option is): they get connections from
  181. the network (typically by listening for connections on the network)
  182. and relay them to the Bridge's real ORPort.
  183. 1. The bridge needs to know which methods these servers support
  184. 1. The bridge needs to advertise this fact some way that the clients
  185. will find out about it--probably by sticking it in its bridge
  186. descriptor so that the bridgedb can find out and see that the clients
  187. get informed.
  188. 2. Somebody needs to launch these programs
  189. 3. The bridge may want to just not have a public ORPort at all.
  190. 4. The bridge may not want to advertise a real IP at all
  191. 5. The bridge will want to find out from the program any client
  192. identification information it can get (IP, etc) to implement rules
  193. about max clients at once
  194. Any methods that are wildly successful, we can bake into Tor.
  195. Proposed terminology:
  196. Transport protocol:
  197. Transport proxy:
  198. Specifications: Client behavior
  199. Bridge lines can now follow the extended format "bridge method
  200. address:port [[keyid=]id-fingerprint] [k=v] [k=v] [k=v]". To connect
  201. to such a bridge, a client must open a local connection to the SOCKS
  202. proxy for "method", and ask it to connect to address:port. If
  203. [id-fingerprint] is provided, it should expect the public identity key
  204. on the TLS connection to match the digest provided in
  205. [id-fingerprint]. If any [k=v] items are provided, they are
  206. configuration parameters for the proxy: Tor should separate them with
  207. NUL bytes and put them user and password fields of the request,
  208. splitting them across the fields as necessary. The "id-fingerprint"
  209. field is always provided in a field named "keyid", if it was given.
  210. example: if the bridge line is "bridge trebuchet www.example.com:3333
  211. rocks=20 height=5.6m" then, if the Tor client knows that the
  212. ‘trebuchet' method is provided by a SOCKS5 proxy on 127.0.0.1:19999,
  213. it should connect to that proxy, ask it to connect to www.example.com,
  214. and provide the string "rocks=20\0height=5.6m" as the username, the
  215. password, or split across the username and password.
  216. There are two ways to tell Tor clients about protocol proxies:
  217. external proxies and managed proxies. An external proxy is configured
  218. with "Transport trebuchet socks5 127.0.0.1:9999". This tells Tor that
  219. another program is already running to handle ‘trubuchet' connections,
  220. and Tor doesn't need to worry about it. A managed proxy is configured
  221. with "Transport trebuchet /usr/libexec/tor-proxies/trebuchet
  222. [options]", and tells Tor to launch an external program on-demand to
  223. provide a socks proxy for ‘trebuchet' connections. The Tor client only
  224. launches one instance of each external program, even if the same
  225. executable is listed for more than one method.
  226. The same program can implement a managed or an external proxy: it just
  227. needs to take an argument saying which one to be.
  228. [I don't like the terminology here. We should pick better words before
  229. this "external/managed" stuff catches on. Also, to most users a
  230. "proxy" is a computer that relays stuff for them, not a local program
  231. on their computer. -NM I think we should go with Helper of some kind
  232. as it's less technically overloaded and more friendly feeling - io
  233. "Helper" is too overloaded already. -NM]
  234. Client proxy behavior
  235. When launched from the command-line by a Tor client, a transport
  236. proxy needs to tell Tor which methods and ports it supports. It does
  237. this by printing one or more METHOD: lines to its stdout. These look
  238. like CMETHOD: trebuchet SOCKS5 127.0.0.1:19999 ARGS:rocks,height
  239. OPT-ARGS:tensile-strength
  240. The ARGS field lists mandatory parameters that must appear in every
  241. bridge line for this method. The OPT-ARGS field lists optional
  242. parameters. If no ARGS or OPT-ARGS field is provided, Tor should not
  243. check the parameters in bridge lines for this method.
  244. The proxy should print a single "METHODS:DONE" line after it is
  245. finished telling Tor about the methods it provides.
  246. [Should methods be versionable? Can they be? -nm I think probably?
  247. -io Then how? -nm]
  248. The transport proxy MUST exit cleanly when it receives a SIGTERM from
  249. Tor.
  250. The Tor client MUST ignore lines beginning with a keyword and a colon
  251. if it does not recognize the keyword.
  252. In the future, if we need a control mechanism, we can use the
  253. stdin/stdout from Tor to the transport proxy.
  254. Transport proxy requirements
  255. A transport proxy MUST handle SOCKS connect requests using the SOCKS
  256. version it advertises.
  257. Server proxy behavior
  258. [So, we can have this work like client proxies, where the bridge
  259. launches some programs, and they tell the bridge, "I am giving you
  260. method X with parameters Y"? Do you have to take all the methods? If
  261. not, which do you specify?]
  262. [Do we allow programs that get started independently?]
  263. [We'll need to figure out how this works with port forwarding. Is
  264. port forwarding the bridge's problem, the proxy's problem, or some
  265. combination of the two?]
  266. [If we're using the bridge authority/bridgedb system for distributing
  267. bridge info, the right place to advertise bridge lines is probably
  268. the extrainfo document. We also need a way to tell the bridge
  269. authority "don't give out a default bridge line for me"]
  270. Server behavior
  271. Bridge authority behavior
  272. Implementation plan
  273. Finish the design work here.
  274. Clean up all the inline conversations to just get summarized by the
  275. conclusions they arrived at.
  276. Turn this into a draft proposal
  277. Circulate and discuss on or-dev
  278. (Use Cinderblock Of Loving Correction to reeducate anybody who tries
  279. to divert discussion of how pluggable transports should work into
  280. discussion of what is the best possible transport, or whatever.)
  281. We should ship a couple of null plugin implementations in one or two
  282. popular, portable languages so that people get an idea of how to
  283. write the stuff.
  284. 1. We should have one that's just a proof of concept that does
  285. nothing but transfer bytes back and forth.
  286. 1. We should not do a rot13 one.
  287. 2. We should implement a basic proxy that does not transform the bytes at all
  288. 1. We should implement DNS or HTTP using other software (as goodell
  289. did years ago with DNS) as an example of wrapping existing code into
  290. our plugin model.
  291. 2. The obfuscated-ssh superencipherment is pretty trivial and pretty
  292. useful. It makes the protocol stringwise unfingerprintable.
  293. 1. Nick needs to be told firmly not to bikeshed the obfuscated-ssh
  294. superencipherment too badly
  295. 1. Go ahead, bikeshed my day
  296. 1. If we do a raw-traffic proxy, openssh tunnels would be the logical choice.
  297. Appendix: recommendations for transports
  298. Be free/open-source software. Also, if you think your code might
  299. someday do so well at circumvention that it should be implemented
  300. inside Tor, it should use the same license as Tor.
  301. Use libraries that Tor already requires. (You can rely on openssl and
  302. libevent being present if current Tor is present.)
  303. Be portable: most Tor users are on Windows, and most Tor developers
  304. are not, so designing your code for just one of these platforms will
  305. make it either get a small userbase, or poor auditing.
  306. Think secure: if your code is in a C-like language, and it's hard to
  307. read it and become convinced it's safe then, it's probably not safe.
  308. Think small: we want to minimize the bytes that a Windows user needs
  309. to download for a transport client.
  310. Specify: if you can't come up with a good explanation
  311. Avoid security-through-obscurity if possible. Specify.
  312. Resist trivial fingerprinting: There should be no good string or regex
  313. to search for to distinguish your protocol from protocols permitted by
  314. censors.
  315. Imitate a real profile: There are many ways to implement most
  316. protocols -- and in many cases, most possible variants of a given
  317. protocol won't actually exist in the wild.
  318. Appendix: Raw-traffic transports
  319. This section describes an optional extension to the proposal above.
  320. [a]I agree that we should remove this section - perhaps we should also save the links and move them to the possible plugin examples? - ioerror
  321. [b]This whole section should get removed from the final thing. I tried to summarize broad themes in the Motivations section below. - NM
  322. [c]That doesn't really help - does it? Or do you mean that the Tor should set the CN to be say, the IP or hostname of the relay? - ioerror
  323. The "Address" field when we have it. After that, the hostname if we know it. After that, do a PTR lookup on our IP. After that, use our IP. -NM