[GH-ISSUE #4760] [Bug]: Hysteria2 Inbound wrong import to outbound and wrong connect #3300

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

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

Describe the bug

I do appreciate for Your hard work. 3 2 5 became really good.
I just create hysteria 2 inbound on one x-ui and try to add that via copy client's config to another x-ui

How to reproduce the problem

Just add on one x-ui Hysteria 2 inbound with UDP mask (that's one of missed config option while importing)
Then add client and connect to that inbound
then make a copy URL from client information panel.
O another x-ui add Ounbound switch JSON tab paste and import.

Check Alpn (always h3 ignores another), check UDP Mask (lost). Manually correcting it doesn't help to make connection.
In fact i didn't find a way to solve that trivial task ((( I mean connect from x-ui 3 2 5 to x-ui 3 2 5 by hysteria 2

Expected behavior

No response

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

3.2.5

Xray-core version

26.6.1

How did you install 3x-ui?

install.sh script

Operating system

Debian 13

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?

No — direct access

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 @gomanuke on GitHub (Jun 1, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4760 ### Describe the bug I do appreciate for Your hard work. 3 2 5 became really good. I just create hysteria 2 inbound on one x-ui and try to add that via copy client's config to another x-ui ### How to reproduce the problem Just add on one x-ui Hysteria 2 inbound with UDP mask (that's one of missed config option while importing) Then add client and connect to that inbound then make a copy URL from client information panel. O another x-ui add Ounbound switch JSON tab paste and import. Check Alpn (always h3 ignores another), check UDP Mask (lost). Manually correcting it doesn't help to make connection. In fact i didn't find a way to solve that trivial task ((( I mean connect from x-ui 3 2 5 to x-ui 3 2 5 by hysteria 2 ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.2.5 ### Xray-core version 26.6.1 ### How did you install 3x-ui? install.sh script ### Operating system Debian 13 ### 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? No — direct access ### 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:31:28 +07:00
Author
Owner

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

Thank you for the detailed report!

This looks like a bug in how the Hysteria2 client URL is generated and/or parsed when importing as an outbound. Two specific problems are described:

  1. ALPN always set to h3 — the alpn field in the imported outbound always shows h3 regardless of what was configured on the inbound.
  2. UDP Mask not carried over — the UDP mask (obfuscation) setting from the inbound is missing after import.

To help reproduce and investigate, could you please provide:

  • The client share URL (hysteria2://...) copied from the client information panel (redact the password/UUID if needed).
  • The raw JSON that appears in the outbound JSON tab after importing — so we can see exactly what fields are missing or wrong.
  • The inbound JSON from the first 3x-ui (Outbounds → your Hysteria2 inbound → JSON view), so the expected values can be compared.

A related issue (#4376) was reported on v3.0.2 where QUIC params and TLS were not preserved on import — if the UDP mask and ALPN fields are similarly not being serialized into the share URL or not being parsed back from it, the root cause may be the same pattern.

<!-- gh-comment-id:4591985921 --> @github-actions[bot] commented on GitHub (Jun 1, 2026): Thank you for the detailed report\! This looks like a bug in how the Hysteria2 client URL is generated and/or parsed when importing as an outbound. Two specific problems are described: 1. **ALPN always set to `h3`** — the `alpn` field in the imported outbound always shows `h3` regardless of what was configured on the inbound. 2. **UDP Mask not carried over** — the UDP mask (obfuscation) setting from the inbound is missing after import. To help reproduce and investigate, could you please provide: - The **client share URL** (hysteria2://...) copied from the client information panel (redact the password/UUID if needed). - The **raw JSON** that appears in the outbound JSON tab after importing — so we can see exactly what fields are missing or wrong. - The **inbound JSON** from the first 3x-ui (Outbounds → your Hysteria2 inbound → JSON view), so the expected values can be compared. A related issue (#4376) was reported on v3.0.2 where QUIC params and TLS were not preserved on import — if the UDP mask and ALPN fields are similarly not being serialized into the share URL or not being parsed back from it, the root cause may be the same pattern.
Author
Owner

@gomanuke commented on GitHub (Jun 1, 2026):

client share URL

hysteria2://78e7795a209c4c099f896a816fc8448f@news.domain.org:8443?alpn=h2%2Chttp%2F1.1&fm=%7B%22udp%22%3A%5B%7B%22settings%22%3A%7B%22password%22%3A%22ftwfgb9655hh2mgo%22%7D%2C%22type%22%3A%22salamander%22%7D%5D%7D&fp=chrome&obfs=salamander&obfs-password=655hh2mgo&security=tls&sni=news.domain.org#hy2-ej596ty350qs

raw JSON that appears in the outbound

{
"protocol": "hysteria",
"settings": {
"address": "news.domain.org",
"port": 8443,
"version": 2
},
"tag": "hy2-ej596ty350qs",
"streamSettings": {
"network": "hysteria",
"security": "tls",
"hysteriaSettings": {
"version": 2,
"auth": "78e7795a209c4c099f896a816fc8448f",
"udpIdleTimeout": 60
},
"tlsSettings": {
"serverName": "news.domain.org",
"alpn": [
"h3"
],
"fingerprint": "",
"echConfigList": "",
"verifyPeerCertByName": "",
"pinnedPeerCertSha256": ""
}
}
}

inbound JSON

{
"listen": "",
"port": 8443,
"protocol": "hysteria",
"tag": "in-8443-udp",
"settings": {
"clients": [
{
"auth": "78e7795a209c4c099f896a816fc8448f",
"email": "ej596ty350qs",
"limitIp": 0,
"totalGB": 0,
"expiryTime": 0,
"enable": true,
"tgId": 0,
"subId": "jqqy9ky1p2z8wk0a",
"comment": "",
"reset": 0,
"created_at": 1780308845548,
"updated_at": 1780310142000
}
],
"version": 2
},
"sniffing": {
"enabled": false
},
"streamSettings": {
"network": "hysteria",
"hysteriaSettings": {
"version": 2,
"udpIdleTimeout": 60
},
"security": "tls",
"tlsSettings": {
"serverName": "news.domain.org",
"minVersion": "1.2",
"maxVersion": "1.3",
"cipherSuites": "",
"rejectUnknownSni": false,
"disableSystemRoot": false,
"enableSessionResumption": false,
"certificates": [
{
"certificateFile": "/etc/letsencrypt/live/news.domain.org/fullchain.pem",
"keyFile": "/etc/letsencrypt/live/news.domain.org/privkey.pem",
"oneTimeLoading": false,
"usage": "encipherment",
"buildChain": false,
"useFile": true
}
],
"alpn": [
"h2",
"http/1.1"
],
"echServerKeys": "",
"settings": {
"fingerprint": "chrome",
"echConfigList": "",
"pinnedPeerCertSha256": []
}
},
"finalmask": {
"udp": [
{
"type": "salamander",
"settings": {
"password": "ftwfgb9655hh2mgo"
}
}
]
}
}
}

<!-- gh-comment-id:4592046294 --> @gomanuke commented on GitHub (Jun 1, 2026): **client share URL** hysteria2://78e7795a209c4c099f896a816fc8448f@news.domain.org:8443?alpn=h2%2Chttp%2F1.1&fm=%7B%22udp%22%3A%5B%7B%22settings%22%3A%7B%22password%22%3A%22ftwfgb9655hh2mgo%22%7D%2C%22type%22%3A%22salamander%22%7D%5D%7D&fp=chrome&obfs=salamander&obfs-password=655hh2mgo&security=tls&sni=news.domain.org#hy2-ej596ty350qs **raw JSON that appears in the outbound** { "protocol": "hysteria", "settings": { "address": "news.domain.org", "port": 8443, "version": 2 }, "tag": "hy2-ej596ty350qs", "streamSettings": { "network": "hysteria", "security": "tls", "hysteriaSettings": { "version": 2, "auth": "78e7795a209c4c099f896a816fc8448f", "udpIdleTimeout": 60 }, "tlsSettings": { "serverName": "news.domain.org", "alpn": [ "h3" ], "fingerprint": "", "echConfigList": "", "verifyPeerCertByName": "", "pinnedPeerCertSha256": "" } } } **inbound JSON** { "listen": "", "port": 8443, "protocol": "hysteria", "tag": "in-8443-udp", "settings": { "clients": [ { "auth": "78e7795a209c4c099f896a816fc8448f", "email": "ej596ty350qs", "limitIp": 0, "totalGB": 0, "expiryTime": 0, "enable": true, "tgId": 0, "subId": "jqqy9ky1p2z8wk0a", "comment": "", "reset": 0, "created_at": 1780308845548, "updated_at": 1780310142000 } ], "version": 2 }, "sniffing": { "enabled": false }, "streamSettings": { "network": "hysteria", "hysteriaSettings": { "version": 2, "udpIdleTimeout": 60 }, "security": "tls", "tlsSettings": { "serverName": "news.domain.org", "minVersion": "1.2", "maxVersion": "1.3", "cipherSuites": "", "rejectUnknownSni": false, "disableSystemRoot": false, "enableSessionResumption": false, "certificates": [ { "certificateFile": "/etc/letsencrypt/live/news.domain.org/fullchain.pem", "keyFile": "/etc/letsencrypt/live/news.domain.org/privkey.pem", "oneTimeLoading": false, "usage": "encipherment", "buildChain": false, "useFile": true } ], "alpn": [ "h2", "http/1.1" ], "echServerKeys": "", "settings": { "fingerprint": "chrome", "echConfigList": "", "pinnedPeerCertSha256": [] } }, "finalmask": { "udp": [ { "type": "salamander", "settings": { "password": "ftwfgb9655hh2mgo" } } ] } } }
Author
Owner

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

Fixed in commits 803e0109 and 6ae1b386.

Root cause: the outbound link importer (parseHysteria2Link) hardcoded alpn: ["h3"] and never read fp, ech, or the fm (finalmask) param — so importing a Hysteria2 client URL as an outbound dropped the configured ALPN (always showed h3), the fingerprint, and the salamander UDP mask. That's why ALPN was wrong and the UDP mask was lost.

Fixes:

  1. The importer now parses alpn (falling back to h3 only when the link omits it), fp, ech, and the correct pcs pinned-cert key, and restores the UDP mask from fm. Verified the import→save round-trip preserves finalmask/alpn into the saved outbound, so it reaches xray. Added regression tests using the reported link.
  2. Added a None option to the outbound TLS form's uTLS dropdown (Hysteria doesn't use uTLS), so the fingerprint can be left empty — matching the inbound form.

This will be in the next release.

<!-- gh-comment-id:4594898394 --> @MHSanaei commented on GitHub (Jun 1, 2026): Fixed in commits 803e0109 and 6ae1b386. **Root cause:** the outbound link importer (`parseHysteria2Link`) hardcoded `alpn: ["h3"]` and never read `fp`, `ech`, or the `fm` (finalmask) param — so importing a Hysteria2 client URL as an outbound dropped the configured ALPN (always showed `h3`), the fingerprint, and the salamander UDP mask. That's why ALPN was wrong and the UDP mask was lost. **Fixes:** 1. The importer now parses `alpn` (falling back to `h3` only when the link omits it), `fp`, `ech`, and the correct `pcs` pinned-cert key, and restores the UDP mask from `fm`. Verified the import→save round-trip preserves `finalmask`/`alpn` into the saved outbound, so it reaches xray. Added regression tests using the reported link. 2. Added a **None** option to the outbound TLS form's uTLS dropdown (Hysteria doesn't use uTLS), so the fingerprint can be left empty — matching the inbound form. This will be in the next release.
Author
Owner

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

@hoshiizumiya
you forgot udp mask in the inbound

<!-- gh-comment-id:4595637052 --> @MHSanaei commented on GitHub (Jun 1, 2026): @hoshiizumiya you forgot udp mask in the inbound
Author
Owner

@hoshiizumiya commented on GitHub (Jun 2, 2026):

OK, after renew my certification, it fixed by add h3 to ALPN. The default configer does not include it.

<!-- gh-comment-id:4598845102 --> @hoshiizumiya commented on GitHub (Jun 2, 2026): OK, after renew my certification, it fixed by add h3 to ALPN. The default configer does not include it.
Author
Owner

@hoshiizumiya commented on GitHub (Jun 2, 2026):

The pinnedPeerCertSha256 configer doesn't support to get from the fullchain.pem is bit of pity. And the update may also be a problem. Because the client and panel can't auto get the new certification?

<!-- gh-comment-id:4598886109 --> @hoshiizumiya commented on GitHub (Jun 2, 2026): The pinnedPeerCertSha256 configer doesn't support to get from the fullchain.pem is bit of pity. And the update may also be a problem. Because the client and panel can't auto get the new certification?
Author
Owner

@gomanuke commented on GitHub (Jun 2, 2026):

Guys, i still can't create Hysteria2 Inbound (3.2.6) that can be connected by Outbound (3.2.6)
Vless works perfect (just click-default-get-connected )
x-ui Outbound (3.2.6) also connects to pure Hysteria2 server (2.9.2) without any problems.
But not to Hysteria2 inbound (3.2.6)...
Also hiddify (happ) can't connect to x-ui Hysteria2 inbound
Tried different servers and clients...

Would You help?

<!-- gh-comment-id:4604591592 --> @gomanuke commented on GitHub (Jun 2, 2026): Guys, i still can't create Hysteria2 Inbound (3.2.6) that can be connected by Outbound (3.2.6) Vless works perfect (just click-default-get-connected ) x-ui Outbound (3.2.6) also connects to pure Hysteria2 server (2.9.2) without any problems. But not to Hysteria2 inbound (3.2.6)... Also hiddify (happ) can't connect to x-ui Hysteria2 inbound Tried different servers and clients... Would You help?
Author
Owner

@gomanuke commented on GitHub (Jun 2, 2026):

Hysteria2 Inbound Security-ALPN MUST be empty OR contains h3
And it doesn't matter what Outbounds ALPN contains...

Looks as bug?

<!-- gh-comment-id:4605077442 --> @gomanuke commented on GitHub (Jun 2, 2026): Hysteria2 Inbound Security-ALPN MUST be empty OR contains h3 And it doesn't matter what Outbounds ALPN contains... Looks as bug?
Author
Owner

@hoshiizumiya commented on GitHub (Jun 2, 2026):

The h3 means udp, which is used for hysteria2, so it's a must. But 3x-ui doesn't add it as a default

<!-- gh-comment-id:4605214895 --> @hoshiizumiya commented on GitHub (Jun 2, 2026): The h3 means udp, which is used for hysteria2, so it's a must. But 3x-ui doesn't add it as a default
Author
Owner

@gomanuke commented on GitHub (Jun 3, 2026):

Please would You care about dummies like me reopening America again ))) and take it into account. I mean default attributes that is vital for connections....
Appreciate for Your hard work.

<!-- gh-comment-id:4608786301 --> @gomanuke commented on GitHub (Jun 3, 2026): Please would You care about dummies like me reopening America again ))) and take it into account. I mean default attributes that is vital for connections.... Appreciate for Your hard work.
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#3300
No description provided.