[GH-ISSUE #5077] [Bug]: Hysteria2 subscription link contains invalid ech parameter and fails in v2rayN/sing-box #3574

Closed
opened 2026-10-31 20:33:26 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @GrandpaNiuu on GitHub (Jun 8, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5077

Describe the bug

In 3x-ui v3.2.8, when creating a Hysteria2 inbound with TLS enabled, the generated share/subscription link includes an ech= parameter.

The generated Hysteria2 link fails in v2rayN 7.22.5. The latency test shows -1, and the node cannot connect.

However, if I manually remove the ech= parameter from the same Hysteria2 link, the node works normally in v2rayN.

Example generated link:

hysteria2://0123456789abcdef0123456789abcdef@hy2.example.com:443?alpn=h3&ech=AID%2BDQB8AAAgACCRxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&fp=chrome&security=tls&sni=hy2.example.com#US-HY2-Test

After removing ech=, the same node works:

hysteria2://0123456789abcdef0123456789abcdef@hy2.example.com:443?security=tls&sni=hy2.example.com#US-HY2-Test

The generated ECH value seems invalid. After decoding it, it appears to contain a server-side certificate path-like value, for example:

/root/cert/hy2.example.com/fullchain.pem

A local server certificate path should not be included in the client subscription link as part of the ECH configuration.

This issue looks related to Hysteria2 share/subscription link generation, especially the ech parameter.

How to reproduce the problem

  1. Install 3x-ui v3.2.8 on a clean server.

  2. Create a new Hysteria2 inbound.

  3. Enable TLS for the Hysteria2 inbound.

  4. Set the SNI to a normal domain, for example:hy2.example.com

  5. Set the TLS certificate path and private key path, for example:

/root/cert/hy2.example.com/fullchain.pem
/root/cert/hy2.example.com/privkey.pem


6. Set ALPN to:h3

7. Leave Obfs / Salamander empty.

8. Save the inbound and restart Xray.

9. Copy the generated Hysteria2 share link or update the subscription link.

10. Import the generated Hysteria2 link into v2rayN 7.22.5.

11. Test the node in v2rayN.

12. The node shows -1 and cannot connect.

13. Manually edit the same Hysteria2 link and remove only the ech= parameter.

14. Import the edited link into v2rayN again.

15. Test the node again.

16. The same node connects successfully after removing ech=.

### Expected behavior

_No response_

### Actual behavior

_No response_

### Relevant logs

```shell

Screenshots

No response

3x-ui version

3XUI版本V3.2.8

Xray-core version

No response

How did you install 3x-ui?

install.sh script

Operating system

Ubuntu24.04

Which parts of the panel are affected?

No response

Browser (only if it is a UI bug)

No response

Is the panel behind a reverse proxy or CDN?

None

Before submitting

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
Originally created by @GrandpaNiuu on GitHub (Jun 8, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5077 ### Describe the bug In 3x-ui v3.2.8, when creating a Hysteria2 inbound with TLS enabled, the generated share/subscription link includes an ech= parameter. The generated Hysteria2 link fails in v2rayN 7.22.5. The latency test shows -1, and the node cannot connect. However, if I manually remove the ech= parameter from the same Hysteria2 link, the node works normally in v2rayN. Example generated link: hysteria2://0123456789abcdef0123456789abcdef@hy2.example.com:443?alpn=h3&ech=AID%2BDQB8AAAgACCRxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&fp=chrome&security=tls&sni=hy2.example.com#US-HY2-Test After removing ech=, the same node works: hysteria2://0123456789abcdef0123456789abcdef@hy2.example.com:443?security=tls&sni=hy2.example.com#US-HY2-Test The generated ECH value seems invalid. After decoding it, it appears to contain a server-side certificate path-like value, for example: /root/cert/hy2.example.com/fullchain.pem A local server certificate path should not be included in the client subscription link as part of the ECH configuration. This issue looks related to Hysteria2 share/subscription link generation, especially the ech parameter. ### How to reproduce the problem 1. Install 3x-ui v3.2.8 on a clean server. 2. Create a new Hysteria2 inbound. 3. Enable TLS for the Hysteria2 inbound. 4. Set the SNI to a normal domain, for example:hy2.example.com 5. Set the TLS certificate path and private key path, for example: /root/cert/hy2.example.com/fullchain.pem /root/cert/hy2.example.com/privkey.pem ``` 6. Set ALPN to:h3 7. Leave Obfs / Salamander empty. 8. Save the inbound and restart Xray. 9. Copy the generated Hysteria2 share link or update the subscription link. 10. Import the generated Hysteria2 link into v2rayN 7.22.5. 11. Test the node in v2rayN. 12. The node shows -1 and cannot connect. 13. Manually edit the same Hysteria2 link and remove only the ech= parameter. 14. Import the edited link into v2rayN again. 15. Test the node again. 16. The same node connects successfully after removing ech=. ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3XUI版本V3.2.8 ### Xray-core version _No response_ ### How did you install 3x-ui? install.sh script ### Operating system Ubuntu24.04 ### Which parts of the panel are affected? _No response_ ### Browser (only if it is a UI bug) _No response_ ### Is the panel behind a reverse proxy or CDN? None ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:33:26 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Jun 8, 2026):

Thanks for the detailed report.

What the code does

In sub/subService.go, genHysteriaLink includes ech=<value> in the subscription link only when tlsSettings.settings.echConfigList is non-empty in the stored inbound JSON (lines 662–666). This is a new behaviour introduced in v3.2.8 — the release notes explicitly added "End-to-end ECH — now carried in TLS share links, JSON subscriptions" as a feature (commit f8e902a7). In previous versions the echConfigList field existed in the database but was not emitted into links.

Why is ech= present in your link?

The field tlsSettings.settings.echConfigList in your inbound's stored JSON is non-empty. That field is only set by the "Get New ECH Cert" button in the TLS settings form (the getNewEchCert handler in frontend/src/pages/inbounds/form/useSecurityActions.ts). There is no code path that auto-populates it from certificate file paths.

Could you confirm:

  1. Did you ever click the "Get New ECH Cert" button in the inbound's TLS settings (even just to test it)?
  2. Was this inbound created fresh in the UI, or was its config imported/restored from another source?

How to check and fix right now

  1. Open the Hysteria2 inbound in the panel and go to the TLS settings section.
  2. Look for the ECH Server Keys and ECH Config fields — if either is non-empty, ECH was generated at some point.
  3. Click the Clear button next to the ECH cert section to blank both fields, then save.
  4. The regenerated subscription link will no longer contain ech= and should work in v2rayN.

About the "cert path" in the decoded value

The value from xray tls ech --serverName <your-sni> is a proper binary ECH config list (RFC 9180 format). When base64-decoded it contains your domain name (hy2.example.com) as a length-prefixed binary field, along with key material — not a filesystem path. What you saw may be the domain name in the binary context; the data isn't a cert path.

Root issue worth filing

If you genuinely never clicked that button on a clean install, that would be a real bug (auto-population of echConfigList). In that case it would help to share the raw streamSettings JSON from your database (sqlite3 /etc/x-ui/x-ui.db "SELECT stream_settings FROM inbounds WHERE id=<your id>") to confirm what is stored.

Even if the value was accidentally generated, the fact that including it breaks v2rayN 7.22.5 is a valid concern. The subscription service could conditionally omit ech= unless echServerKeys is also non-empty (meaning server-side ECH is actually deployed), but that's a separate enhancement request.

<!-- gh-comment-id:4649437471 --> @github-actions[bot] commented on GitHub (Jun 8, 2026): Thanks for the detailed report. **What the code does** In `sub/subService.go`, `genHysteriaLink` includes `ech=<value>` in the subscription link only when `tlsSettings.settings.echConfigList` is non-empty in the stored inbound JSON (lines 662–666). This is a new behaviour introduced in v3.2.8 — the release notes explicitly added *"End-to-end ECH — now carried in TLS share links, JSON subscriptions"* as a feature (commit `f8e902a7`). In previous versions the `echConfigList` field existed in the database but was not emitted into links. **Why is `ech=` present in your link?** The field `tlsSettings.settings.echConfigList` in your inbound's stored JSON is non-empty. That field is only set by the **"Get New ECH Cert"** button in the TLS settings form (the `getNewEchCert` handler in `frontend/src/pages/inbounds/form/useSecurityActions.ts`). There is no code path that auto-populates it from certificate file paths. **Could you confirm:** 1. Did you ever click the **"Get New ECH Cert"** button in the inbound's TLS settings (even just to test it)? 2. Was this inbound created fresh in the UI, or was its config imported/restored from another source? **How to check and fix right now** 1. Open the Hysteria2 inbound in the panel and go to the TLS settings section. 2. Look for the **ECH Server Keys** and **ECH Config** fields — if either is non-empty, ECH was generated at some point. 3. Click the **Clear** button next to the ECH cert section to blank both fields, then save. 4. The regenerated subscription link will no longer contain `ech=` and should work in v2rayN. **About the "cert path" in the decoded value** The value from `xray tls ech --serverName <your-sni>` is a proper binary ECH config list (RFC 9180 format). When base64-decoded it contains your domain name (`hy2.example.com`) as a length-prefixed binary field, along with key material — not a filesystem path. What you saw may be the domain name in the binary context; the data isn't a cert path. **Root issue worth filing** If you genuinely never clicked that button on a clean install, that would be a real bug (auto-population of `echConfigList`). In that case it would help to share the raw `streamSettings` JSON from your database (`sqlite3 /etc/x-ui/x-ui.db "SELECT stream_settings FROM inbounds WHERE id=<your id>"`) to confirm what is stored. Even if the value was accidentally generated, the fact that including it breaks v2rayN 7.22.5 is a valid concern. The subscription service could conditionally omit `ech=` unless `echServerKeys` is also non-empty (meaning server-side ECH is actually deployed), but that's a separate enhancement request.
Author
Owner

@MHSanaei commented on GitHub (Jun 11, 2026):

On current main the ech= parameter is only emitted when the inbound actually has a non-empty echConfigList configured — both in the subscription service and the panel''s share-link generation. If your link contains an ech value, ECH was enabled on that inbound (e.g. by clicking "Get New ECH Cert"); clearing the ECH fields in the TLS settings removes the parameter and the link works in v2rayN/sing-box. Closing — please reopen if a link still includes ech= with the ECH fields empty on the latest version.

<!-- gh-comment-id:4685770841 --> @MHSanaei commented on GitHub (Jun 11, 2026): On current main the `ech=` parameter is only emitted when the inbound actually has a non-empty `echConfigList` configured — both in the subscription service and the panel''s share-link generation. If your link contains an `ech` value, ECH was enabled on that inbound (e.g. by clicking "Get New ECH Cert"); clearing the ECH fields in the TLS settings removes the parameter and the link works in v2rayN/sing-box. Closing — please reopen if a link still includes `ech=` with the ECH fields empty on the latest version.
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#3574
No description provided.