[Feature] ECH (Encrypted Client Hello) Support — Subscription Import & SNI Leak Elimination
Background
TLS 1.3 encrypts payload, but the Client Hello handshake still exposes the target hostname via plaintext SNI. For users operating in hostile network environments, this single leak is sufficient for:
- Targeted blocking of subscription endpoints via SNI pattern matching
- Traffic fingerprinting even when payload content is fully encrypted
- Correlation attacks linking subscription fetch behavior to downstream activity
ECH (Encrypted Client Hello, RFC draft) closes this gap by encrypting the inner ClientHello under the server's public key, presenting only an innocuous "outer" hostname to on-path observers.
This issue tracks ECH implementation across OneBox and OneBoxM clients.
Scope
1. Subscription Import — Blind Fetch
Subscription URLs are currently fetched with plaintext SNI. This is the highest-risk exposure point: a blocked subscription URL means the client cannot update configurations at all.
Target behavior:
- Resolve
HTTPS/SVCBDNS records for subscription hostnames to retrieveech=config - Perform ECH-capable TLS handshake when server advertises ECH support
- Fallback gracefully when ECH is unsupported (with user-visible warning, not silent downgrade)
2. DNS Prerequisites
ECH is only effective when DNS resolution itself is private. SNI-level protection is meaningless if the DNS query leaks the hostname in plaintext first.
Required:
- Default to DoH (DNS-over-HTTPS) for all subscription and API resolution
- Support user-configurable DoH resolvers
- Block plaintext DNS fallback when ECH mode is active
3. Client Rollout Plan
ECH support will be shipped incrementally, prioritizing platforms where the network stack is most mature:
| Client | Platform | Priority | Status |
|---|---|---|---|
| OneBox | macOS | P0 | ⬜ Planned |
| OneBoxM | iOS | P0 | ⬜ Planned |
| OneBox | Windows | P1 | ⬜ Planned |
| OneBoxM | Android | P1 | ⬜ Planned |
| OneBox | Linux | P2 | ⬜ Planned |
Technical Constraints
ECH protects the TLS handshake. It does not protect:
- IP-level traffic patterns and timing
- Connection frequency / burst behavior
- The transport layer below TLS
Users who require genuine network-layer anonymity will need to consider their full transport stack independently. OneBox's role is to ensure the application layer contributes zero avoidable metadata.
We build the lock. The door is the user's choice.
Implementation Notes
Dependency: ECH requires a TLS library with BoringSSL or equivalent support. Evaluate:
rustls+aws-lc-rs(ECH support in progress upstream)- Custom-built OpenSSL/quictls with ECH patches
go-boringif the core is Go-based
Stale config handling: Client must handle outdated ech_config gracefully — retry with a fresh DNS resolution before surfacing a hard error to the user.
Interoperability: Test against Cloudflare-fronted domains (current largest ECH deployment) as the baseline compatibility target.
Open Questions
- [ ] How should the client behave when ECH config is advertised but the fetch fails? Silent fallback vs hard error?
- [ ] Should ECH mode be opt-in initially, or default-on with opt-out?
- [ ] How do we handle the latency cost of ECH on first connection in high-latency environments?
References
[Feature] ECH(加密客户端握手)支持 —— 订阅导入盲取与 SNI 泄漏消除
标签: enhancement privacy networking RFC
背景
TLS 1.3 加密了传输内容,但 Client Hello 握手阶段仍以明文形式暴露目标主机名(SNI)。对于处于高度管控网络环境中的用户,这一处泄漏已足够造成:
- 通过 SNI 模式匹配对订阅接口实施精准封锁
- 在载荷内容完全加密的情况下仍可还原流量指纹
- 通过订阅拉取行为与下游活动的关联分析进行溯源
ECH(Encrypted Client Hello,RFC 草案)通过将内层 ClientHello 使用服务端公钥加密,仅向中间节点暴露无害的"外层"主机名,从根本上消除这一泄漏。
本 Issue 追踪 ECH 在 OneBox 与 OneBoxM 客户端上的实现进度。
范围
1. 订阅导入 —— 盲取模式
订阅 URL 当前以明文 SNI 发起请求,是风险暴露面最高的节点:订阅接口一旦被封锁,客户端将无法更新任何配置。
目标行为:
- 解析订阅域名的
HTTPS/SVCBDNS 记录以获取ech=配置 - 服务端声明 ECH 支持时,执行具备 ECH 能力的 TLS 握手
- 不支持 ECH 时优雅降级,向用户显示明确警告,而非静默回退
2. DNS 前置条件
ECH 的有效性依赖于 DNS 解析过程本身的私密性。若 DNS 查询以明文泄露主机名,SNI 层面的保护形同虚设。
必须实现:
- 所有订阅与 API 解析默认使用 DoH(DNS over HTTPS)
- 支持用户自定义 DoH 解析服务器
- ECH 模式激活时,阻断明文 DNS 回退
3. 客户端推进计划
ECH 支持将分阶段落地,优先在网络栈最为成熟的平台上完成实现:
| 客户端 | 平台 | 优先级 | 状态 |
|---|---|---|---|
| OneBox | macOS | P0 | ⬜ 计划中 |
| OneBoxM | iOS | P0 | ⬜ 计划中 |
| OneBox | Windows | P1 | ⬜ 计划中 |
| OneBoxM | Android | P1 | ⬜ 计划中 |
| OneBox | Linux | P2 | ⬜ 计划中 |
技术约束
ECH 保护 TLS 握手过程,但它不保护:
- IP 层流量模式与时序特征
- 连接频率与突发行为
- TLS 之下的传输层
需要真正实现网络层匿名的用户,必须独立评估其完整的传输链路。OneBox 的职责边界是确保应用层不产生任何可避免的元数据泄漏。
我们造锁。门,是用户自己的选择。
实现说明
依赖项: ECH 需要支持 BoringSSL 或同等能力的 TLS 库,待评估方案:
rustls+aws-lc-rs(上游 ECH 支持进行中)- 基于 ECH 补丁的自定义构建 OpenSSL/quictls
- Go 技术栈可考虑
go-boring
过期配置处理: 客户端须优雅处理过期的 ech_config——建议在向用户报错前,先刷新 DNS 解析后重试。
互操作性: 以 Cloudflare 托管域名(当前最大规模 ECH 部署)作为基准兼容性测试目标。
待讨论问题
- [ ] 当 ECH 配置声明存在但拉取失败时,客户端应静默降级还是直接报错?
- [ ] ECH 模式初期应设为手动开启,还是默认开启并允许关闭?
- [ ] 在高延迟环境下,如何优化 ECH 首次连接的握手延迟?