Skip to content
ProxyRaw
advancedProtocols

SOCKS5 Proxy

A flexible, application-independent proxy protocol operating at Layer 5 (Session Layer) that routes any TCP or UDP traffic without reading or modifying application payloads.

SOCKS5 (Socket Secure version 5, defined in RFC 1928) is an open networking protocol that routes network packets between a client and an external server via a proxy server.

Unlike HTTP proxies that operate at Layer 7 (Application Layer) and are designed specifically for web traffic, SOCKS5 operates at Layer 5 (Session Layer) of the OSI model. This low-level positioning makes SOCKS5 completely protocol-agnostic: it can relay web traffic, email (SMTP/IMAP), file transfers (FTP/SFTP), peer-to-peer data (BitTorrent), gaming streams, and VoIP communications with equal capability.

How the SOCKS5 Protocol Operates (link to this section)

When a client application establishes a connection through a SOCKS5 proxy, a structured three-step handshake occurs:

  1. Method Negotiation (Greeting):
  • The client opens a TCP connection to the proxy server and sends its supported authentication methods (e.g., 0x00 No Authentication, 0x02 Username/Password).
  • The proxy selects a method and responds.
  1. Authentication:
  • If required, the client sends credentials (RFC 1929), and the server grants or denies access.
  1. Connection Request:
  • The client instructs the proxy where to connect using one of three command codes:
  • 0x01 (CONNECT): Establishes a raw TCP stream to a destination IP/domain.
  • 0x02 (BIND): Prepares a port for incoming connections (used in active FTP).
  • 0x03 (UDP ASSOCIATE): Sets up a UDP relay channel for datagram traffic.
  1. Transparent Data Relay:
  • Once connected, the proxy transparently forwards raw bytes back and forth between client and target. It does not inspect, parse, cache, or alter headers or data payloads.

SOCKS5 vs HTTP Proxy: Key Technical Differences (link to this section)

FeatureSOCKS5 ProxyHTTP / HTTPS Proxy
OSI LayerLayer 5 (Session Layer)Layer 7 (Application Layer)
Protocol SupportAny TCP and UDP protocolHTTP, HTTPS, WebSocket
UDP CapabilityFull native supportNo UDP support
Header ModificationNone (Raw byte forwarding)Can inject, inspect, or strip headers
Caching CapabilityNoneCan cache web assets
DNS ResolutionRemote or Local (socks5h vs socks5)Typically handled via CONNECT
Best Used ForTorrenting, gaming, non-HTTP apps, raw socketsWeb scraping, API automation, web browsing

Remote DNS Resolution: The Critical 'socks5h://' Distinction (link to this section)

A common security vulnerability when using SOCKS5 proxies is the DNS leak:

  • If you configure a proxy URL as socks5://proxy.com:1080, your local operating system may resolve the domain name (e.g., targetsite.com) using your home ISP's DNS resolver before sending the resulting IP to the proxy. Your local ISP sees every domain you access.
  • When you use the socks5h:// protocol prefix (supported by cURL, Python requests, and modern scrapers), the domain name itself is transmitted to the proxy server, forcing the proxy to resolve DNS remotely on its own network.
bash
# Resolves DNS remotely through the proxy to prevent local DNS leaks:
curl -x socks5h://user:password@proxy.example.com:1080 https://api.ipify.org

Does SOCKS5 Provide Encryption? (link to this section)

A widespread misconception is that SOCKS5 acts like a VPN and encrypts your internet connection.

Standard SOCKS5 does not provide cryptographic encryption for your data payload. If you transfer unencrypted HTTP traffic over SOCKS5, anyone intercepting your local Wi-Fi or ISP network can view the plaintext packets.

However, when you transmit HTTPS, SSH, or SFTP traffic over SOCKS5, the end-to-end TLS/SSL encryption generated by your application remains completely intact. The proxy simply relays the encrypted ciphertext without being able to read it.

In practice

  • Configuring a BitTorrent client (such as qBittorrent) with a SOCKS5 proxy to conceal your home IP address from public torrent swarms while allowing UDP peer discovery.
  • Routing Python raw TCP socket applications or custom communication protocols through a proxy tunnel using the `PySocks` library.
  • Configuring the Telegram desktop messaging client to connect through a remote SOCKS5 proxy to bypass national ISP-level communication blocks.
  • Routing multi-threaded network diagnostics through remote SOCKS5 gateways with remote DNS resolution (`socks5h://`) to eliminate local DNS attribution.

Common use cases

Non-HTTP application traffic routing (Email, FTP, IRC)P2P file sharing and torrenting privacyCircumventing firewall protocol and port blocksOnline gaming and real-time VoIP streaming over UDPLow-level network automation and socket programmingSecure remote server administration

Frequently asked

No. SOCKS5 is a transport protocol, not an encryption tunnel like a VPN. However, if your application traffic is already encrypted (such as HTTPS or SSH), that encryption remains completely secure as it travels through the SOCKS5 proxy.

The 'h' in socks5h stands for host-resolved DNS. With `socks5://`, your local machine resolves the destination domain name using your local DNS, potentially causing a DNS leak. With `socks5h://`, the domain name is resolved remotely by the proxy server.

Yes. SOCKS5 creates a transparent TCP stream between your browser and the web server, through which your browser negotiates standard end-to-end TLS encryption seamlessly.

Generally yes. Because SOCKS5 operates at Layer 5 and does not parse, inspect, or rewrite HTTP headers, it introduces slightly lower CPU overhead and latency compared to Layer 7 HTTP proxies.

Related terms