socks-extensions.txt 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. $Id$
  2. Tor's extensions to the SOCKS protocol
  3. 1. Overview
  4. The SOCKS protocol provides a generic interface for TCP proxies. Client
  5. software connects to a SOCKS server via TCP, and requests a TCP connection
  6. to another address and port. The SOCKS server establishes the connection,
  7. and reports success or failure to the client. After the connection has
  8. been established, the client application uses the TCP stream as usual.
  9. Tor supports SOCKS4 as defined in [1], SOCKS4A as defined in [2], and
  10. SOCKS5 as defined in [3].
  11. The stickiest issue for Tor in supporting clients, in practice, is forcing
  12. DNS lookups to occur at the OR side: if clients do their own DNS lookup,
  13. the DNS server can learn which addresses the client wants to reach.
  14. SOCKS4 supports addressing by IPv4 address; SOCKS4A is a kludge on top of
  15. SOCKS4 to allow addressing by hostname; SOCKS5 supports IPv4, IPv6, and
  16. hostnames.
  17. 1.1. Extent of support
  18. Tor supports the SOCKS4, SOCKS4A, and SOCKS5 standards, except as follows:
  19. BOTH:
  20. - The BIND command is not supported.
  21. SOCKS4,4A:
  22. - SOCKS4 usernames are ignored.
  23. SOCKS5:
  24. - The (SOCKS5) "UDP ASSOCIATE" command is not supported.
  25. - IPv6 is not supported in CONNECT commands.
  26. - Only the "NO AUTHENTICATION" (SOCKS5) authentication method [00] is
  27. supported.
  28. 2. Name lookup
  29. As an extension to SOCKS4A and SOCKS5, Tor implements a new command value,
  30. "RESOLVE" [F0]. When Tor receives a "RESOLVE" SOCKS command, it initiates
  31. a remote lookup of the hostname provided as the target address in the SOCKS
  32. request. The reply is either an error (if the address couldn't be
  33. resolved) or a success response. In the case of success, the address is
  34. stored in the portion of the SOCKS response reserved for remote IP address.
  35. (We support RESOLVE in SOCKS4 too, even though it is unnecessary.)
  36. 3. HTTP-resistance
  37. Tor checks the first byte of each socks request to see whether it looks
  38. more like an HTTP request (that is, it starts with a "G", "H", or "P"). If
  39. so, Tor returns a small webpage, telling the user that his/her browser is
  40. misconfigured. This is helpful for the many users who mistakenly try to
  41. use Tor as an HTTP proxy instead of a SOCKS proxy.
  42. References:
  43. [1] http://archive.socks.permeo.com/protocol/socks4.protocol
  44. [2] http://archive.socks.permeo.com/protocol/socks4a.protocol
  45. [3] SOCKS5: RFC1928