[GH-ISSUE #4097] ECH config generated for Hysteria2 inbound has empty public_name, causing RFC 9180 violation and connection failure in sing-box clients #2778

Closed
opened 2026-10-31 20:27:53 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @cat-of-summer on GitHub (Apr 24, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4097

Describe the bug

When creating a Hysteria2 inbound with ECH (Encrypted Client Hello) enabled, 3x-ui generates an echConfigList where the public_name field is empty (zero length). According to https://www.rfc-editor.org/rfc/rfc9180 and the
https://www.ietf.org/archive/id/draft-ietf-tls-esni-18.txt:

▎ If the length of the public_name field is 0, the client MUST treat the corresponding ECHConfig as invalid and skip it.

Clients that strictly follow the RFC (such as sing-box via Go's crypto/tls) parse the config list, discard the only entry due to empty public_name, end up with an empty valid-config list, and fail with:

CRYPTO_ERROR 0x150 (local): tls: EncryptedClientHelloConfigList contains no valid configs

How to repeat the problem?

  1. Create a Hysteria2 inbound with ECH enabled
  2. Copy the client link — the ech= parameter contains a base64-encoded ECHConfigList
  3. Decode the base64 and inspect the binary structure — public_name length byte is 0x00
  4. Try to connect from any RFC-compliant client (e.g. sing-box / v2rayN with sing-box core)

Expected action

The generated echConfigList should contain a non-empty public_name (the outer SNI used in the unencrypted part of the ClientHello, e.g. google.com or the server's own hostname).

Received action

public_name is empty. Binary structure of the generated config (decoded from the ech= URL parameter):

00 53 — ECHConfigList total length: 83
FE 0D — version: 0xFE0D (draft-13 / RFC)
00 4F — ECHConfig content length: 79
00 — config_id
00 20 — KEM ID: DHKEM(X25519, HKDF-SHA256)
00 20 — public key length: 32
FF 37 ... — 32-byte X25519 public key
00 24 — cipher suites length: 36 (9 suites)
... suites ...
00 — maximum_name_length: 0
00 — public_name length: 0 ← BUG: must not be 0
— (no public_name bytes)
00 00 — extensions length: 0

3x-ui Version

3x-ui panel (latest)

Xray-core Version

Xray-core: 26.4.17, Client: sing-box 1.13.11 (built with with_utls, with_quic), Protocol: Hysteria2

Checklist

  • This bug report is written entirely in English.
  • This bug report is new and no one has reported it before me.
Originally created by @cat-of-summer on GitHub (Apr 24, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4097 ### Describe the bug When creating a Hysteria2 inbound with ECH (Encrypted Client Hello) enabled, 3x-ui generates an echConfigList where the public_name field is empty (zero length). According to https://www.rfc-editor.org/rfc/rfc9180 and the https://www.ietf.org/archive/id/draft-ietf-tls-esni-18.txt: ▎ If the length of the public_name field is 0, the client MUST treat the corresponding ECHConfig as invalid and skip it. Clients that strictly follow the RFC (such as sing-box via Go's crypto/tls) parse the config list, discard the only entry due to empty public_name, end up with an empty valid-config list, and fail with: CRYPTO_ERROR 0x150 (local): tls: EncryptedClientHelloConfigList contains no valid configs ### How to repeat the problem? 1. Create a Hysteria2 inbound with ECH enabled 2. Copy the client link — the ech= parameter contains a base64-encoded ECHConfigList 3. Decode the base64 and inspect the binary structure — public_name length byte is 0x00 4. Try to connect from any RFC-compliant client (e.g. sing-box / v2rayN with sing-box core) ### Expected action The generated echConfigList should contain a non-empty public_name (the outer SNI used in the unencrypted part of the ClientHello, e.g. google.com or the server's own hostname). ### Received action public_name is empty. Binary structure of the generated config (decoded from the ech= URL parameter): 00 53 — ECHConfigList total length: 83 FE 0D — version: 0xFE0D (draft-13 / RFC) 00 4F — ECHConfig content length: 79 00 — config_id 00 20 — KEM ID: DHKEM(X25519, HKDF-SHA256) 00 20 — public key length: 32 FF 37 ... — 32-byte X25519 public key 00 24 — cipher suites length: 36 (9 suites) ... suites ... 00 — maximum_name_length: 0 00 — public_name length: 0 ← BUG: must not be 0 — (no public_name bytes) 00 00 — extensions length: 0 ### 3x-ui Version 3x-ui panel (latest) ### Xray-core Version Xray-core: 26.4.17, Client: sing-box 1.13.11 (built with with_utls, with_quic), Protocol: Hysteria2 ### Checklist - [x] This bug report is written entirely in English. - [x] This bug report is new and no one has reported it before me.
bsakaguchi 2026-10-31 20:27:53 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@antonmarin commented on GitHub (Nov 4, 2026):

Hi! Is it fixed or there is some workaround?

<!-- gh-comment-id:6628401315 --> @antonmarin commented on GitHub (Nov 4, 2026): Hi! Is it fixed or there is some workaround?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#2778
No description provided.