Shadowsocks is an encrypted proxy protocol. Your device sends each connection to a Shadowsocks server, encrypted with a key that only you and the server know, and the server opens the connection to the website for you. It’s lightweight, carries both TCP and UDP, and has no recognizable handshake, so on the wire it looks like a stream of random bytes.

This guide explains what Shadowsocks is, how it works, which ciphers to use, what plugins do, how to read an ss:// link, and how Shadowsocks compares with a VPN. Already have a server? Jump to how to use Shadowsocks on iPhone.

What is Shadowsocks?

Shadowsocks has two parts: a client on your device and a server you or your provider runs. Both share a cipher and a password (or, with the newest ciphers, a key). Each time an app opens a connection, the client encrypts it and sends it to the server. The server decrypts it, connects to the real destination, and relays the data both ways.

The protocol is open and documented in a series of “SIP” specifications on shadowsocks.org. That’s why it’s everywhere: there are servers in Rust, C and Go, and it’s built into most multi-protocol tools, such as sing-box, Xray and Mihomo. Almost every proxy provider can give you a Shadowsocks server.

A brief history

  • 2012: a developer known as clowwindy released Shadowsocks as a small Python project. It was designed for people on censored networks who needed something simpler and lighter than a full VPN.
  • 2015: the original author stopped working on the project and removed the code from GitHub. The community kept it alive in forks such as shadowsocks-libev, and later shadowsocks-rust.
  • 2017: AEAD ciphers (SIP004) replaced the original stream ciphers as the recommended choice, fixing integrity problems in the old design.
  • 2022: the Shadowsocks 2022 edition (SIP022) added fixed-length keys and replay protection.

How Shadowsocks works

Here is what happens when an app on your iPhone loads a page through a Shadowsocks server:

  1. The client app captures the connection. On iOS it does this with a VPN configuration.
  2. The client encrypts the destination (such as example.org:443) and the first data with the shared key, and sends it to the server’s address and port.
  3. The server decrypts it. If it can’t, because the password or cipher is wrong, it simply drops the connection.
  4. The server connects to example.org:443 and relays data in both directions, encrypting everything that goes back to you.
  5. UDP packets, such as a voice call’s, are encrypted one by one and sent to the same server port.
iPhone ──(encrypted Shadowsocks)──▶ ss.example.com:8388 ──(normal connection)──▶ example.org

There’s no greeting and no certificate exchange. The first bytes are a random salt followed by ciphertext. That makes Shadowsocks fast to start, but it also means a wrong password never produces an error message: the connection just times out.

Shadowsocks ciphers: 2022, AEAD and stream

The cipher decides how your traffic is encrypted. Shadowsocks has three families:

Family Examples Recommendation
2022 (SIP022) 2022-blake3-aes-128-gcm, 2022-blake3-aes-256-gcm, 2022-blake3-chacha20-poly1305 Best choice when your server supports it
AEAD (SIP004) aes-256-gcm, aes-128-gcm, chacha20-ietf-poly1305 Good and very widely supported
Stream aes-256-cfb, chacha20-ietf, rc4-md5 Legacy. Use only if a server offers nothing else

AEAD ciphers authenticate every chunk of data, so the server rejects anything that was modified on the way. The old stream ciphers only encrypt: data can be altered without either side noticing, and servers using them are easier to probe.

2022 ciphers go further. They use a random key instead of a password, so there are no weak passwords. They add timestamps and replay protection, so a recorded connection can’t simply be sent again. They also allow several users to share one port, each with their own key (SIP023). A 2022 key is Base64 of a fixed length, which you can make with:

openssl rand -base64 16

That’s 16 bytes for 2022-blake3-aes-128-gcm. The other 2022 ciphers need 32. The full list of ciphers Potatso supports is in the Shadowsocks reference.

Shadowsocks plugins

A plugin (SIP003) wraps the Shadowsocks connection in another layer so it looks like something else:

  • simple-obfs makes the connection look like plain HTTP or the start of a TLS session.
  • v2ray-plugin and gost-plugin carry it over WebSocket, optionally with TLS. That lets it pass through a CDN or a web server.
  • ShadowTLS, Restls and JLS perform a real TLS handshake with a cover website, then hand over to Shadowsocks.

Plugins have costs. Each adds overhead, and most carry TCP only, so UDP either skips the plugin or doesn’t work. Some plugins, such as Cloak and kcptun, are separate programs that iOS apps can’t run next to the client.

Providers usually share a server as an ss:// link (SIP002), often shown as a QR code:

ss://YWVzLTI1Ni1nY206c2VjcmV0@ss.example.com:8388#Tokyo
  • YWVzLTI1Ni1nY206c2VjcmV0 is aes-256-gcm:secret in Base64: the cipher and the password.
  • ss.example.com:8388 is the server address and port.
  • #Tokyo is the name the app shows.

A 2022 server puts the cipher and key in plain, percent-encoded form, and a plugin goes in a plugin parameter:

ss://2022-blake3-aes-128-gcm:MTIzNDU2Nzg5MDEyMzQ1Ng%3D%3D@ss.example.com:8388#2022
ss://YWVzLTI1Ni1nY206c2VjcmV0@ss.example.com:443/?plugin=simple-obfs%3Bobfs%3Dtls%3Bobfs-host%3Dcdn.example.com#Obfs

Providers with many servers usually give you a subscription URL instead, which lists all of them. See What is a proxy subscription?

Shadowsocks vs VPN

People often call Shadowsocks a VPN, but it works differently from WireGuard, OpenVPN or IPsec:

Shadowsocks Traditional VPN
What it carries Individual TCP connections and UDP packets All IP packets, through a virtual network
Handshake None visible; looks like random bytes A recognizable handshake
Routing The client can choose per site, with rules Usually all traffic, or by IP range
On iPhone Needs a client app IKEv2 is built into iOS; others need an app
What the server sees The sites you connect to The sites you connect to

On iPhone the line blurs: a Shadowsocks client uses an iOS VPN configuration to capture traffic, so you see the VPN icon. But what leaves your phone is Shadowsocks, not a VPN protocol.

Neither is an anonymity tool. The server operator can see where you connect, so pick a provider you trust, or run your own server.

Strengths and weaknesses

Strengths

  • Simple and lightweight, with very little overhead.
  • Carries UDP, so calls, games and QUIC work.
  • Supported by nearly every client, server and provider.
  • Modern 2022 and AEAD ciphers are well designed.

Weaknesses

  • Traffic that looks fully random can itself be a signal. Researchers have shown that this pattern can be detected, which is why TLS-based protocols became popular.
  • No TLS disguise without a plugin, and plugins mostly drop UDP.
  • Old servers may still use weak stream ciphers.
  • A wrong setting fails silently, which makes problems harder to diagnose.

How Shadowsocks compares with other protocols

Protocol Looks like UDP Needs a certificate
Shadowsocks Random bytes Yes No
Trojan HTTPS Yes, inside TLS Yes, or REALITY
VLESS + REALITY HTTPS to a borrowed site Yes No
Hysteria 2 HTTP/3 (QUIC) Yes Usually

For a fuller picture, read Proxy protocols compared.

Use Shadowsocks on iPhone

iOS can’t speak Shadowsocks by itself, so you need a client app. Potatso is a free proxy client for iPhone and iPad that imports ss:// links, QR codes and subscriptions, supports the 2022 and AEAD ciphers, and has the common plugins built in. Follow the step-by-step guide: How to use Shadowsocks on iPhone.

Frequently asked questions

Is Shadowsocks a VPN?
No. Shadowsocks is an encrypted proxy protocol: it relays your app connections one by one through a server, while a VPN tunnels all your network packets. On iPhone, a client app uses a VPN configuration to capture traffic, but what it sends to the server is Shadowsocks.
Is Shadowsocks secure?
With a 2022 or AEAD cipher, traffic between your device and the server is encrypted and protected against tampering. The server can still see which sites you connect to, so only use a server you trust, and avoid old stream ciphers such as rc4-md5.
Which Shadowsocks cipher is best?
If your server supports them, use a 2022 cipher such as 2022-blake3-aes-128-gcm. Otherwise use aes-256-gcm or chacha20-ietf-poly1305. Your client must use exactly the cipher your server is set up with.
Does Shadowsocks support UDP?
Yes. Shadowsocks relays UDP as well as TCP, so voice calls, games and QUIC can go through it. Most plugins carry TCP only, so a server with a plugin usually relays UDP without the plugin or not at all.
Can Shadowsocks be detected?
It's harder to fingerprint than many VPN protocols because it has no visible handshake, but it isn't undetectable. Traffic that looks completely random can itself stand out, which is why plugins and TLS-based protocols such as Trojan exist.

Also available in: 简体中文 · 繁體中文 · 日本語 · Русский