Shadowsocks: how it works, ciphers, the 2022 edition and ss:// links

Shadowsocks is an encrypted proxy: the client and the server share one secret key, and everything between them looks like random bytes, with no handshake and no certificate. By itself it is a proxy, not a VPN: a client app makes a VPN out of it by sending the whole device's traffic through it. An ss:// link, Outline keys included, holds the server, the cipher and the key.

Updated

On this page

Facts

What it is

Encrypted proxy with a pre-shared key

Since, by

2012, clowwindy

Transport

TCP and UDP

Encryption

Its own AEAD: AES-GCM or ChaCha20-Poly1305

To the network it looks like

Random bytes from the very first packet

Usual port

Any; 8388 in the project's examples

Comes as

ss:// link, Outline ssconf://, SIP008 JSON

License

MIT (shadowsocks-rust)

Latest release

shadowsocks-rust v1.25.0, August 26, 2026

In Veli

Windows, macOS, Linux, Android · link

Own server from the app

Yes

Versions and history

  1. 2012

    clowwindy's Shadowsocks

    The Python original appeared in April 2012: a SOCKS5-style local proxy and a remote server, with stream ciphers. Ports followed, shadowsocks-libev in C and, from 2014, shadowsocks-rust among them.

  2. 2015

    The original repository emptied

    In August 2015 the repository's default branch was cut down to a single line, “Removed according to regulations”. Development went on in the ports.

  3. 2017

    AEAD ciphers

    SIP004, proposed in January 2017, replaced stream ciphers with AEAD ciphers that detect tampering; SIP007 added a separate key for every session.

  4. 2020

    Active probing explained

    An IMC 2020 paper by GFW Report showed how the Great Firewall replays and probes suspected servers. Outline added a replay defence the same year.

  5. 2021

    Real-time blocking

    From 6 November 2021 the Great Firewall blocked fully encrypted traffic, Shadowsocks included, by looking at the first packet alone.

  6. 2022

    Shadowsocks 2022

    SIP022, proposed in May 2022: base64 keys, BLAKE3 key derivation, timestamps with mandatory replay protection, new UDP sessions. SIP023 added several users on one port.

How Shadowsocks works

The client part, ss-local in the original, listens on your device like a SOCKS5 proxy. It encrypts each connection with the shared key and sends it to the server, which decrypts it, connects to the destination and sends the answer back the same way. UDP is relayed too, packet by packet.

There is no handshake. In the AEAD edition a TCP connection starts with a random salt, a session key is derived from the salt and the master key with HKDF-SHA1, and the data follows in chunks: an encrypted two-byte length with its 16-byte tag, then up to 16,383 bytes of payload with its tag. Nothing on the wire says Shadowsocks.

Stream, AEAD and 2022 ciphers

The method in a config or a link picks one of three generations, and it must match on both sides to the letter. AES and ChaCha20 are equally safe: AES is faster on processors with AES instructions, which means almost any computer or server, ChaCha20 on the rest. The optional 2022-blake3-chacha20-poly1305 is built differently: XChaCha20-Poly1305 with the key itself and a random nonce for every message.

  • Stream ciphers, 2012

    Methodsrc4-md5, aes-256-cfb, chacha20-ietf and others

    KeyAny password

    StatusDeprecated: no integrity check, open to probing

  • AEAD, 2017 (SIP004)

    Methodschacha20-ietf-poly1305, aes-256-gcm, aes-128-gcm

    KeyAny password, stretched into a key

    StatusFine for older clients; Outline uses only these

  • 2022 edition (SIP022)

    Methods2022-blake3-aes-128-gcm, 2022-blake3-aes-256-gcm; optional 2022-blake3-chacha20-poly1305

    KeyBase64 of exactly 16 bytes for aes-128, 32 for the rest

    StatusFor new servers

  • Keys, not passwords: random bytes in base64, made with openssl rand -base64 16 or 32; a made-up word fails with a key-length error. Session keys come from BLAKE3 in key-derivation mode instead of HKDF-SHA1.
  • Replay protection: every header carries a timestamp, anything more than 30 seconds off counts as a replay, and the server remembers each salt for 60 seconds. A recorded connection can't be played back, and a device with a wrong clock can't connect.
  • Quiet on bad data: salt and header are read in one call, so a probe can't learn how many bytes the server took. Requests carry 0 to 900 bytes of padding.
  • UDP sessions: each has a random ID and a packet counter, and the server follows the client's last address, so a session survives a change of network.
  • Still no forward secrecy, as the specification says: whoever gets the key can decrypt traffic recorded earlier.

An ss:// link, field by field

Links follow SIP002: ss://userinfo@host:port, then an optional /?plugin=… and a #name. The userinfo is the method and the key joined by a colon. For stream and AEAD ciphers it is usually base64url; for 2022 ciphers it must not be, and the method and key are written as they are, percent-encoded. Both addresses are from a range reserved for examples.

Example
ss://YWVzLTEyOC1nY206dGVzdA@203.0.113.5:8388#Classic
Example
ss://2022-blake3-aes-128-gcm:N93qBodM%2B0lobwe9Yptlrg%3D%3D@203.0.113.5:8388#Edition-2022
Linux or macOS: what is inside the base64 part
echo 'YWVzLTEyOC1nY206dGVzdA==' | base64 -d

The answer is aes-128-gcm:test. Add one or two = at the end if the length isn't a multiple of four.

Windows: PowerShell
[Text.Encoding]::UTF8.GetString([Convert]::FromBase64String('YWVzLTEyOC1nY206dGVzdA=='))
  • YWVzLTEyOC1nY206dGVzdA: base64 of aes-128-gcm:test. It is an encoding, not protection: anyone who sees the link knows the key.
  • %2B, %2F, %3D: the +, / and = of a base64 key. If a chat app turned them into something else, the key is broken.
  • /?plugin=: a SIP003 plugin and its options, such as obfs-local%3Bobfs%3Dhttp. The server needs the same plugin.
  • The old form packs everything, address and port included, into one piece of base64 after ss://. Clients still read it.

Outline keys, online configs and plugins

Outline is Shadowsocks with AEAD ciphers only, plus a manager that runs the server and hands out keys. Its static key is an ordinary ss:// link, often with /?outline=1. Since Outline Client 1.9.0 a key may carry prefix=: up to 16 bytes the salt starts with, so the stream begins like HTTP, TLS or SSH (in ss:// links, for TCP only).

An ssconf:// key is an address: the client replaces ssconf:// with https://, downloads the file and reads the server from it, so the owner can move the server without new keys. The file holds an ss:// link, a JSON object with server, server_port, password and method, or, for Outline Client 1.15 and newer, YAML. Deleting the file doesn't revoke a key; that is done on the server.

SIP008 is the Shadowsocks project's own format for the same idea, closer to a subscription: a JSON document fetched over HTTPS, with version 1 and a list of servers. Outline's ssconf:// files are a different, simpler format.

config.json
{
  "version": 1,
  "servers": [
    {
      "id": "6b1f3d2a-8c4e-4f7a-9b2d-0e5c7a9f1d34",
      "remarks": "Server-1",
      "server": "203.0.113.5",
      "server_port": 8388,
      "password": "N93qBodM+0lobwe9Yptlrg==",
      "method": "2022-blake3-aes-128-gcm"
    }
  ]
}

A SIP003 plugin is a separate program that wraps Shadowsocks in something else: simple-obfs (obfs-local) in HTTP or TLS look-alikes, v2ray-plugin in WebSocket, optionally with TLS. Both ends need the same plugin, and sing-box has only these two built in.

What a censor sees

On the wire Shadowsocks is a TCP or UDP stream of random-looking bytes to an IP address and port: no domain, no certificate, no fixed byte to match. Two studies showed how the Great Firewall of China deals with it anyway.

Active probing (IMC 2020). GFW Report, with Jan Beznazwy and Amir Houmansadr, found that the firewall flags candidates by the length and entropy of the first data packet, then probes the server: replays of that packet, exact or slightly changed, and random data. They logged 51,837 probes of seven kinds from 12,300 Chinese addresses. Servers that reacted to probes differently from a closed port gave themselves away, stream ciphers most easily. Their advice, AEAD only, replay filters and one reaction to any bad data, is built into the 2022 edition.

Blocking fully encrypted traffic (USENIX Security 2023). From 6 November 2021 the firewall blocked such traffic in real time, with no probing. Wu et al. worked out the rule: a connection passes if its first packet looks like something, meaning 3.4 or fewer, or 4.6 or more, set bits per byte on average; printable ASCII in the first six bytes; more than half printable; a printable run over 20 bytes; or the start of TLS or HTTP. The rest is blocked, though only in about a quarter of cases and only towards popular hosting ranges, and then that server's IP and port stay closed to the client for about 180 seconds.

Shadowsocks 2022 changes the cryptography, not the look, so the same rules apply to it. The answers so far are workarounds: Outline's prefix and similar options in shadowsocks-rust and V2Ray make the first bytes printable or TLS-like, and the paper notes that UDP was not affected. Whether a given network blocks Shadowsocks today has to be tested.

If Shadowsocks doesn't connect

  • A 2022 key works on one device, not on another

    CauseThe clock is more than 30 seconds out

    What to doTurn on automatic time

  • The program complains about the key length

    CauseThe key doesn't fit the method: 16 bytes for aes-128, 32 for the others

    What to doMake a key of the right size on the server and send the link again

  • Connected, nothing opens, no error

    CauseWrong key or method: the server simply keeps silent

    What to doCompare both letter by letter

  • A 2022 link is refused though it looks right

    CauseThe method and key were packed into base64, which this edition doesn't allow

    What to doWrite them as they are, with %2B, %2F and %3D

Strengths and weaknesses

Strengths

  • No handshake, certificate or domain: a server needs only a port and a key.
  • Low overhead: one AEAD layer, 34 bytes per chunk of up to 16 KB.
  • Carries TCP and UDP, and 2022 UDP sessions survive a change of network.
  • Supported almost everywhere: shadowsocks-rust, Outline, Xray, V2Ray, sing-box and mihomo.

Weaknesses

  • A random-looking stream is itself a signal: China has blocked such traffic in real time since November 2021.
  • No forward secrecy: a stolen key opens traffic recorded earlier.
  • 2022 keys fail on devices whose clock is more than 30 seconds off.
  • Plugins, Outline prefixes and dynamic keys don't work in every client.

Where it works

Programs and servers from our comparison tables that list this protocol.

Clients

  • Happ
  • Hiddify
  • v2RayTun
  • INCY
  • Karing
  • v2rayNG
  • v2rayN
  • NekoBox for Android
  • NekoRay
  • Throne
  • V2Box
  • AmneziaVPN
  • Clash Verge Rev
  • Clash Party
  • FlClash
  • Shadowrocket
  • Stash
  • mihomo
  • sing-box
  • podkop
  • PassWall
  • PassWall 2
  • OpenClash

Servers and panels

  • 3X-UI
  • Marzban
  • Remnawave
  • S-UI
  • Hiddify Manager
  • Outline

Compare these programs

Sources

How we write and check

In Veli

Shadowsocks and Outline keys in Veli

Profiles → Add takes ss:// links, classic and 2022, Outline ss:// and ssconf:// keys, and subscriptions with ss:// lines. Behind an ssconf:// address Veli reads an ss:// link or JSON; the YAML form isn't read yet. Shadowsocks connects on Windows, macOS, Linux and Android, and the rules of Apps and sites work on it. On a phone a key with a plugin is refused, and the app names the plugin.

On your own server Veli installs Shadowsocks over SSH by itself: the 2022 edition with 2022-blake3-aes-128-gcm and a separate key for each device, so one device can be removed without touching the others.

Questions

Is Shadowsocks a VPN or a proxy?

A proxy: it forwards connections through an encrypted channel. It works like a VPN only when a client app captures all of a device's traffic and sends it through Shadowsocks.

What is the difference between Shadowsocks and SOCKS5?

SOCKS5 (RFC 1928) is a plain proxy protocol: its handshake, login and password (RFC 1929) and data usually travel in the clear. Shadowsocks borrows its address format and keeps SOCKS5 only on your device, as the door for apps, while everything sent over the network is encrypted with a shared key.

What is Shadowsocks 2022?

The 2022 edition (SIP022): methods named 2022-blake3-…, base64 keys instead of passwords, BLAKE3 key derivation and mandatory replay protection with timestamps. It doesn't talk to the older ciphers, so both sides need the same method.

Shadowsocks vs ShadowsocksR: what is the difference?

ShadowsocksR is a separate fork with its own protocol and obfs settings and ssr:// links, and it doesn't work with Shadowsocks servers. Its main repositories have seen little work for years; sing-box removed it in 1.6.0, mihomo still reads it.

Is Shadowsocks the same as Outline?

Outline is built on Shadowsocks: its keys are ss:// links with AEAD ciphers. It adds a server manager, dynamic ssconf:// keys and connection prefixes.

Shadowsocks or V2Ray?

Different kinds of thing: V2Ray and Xray are programs that speak many protocols, Shadowsocks among them, besides their own VMess and VLESS. A Shadowsocks server can run on any of them, or on shadowsocks-rust.