27 Oct 2025
SOCKS protocol and proxies
SOCKS protocol
The protocol is used for forwarding internet traffic, particularly TCP/IP via a proxy server. Version 5 later added support for ipv6 and UDP that also allows dns lookups.
The handshake works as follows:
- Client connects and sends a greeting, which includes a list of authentication methods.
- Server chooses a method.
- Client sends multiple messages now.
- Finally the regular connection requests occur:
- One packet from client to server with the version, command code, destination port, destination IP, and the user ID string.
- Server responds with version, reply code, destination port and IP, which the client should bind to if the command code was BIND.
