REALITY aborts an authenticated session when dest returns HelloRetryRequest
Author: AsmirCreated Sep 28, 2026Updated Sep 29, 2026
### Integrity requirements
- [x] I have read all the comments in the issue template and ensured that this issue meet the requirements.
- [x] I confirm that I have read the documentation, understand the meaning of all the configuration items I wrote, and did not pile up seemingly useful options or default values.
- [x] I provided the complete config and logs, rather than just providing the truncated parts based on my own judgment.
- [x] I searched issues and did not find any similar issues.
- [x] The problem can be successfully reproduced in the latest Release
### Description
REALITY authenticates the client, then mirrors the ClientHello to dest. The proxied handshake continues only when that flight is a TLS 1.3 ServerHello whose key_share is X25519 (32 bytes) or X25519MLKEM768. Any other flight is treated as an incorrect ServerHello: handshakeLen[0] stays 0 and, even though hs.c.conn == conn, the server splices a raw pipe to dest and never starts the VLESS session.
consent.yahoo.com:443 answers that mirrored ClientHello with HelloRetryRequest (selected_group secp256r1, 0x0017). The record is 166 bytes.
The check is in github.com/xtls/reality tls.go (commit 9234c772ba8f, the module used by Xray 26.3.27):
if !hs.hello.unmarshal(s2cSaved[recordHeaderLen:handshakeLen]) ||
hs.hello.vers != VersionTLS12 || hs.hello.supportedVersion != VersionTLS13 ||
cipherSuiteTLS13ByID(hs.hello.cipherSuite) == nil ||
(!(hs.hello.serverShare.group == X25519 && len(hs.hello.serverShare.data) == 32) &&
!(hs.hello.serverShare.group == X25519MLKEM768 && len(hs.hello.serverShare.data) == mlkem.CiphertextSize768+32)) {
break f
}
HelloRetryRequest has no key share of that shape, so this breaks. The fallback is the block commented “if the target sent an incorrect Server Hello”, which raw-forwards to dest. The error path then is target sent incorrect server hello or handshake incomplete.
Recognizing the HRR random is not enough for this dest. After the retry, Yahoo’s ServerHello uses secp256r1, which fails the same allow-list. A fix needs to mirror HRR and the second ClientHello (the REALITY session id must stay the authenticator) and accept the ServerHello that follows, including secp256r1.
### Reproduction Method
1. Start the server and client configs below with Xray 26.3.27. realitySettings.show is true, log level is debug, dnsLog is true.
2. curl -x socks5h://127.0.0.1:1080 consent.yahoo.com
3. The server log shows hs.c.conn == conn: true and Server Hello: 166, then the connection is not proxied.
### Client config
### Server config
### Client log
### Server log
{
"log": { "loglevel": "debug", "dnsLog": true },
"inbounds": [{
"listen": "127.0.0.1",
"port": 1080,
"protocol": "socks",
"settings": { "udp": false }
}],
"outbounds": [{
"protocol": "vless",
"settings": {
"vnext": [{
"address": "127.0.0.1",
"port": 443,
"users": [{
"id": "6c1e0b4a-9f27-4d5e-8a13-2b7c9d0e4f61",
"encryption": "none",
"flow": "xtls-rprx-vision"
}]
}]
},
"streamSettings": {
"network": "tcp",
"security": "reality",
"realitySettings": {
"show": true,
"fingerprint": "chrome",
"serverName": "consent.yahoo.com",
"publicKey": "b12PulcAi-gb9Nms8O42ewxEnDtsxKiMKGmZdHkqKV4",
"shortId": "c3a91f07e25b4d86"
}
}
}]
}
{
"log": { "loglevel": "debug", "dnsLog": true },
"inbounds": [{
"listen": "127.0.0.1",
"port": 443,
"protocol": "vless",
"settings": {
"clients": [{
"id": "6c1e0b4a-9f27-4d5e-8a13-2b7c9d0e4f61",
"flow": "xtls-rprx-vision"
}],
"decryption": "none"
},
"streamSettings": {
"network": "tcp",
"security": "reality",
"realitySettings": {
"show": true,
"dest": "consent.yahoo.com:443",
"serverNames": ["consent.yahoo.com"],
"privateKey": "SOir5guA9kxxeBdtlAiMscseM9m-GEnz1QrexDnneUs",
"shortIds": ["c3a91f07e25b4d86"]
}
}
}],
"outbounds": [{ "protocol": "freedom" }]
}
Xray 26.3.27 (Xray, Penetrates Everything.) d2758a0 (go1.26.1 darwin/arm64)
A unified platform for anti-censorship.
2026/09/28 09:58:24.037671 [Info] infra/conf/serial: Reading config: &{Name:/tmp/xray_hrr/client.json Format:json}
2026/09/28 09:58:24.040302 [Debug] app/log: Logger started
2026/09/28 09:58:24.040718 [Debug] app/proxyman/inbound: creating stream worker on 127.0.0.1:1080
2026/09/28 09:58:24.040726 [Debug] app/proxyman/inbound: creating stream worker on 127.0.0.1:1081
2026/09/28 09:58:24.041567 [Info] transport/internet/tcp: listening TCP on 127.0.0.1:1080
2026/09/28 09:58:24.041589 [Info] transport/internet/tcp: listening TCP on 127.0.0.1:1081
2026/09/28 09:58:24.042054 [Warning] core: Xray 26.3.27 started
2026/09/28 09:58:24.193718 [Info] [1464981268] proxy/socks: TCP Connect request to tcp:www.example.com:443
2026/09/28 09:58:24.193751 [Info] [1464981268] app/dispatcher: taking detour [out-google] for [tcp:www.example.com:443]
2026/09/28 09:58:24.193750 from tcp:127.0.0.1:60050 accepted tcp:www.example.com:443 [socks-google -> out-google]
2026/09/28 09:58:24.194286 [Info] [1464981268] transport/internet/tcp: dialing TCP to tcp:127.0.0.1:8444
2026/09/28 09:58:24.194505 [Debug] [1464981268] transport/internet: dialing to tcp:127.0.0.1:8444
2026/09/28 09:58:24.275916 [Info] [1464981268] proxy/vless/outbound: tunneling request to tcp:www.example.com:443 via 127.0.0.1:8444
2026/09/28 09:58:24.276292 [Debug] [1464981268] proxy: XtlsFilterTls found tls client hello! 325
2026/09/28 09:58:24.276305 [Debug] [1464981268] proxy: XtlsPadding 325 996 0
2026/09/28 09:58:29.390877 [Debug] [1464981268] proxy: Xtls Unpadding new block, content 1440 padding 255 command 0
2026/09/28 09:58:29.390896 [Debug] [1464981268] proxy: XtlsFilterTls found tls 1.3! 1163 TLS_CHACHA20_POLY1305_SHA256
2026/09/28 09:58:29.393636 [Debug] [1464981268] proxy: Xtls Unpadding new block, content 2534 padding 6 command 0
2026/09/28 09:58:29.397693 [Debug] [1464981268] proxy: XtlsPadding 64 1054 0
2026/09/28 09:58:29.398013 [Debug] [1464981268] proxy: XtlsPadding 86 1028 2
2026/09/28 09:58:29.421674 [Debug] [1464981268] proxy: Xtls Unpadding new block, content 71 padding 962 command 2
2026/09/28 09:58:29.421693 [Debug] [1464981268] proxy: CopyRawConn (maybe) readv
2026/09/28 09:58:29.465066 [Info] [1582724813] proxy/socks: TCP Connect request to tcp:www.example.com:443
2026/09/28 09:58:29.465100 [Info] [1582724813] app/dispatcher: taking detour [out-yahoo] for [tcp:www.example.com:443]
2026/09/28 09:58:29.465117 [Info] [1582724813] transport/internet/tcp: dialing TCP to tcp:127.0.0.1:8443
2026/09/28 09:58:29.465172 [Debug] [1582724813] transport/internet: dialing to tcp:127.0.0.1:8443
2026/09/28 09:58:29.465080 from tcp:127.0.0.1:60066 accepted tcp:www.example.com:443 [socks-yahoo -> out-yahoo]
2026/09/28 09:58:29.670550 [Error] [1582724813] transport/internet/reality: REALITY: received real certificate (potential MITM or redirection)
2026/09/28 09:58:29.670632 [Info] [1582724813] transport/internet/tcp: dialing TCP to tcp:127.0.0.1:8443
2026/09/28 09:58:29.670649 [Debug] [1582724813] transport/internet: dialing to tcp:127.0.0.1:8443
2026/09/28 09:58:29.889725 [Error] [1582724813] transport/internet/reality: REALITY: received real certificate (potential MITM or redirection)
2026/09/28 09:58:30.090890 [Info] [1582724813] transport/internet/tcp: dialing TCP to tcp:127.0.0.1:8443
2026/09/28 09:58:30.091024 [Debug] [1582724813] transport/internet: dialing to tcp:127.0.0.1:8443
2026/09/28 09:58:30.292690 [Error] [1582724813] transport/internet/reality: REALITY: received real certificate (potential MITM or redirection)
2026/09/28 09:58:30.693812 [Info] [1582724813] transport/internet/tcp: dialing TCP to tcp:127.0.0.1:8443
2026/09/28 09:58:30.693838 [Debug] [1582724813] transport/internet: dialing to tcp:127.0.0.1:8443
2026/09/28 09:58:30.897984 [Error] [1582724813] transport/internet/reality: REALITY: received real certificate (potential MITM or redirection)
2026/09/28 09:58:31.499542 [Info] [1582724813] transport/internet/tcp: dialing TCP to tcp:127.0.0.1:8443
2026/09/28 09:58:31.499676 [Debug] [1582724813] transport/internet: dialing to tcp:127.0.0.1:8443
2026/09/28 09:58:31.697968 [Error] [1582724813] transport/internet/reality: REALITY: received real certificate (potential MITM or redirection)
2026/09/28 09:58:32.500630 [Info] [1582724813] app/proxyman/outbound: app/proxyman/outbound: failed to process outbound traffic > proxy/vless/outbound: failed to find an available destination > common/retry: [transport/internet/reality: REALITY: processed invalid connection] > common/retry: all retry attempts failed
2026/09/28 09:58:33.153071 [Debug] app/log: Logger closing
Xray 26.3.27 (Xray, Penetrates Everything.) d2758a0 (go1.26.1 darwin/arm64)
A unified platform for anti-censorship.
2026/09/28 09:58:24.037671 [Info] infra/conf/serial: Reading config: &{Name:/tmp/xray_hrr/server.json Format:json}
2026/09/28 09:58:24.039907 [Warning] infra/conf: REALITY: Listening on non-443 ports may get your IP blocked by the GFW
2026/09/28 09:58:24.040066 [Warning] infra/conf: REALITY: Listening on non-443 ports may get your IP blocked by the GFW
2026/09/28 09:58:24.040301 [Debug] app/log: Logger started
2026/09/28 09:58:24.040719 [Debug] app/proxyman/inbound: creating stream worker on 127.0.0.1:8443
2026/09/28 09:58:24.040726 [Debug] app/proxyman/inbound: creating stream worker on 127.0.0.1:8444
2026/09/28 09:58:24.041568 [Info] transport/internet/tcp: listening TCP on 127.0.0.1:8443
2026/09/28 09:58:24.041615 [Info] transport/internet/tcp: listening TCP on 127.0.0.1:8444
2026/09/28 09:58:24.043198 [Warning] core: Xray 26.3.27 started
REALITY remoteAddr: 127.0.0.1:60051
REALITY remoteAddr: 127.0.0.1:60051 hs.c.AuthKey[:16]: [81 245 163 195 66 142 176 199 50 221 58 113 148 124 35 222] AEAD: *gcm.GCM
REALITY remoteAddr: 127.0.0.1:60051 hs.c.ClientVer: [26 3 27]
REALITY remoteAddr: 127.0.0.1:60051 hs.c.ClientTime: 2026-09-28 09:58:24 +0200 CEST
REALITY remoteAddr: 127.0.0.1:60051 hs.c.ClientShortId: [1 35 69 103 137 171 205 239]
REALITY remoteAddr: 127.0.0.1:60051 hs.c.conn == conn: true
REALITY remoteAddr: 127.0.0.1:60051 len(s2cSaved): 1400 Server Hello: 1215
REALITY remoteAddr: 127.0.0.1:60051 len(s2cSaved): 185 Change Cipher Spec: 6
REALITY remoteAddr: 127.0.0.1:60051 len(s2cSaved): 179 Encrypted Extensions: 4522
REALITY remoteAddr: 127.0.0.1:60051 is using X25519MLKEM768 for TLS' communication: true
REALITY remoteAddr: 127.0.0.1:60051 is using ML-DSA-65 for cert's extra signature: false
REALITY remoteAddr: 127.0.0.1:60051 hs.handshake() err:
REALITY remoteAddr: 127.0.0.1:60051 hs.readClientFinished() err:
REALITY remoteAddr: 127.0.0.1:60051 len(postHandshakeRecord): 962
REALITY remoteAddr: 127.0.0.1:60051 len(postHandshakeRecord): 62
REALITY remoteAddr: 127.0.0.1:60051 hs.c.isHandshakeComplete.Load(): true
2026/09/28 09:58:29.278768 [Info] [2453057225] proxy/vless/inbound: firstLen = 1186
2026/09/28 09:58:29.278906 [Info] [2453057225] proxy/vless/inbound: received request for tcp:www.example.com:443
2026/09/28 09:58:29.278936 [Info] [2453057225] app/dispatcher: default route for tcp:www.example.com:443
2026/09/28 09:58:29.279088 from 127.0.0.1:60051 accepted tcp:www.example.com:443
2026/09/28 09:58:29.279123 [Info] [2453057225] transport/internet/tcp: dialing TCP to tcp:www.example.com:443
2026/09/28 09:58:29.279139 [Debug] [2453057225] transport/internet: dialing to tcp:www.example.com:443
2026/09/28 09:58:29.361334 [Info] [2453057225] proxy/freedom: connection opened to tcp:www.example.com:443, local endpoint :60063, remote endpoint 172.66.147.243:443
2026/09/28 09:58:29.361395 [Debug] [2453057225] proxy: CopyRawConn (maybe) readv
2026/09/28 09:58:29.361410 [Debug] [2453057225] proxy: Xtls Unpadding new block, content 325 padding 996 command 0
2026/09/28 09:58:29.361425 [Debug] [2453057225] proxy: XtlsFilterTls found tls client hello! 325
2026/09/28 09:58:29.389694 [Debug] [2453057225] proxy: XtlsFilterTls found tls 1.3! 1440 TLS_CHACHA20_POLY1305_SHA256
2026/09/28 09:58:29.389731 [Debug] [2453057225] proxy: XtlsPadding 1440 255 0
2026/09/28 09:58:29.393557 [Debug] [2453057225] proxy: XtlsPadding 2534 6 0
2026/09/28 09:58:29.397775 [Debug] [2453057225] proxy: Xtls Unpadding new block, content 64 padding 1054 command 0
2026/09/28 09:58:29.398099 [Debug] [2453057225] proxy: Xtls Unpadding new block, content 86 padding 1028 command 2
2026/09/28 09:58:29.421559 [Debug] [2453057225] proxy: XtlsPadding 71 962 2
REALITY remoteAddr: 127.0.0.1:60067
REALITY remoteAddr: 127.0.0.1:60067 hs.c.AuthKey[:16]: [86 68 243 15 128 103 37 65 108 36 80 110 49 54 9 31] AEAD: *gcm.GCM
REALITY remoteAddr: 127.0.0.1:60067 hs.c.ClientVer: [26 3 27]
REALITY remoteAddr: 127.0.0.1:60067 hs.c.ClientTime: 2026-09-28 09:58:29 +0200 CEST
REALITY remoteAddr: 127.0.0.1:60067 hs.c.ClientShortId: [1 35 69 103 137 171 205 239]
REALITY remoteAddr: 127.0.0.1:60067 hs.c.conn == conn: true
REALITY remoteAddr: 127.0.0.1:60067 len(s2cSaved): 166 Server Hello: 166
REALITY remoteAddr: 127.0.0.1:60069
REALITY remoteAddr: 127.0.0.1:60067 hs.c.isHandshakeComplete.Load(): false
2026/09/28 09:58:29.729795 [Info] transport/internet/tcp: REALITY: processed invalid connection from 127.0.0.1:60067: target sent incorrect server hello or handshake incomplete
REALITY remoteAddr: 127.0.0.1:60069 hs.c.AuthKey[:16]: [234 224 235 174 200 96 197 242 111 48 11 38 202 160 90 36] AEAD: *gcm.GCM
REALITY remoteAddr: 127.0.0.1:60069 hs.c.ClientVer: [26 3 27]
REALITY remoteAddr: 127.0.0.1:60069 hs.c.ClientTime: 2026-09-28 09:58:29 +0200 CEST
REALITY remoteAddr: 127.0.0.1:60069 hs.c.ClientShortId: [1 35 69 103 137 171 205 239]
REALITY remoteAddr: 127.0.0.1:60069 hs.c.conn == conn: true
REALITY remoteAddr: 127.0.0.1:60069 len(s2cSaved): 166 Server Hello: 166
REALITY remoteAddr: 127.0.0.1:60069 hs.c.isHandshakeComplete.Load(): false
2026/09/28 09:58:29.955489 [Info] transport/internet/tcp: REALITY: processed invalid connection from 127.0.0.1:60069: target sent incorrect server hello or handshake incomplete
REALITY remoteAddr: 127.0.0.1:60071
REALITY remoteAddr: 127.0.0.1:60071 hs.c.AuthKey[:16]: [174 35 128 113 61 238 66 17 237 74 89 45 176 224 27 179] AEAD: *gcm.GCM
REALITY remoteAddr: 127.0.0.1:60071 hs.c.ClientVer: [26 3 27]
REALITY remoteAddr: 127.0.0.1:60071 hs.c.ClientTime: 2026-09-28 09:58:30 +0200 CEST
REALITY remoteAddr: 127.0.0.1:60071 hs.c.ClientShortId: [1 35 69 103 137 171 205 239]
REALITY remoteAddr: 127.0.0.1:60071 hs.c.conn == conn: true
REALITY remoteAddr: 127.0.0.1:60071 len(s2cSaved): 166 Server Hello: 166
REALITY remoteAddr: 127.0.0.1:60071 hs.c.isHandshakeComplete.Load(): false
2026/09/28 09:58:30.353256 [Info] transport/internet/tcp: REALITY: processed invalid connection from 127.0.0.1:60071: target sent incorrect server hello or handshake incomplete
REALITY remoteAddr: 127.0.0.1:60075
REALITY remoteAddr: 127.0.0.1:60075 hs.c.AuthKey[:16]: [244 199 55 150 165 20 156 175 66 125 129 193 89 4 175 230] AEAD: *gcm.GCM
REALITY remoteAddr: 127.0.0.1:60075 hs.c.ClientVer: [26 3 27]
REALITY remoteAddr: 127.0.0.1:60075 hs.c.ClientTime: 2026-09-28 09:58:30 +0200 CEST
REALITY remoteAddr: 127.0.0.1:60075 hs.c.ClientShortId: [1 35 69 103 137 171 205 239]
REALITY remoteAddr: 127.0.0.1:60075 hs.c.conn == conn: true
REALITY remoteAddr: 127.0.0.1:60075 len(s2cSaved): 166 Server Hello: 166
REALITY remoteAddr: 127.0.0.1:60075 hs.c.isHandshakeComplete.Load(): false
2026/09/28 09:58:30.959794 [Info] transport/internet/tcp: REALITY: processed invalid connection from 127.0.0.1:60075: target sent incorrect server hello or handshake incomplete
REALITY remoteAddr: 127.0.0.1:60077
REALITY remoteAddr: 127.0.0.1:60077 hs.c.AuthKey[:16]: [103 176 250 238 233 120 163 123 63 33 174 127 10 58 69 114] AEAD: *gcm.GCM
REALITY remoteAddr: 127.0.0.1:60077 hs.c.ClientVer: [26 3 27]
REALITY remoteAddr: 127.0.0.1:60077 hs.c.ClientTime: 2026-09-28 09:58:31 +0200 CEST
REALITY remoteAddr: 127.0.0.1:60077 hs.c.ClientShortId: [1 35 69 103 137 171 205 239]
REALITY remoteAddr: 127.0.0.1:60077 hs.c.conn == conn: true
REALITY remoteAddr: 127.0.0.1:60077 len(s2cSaved): 166 Server Hello: 166
REALITY remoteAddr: 127.0.0.1:60077 hs.c.isHandshakeComplete.Load(): false
2026/09/28 09:58:31.758641 [Info] transport/internet/tcp: REALITY: processed invalid connection from 127.0.0.1:60077: target sent incorrect server hello or handshake incomplete
2026/09/28 09:58:33.153073 [Debug] app/log: Logger closing
Source: XTLS/Xray-core