XTLS/Xray-core · error
the highest bit of the last byte of the peer-sent X25519…
Error message
the highest bit of the last byte of the peer-sent X25519 public key is not 0
What it means
Anti-censorship constraint in ServerInstance.Handshake: for an X25519 relay, the peer-sent public key's final byte has its high bit set (>127). The protocol deliberately rejects such keys (comment: avoiding elligator2 since a PSK exists) to keep the relay bytes indistinguishable from real TLS key shares; a set high bit marks the input as invalid or hostile.
Solutions
- Treat as protocol failure: close the connection (possibly a prober or corrupted handshake)
- Verify client and server share correct PSK/public key configuration
- Ensure client implementations respect the high-bit restriction when crafting relays
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at proxy/vless/encryption/server.go:151 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/0c32cf39879ad13d.
Report an issue: GitHub.
Appendix: source
Thrown at proxy/vless/encryption/server.go:151
var lastCTR cipher.Stream
for j, k := range i.NfsSKeys {
if lastCTR != nil {
lastCTR.XORKeyStream(relays, relays[:32]) // recover this relay
}
index := 32
if _, ok := k.(*mlkem.DecapsulationKey768); ok {
index = 1088
}
if i.XorMode > 0 {
NewCTR(i.NfsPKeysBytes[j], iv).XORKeyStream(relays, relays[:index]) // we don't use buggy elligator2, because we have PSK :)
}
if k, ok := k.(*ecdh.PrivateKey); ok {
publicKey, err := ecdh.X25519().NewPublicKey(relays[:index])
if err != nil {
return nil, err
}
if publicKey.Bytes()[31] > 127 { // we just don't want the observer can change even one bit without breaking the connection, though it has nothing to do with security
return nil, errors.New("the highest bit of the last byte of the peer-sent X25519 public key is not 0")
}
nfsKey, err = k.ECDH(publicKey)
if err != nil {
return nil, err
}
}
if k, ok := k.(*mlkem.DecapsulationKey768); ok {
var err error
nfsKey, err = k.Decapsulate(relays[:index])
if err != nil {
return nil, err
}
}
if j == len(i.NfsSKeys)-1 {
break
}
relays = relays[index:]
lastCTR = NewCTR(nfsKey, iv)View on GitHub (pinned to 7d214f8b09)