A SOCKS5 proxy is a proxy server that forwards network traffic. It does not look at any of the data. The client connects to the proxy. Then the proxy connects to the destination on behalf of the client. This means the destination will see the IP address of the proxy server.
SOCKS5 is the 5th version of the SOCKS (Socket Secure) protocol. It was defined in RFC 1928 by the Internet Engineering Task Force (IETF) in March 1996. The protocol was designed to allow a reliable way for client-server applications to pass through firewalls and other network boundaries. It can be used over TCP and UDP connections.
What Does a SOCKS5 Proxy Do?
A SOCKS5 proxy acts as a middleman between the client and the internet. The proxy can pass on the user's traffic. Unlike an HTTP proxy, SOCKS5 proxies operate at the transport layer rather than the application layer of web requests. This means that they pass on packets of data regardless of their protocol or type.
They can support traffic in many forms, including web traffic, file sharing, email, peer-to-peer data, gaming, etc. All of this is done using one type of connection. SOCKS5 proxies will treat all connections in the same way, receiving traffic from the client and passing it on to the destination.
How a SOCKS5 Proxy Works
When a device is configured to use a SOCKS5 proxy, traffic follows a specific sequence before reaching its destination.
Step 1: Connection to the proxy
The client initiates a TCP connection to the SOCKS5 proxy server (which is conventionally on port 1080). The client then sends the proxy server a greeting, including information about the protocol version it is using and the authentication methods it supports.
Step 2: Authentication
The proxy chooses an authentication scheme from those provided by the client. As defined in RFC 1928, there are three schemes: no authentication, username/password (defined in a separate RFC 1929), and GSS-API. If authentication is needed, then the client will provide credentials. If none of the schemes are accepted, then the connection will be denied.
Step 3: Sending the request
After authentication, the client sends a connection request that includes the destination address and port. The proxy uses this to open a connection to the destination server.
Step 4: Data relay
Once the connection to the destination is established, the proxy relays data in both directions between the client and the destination. The destination server only ever sees the proxy’s IP address.
UDP Traffic
SOCKS5 also supports UDP using a separate command known as the UDP ASSOCIATE command defined in RFC 1928. The client will send a UDP ASSOCIATE request over the existing TCP control channel. The proxy will reply with a relay address and port. The client will then send UDP packets to the relay, and the proxy will pass these on to the destination. The TCP control channel will need to be kept open.
SOCKS5 vs. SOCKS4
SOCKS4 was the earlier version of the protocol and had significant limitations. SOCKS5 addressed all of them.
Feature | SOCKS4 | SOCKS5 |
Connection type | TCP only | TCP and UDP |
Authentication | None | Username/password, GSS-API |
IPv6 support | No | Yes |
DNS resolution | Client-side | Server-side |
SOCKS4 should only be used when a proxy server does not support SOCKS5.
SOCKS5 vs. HTTP Proxy
HTTP proxy is a proxy operating on the application layer. It processes HTTP requests and provides the ability to modify headers. An application proxy. SOCKS5 proxy does not modify or read any data passed through it. It operates on the transport layer.
For HTTPS traffic, these two work the same way in practice since both end up tunneling encrypted data. The important differences are:
- SOCKS5 supports non-HTTP protocols such as FTP, SMTP, and BitTorrent. An HTTP proxy does not.
- SOCKS5 supports UDP. HTTP proxies work with TCP only.
- SOCKS5 does not add or modify request headers. HTTP proxies can and often do.
- SOCKS5 can be configured per application rather than routing all system traffic.
SOCKS5 Authentication Methods
Per RFC 1928, SOCKS5 defines three core authentication methods:
No authentication: The proxy allows connections without requiring users to verify their identity. This setup is often used within private networks.
Username and password authentication: RFC 129 defines a method that requires users to verify their creds before using SOCKS5 proxy. This is commonly used by commercial proxy providers.
GSS-API authentication: This method supports Kerberos authentication and helps organizations verify users before allowing access to network services.
Common Uses of a SOCKS5 Proxy
Web scraping and automation: SOCKS5 proxies are used for automated data collection because they forward requests without changing HTTP headers. Many of these scraping frameworks and automation tools support SOCKS5 connections.
Multi-account management: Users can assign different SOCKS5 proxies to separate browser profiles or accounts. They can also work with session management tools and anti-detect browsers without normally modifying request headers.
Torrenting and peer-to-peer file sharing: SOCKS5 can handle both TCP and UDP traffic, which can be useful for BitTorrent and similar applications. Some of these torrent clients also offer SOCKS5 proxy settings.
Accessing geo-restricted content: A proxy server in another country can help users reach websites or services that limit access based on geographic locations.
Online gaming: SOCKS5 can support gaming applications that rely on quick data transfers. Its UDP compatibility makes it a good pick for some real-time connections, depending on network conditions.
Bypassing network-level restrictions: SOCKS5 can forward traffic through blocked or restricted access. Its effectiveness depends on firewall settings and on the network’s security.
Limitations of SOCKS5
No built-in encryption: SOCKS5 forwards traffic without adding encryption. Security highly depends on the protocol being used. HTTPS encrypts communication and protects data during transfer, while regular HTTP does not provide encryption.
IP masking only: SOCKS5 changes the user’s IP address visible to a website, but it does not prevent identification through cookies, browser details, or online activity.
No content caching or filtering: SOCKS5 is designed to forward traffic without examining website content. Content-based filtering and response caching are not standard features of the protocol.