Repository navigation
Hysteria server: Fix Unix masquerade socket path - #6705
Merged
Merged
Conversation
LjhAUMEM
approved these changes
Sep 1, 2026
Contributor
|
这里确实同步错了,感谢修复
|
TaiLerV
pushed a commit
to TaiLerV/Xray-core-up
that referenced
this pull request
Oct 7, 2026
Hysteria app/v2.12.2 added Unix sockets as masquerade proxy targets, which the upstream sync (XTLS#6565, XTLS#6705) brought over without the URL checks of Hysteria's newUnixMasqueradeProxyTarget. Any URL without a scheme counted as a socket path, so "example.com/site" or a relative path started the server, and a unix: URL silently dropped its host, userinfo, query and fragment. The server then answered every unauthenticated probe with 502 Bad Gateway instead of the masqueraded site. Accept, as Hysteria does, unix:///path and absolute paths without a scheme; reject the rest when the listener starts. A second test sends an unauthenticated HTTP/3 request, as a prober would, and checks that it reaches the site behind the socket with its Host and path intact. Co-Authored-By: Claude Opus 5.5 <[email protected]>
TaiLerV
pushed a commit
to TaiLerV/Xray-core-up
that referenced
this pull request
Oct 7, 2026
The Hysteria features were already at 2.12.2 through upstream XTLS#6565 and XTLS#6705 although the fork list still said 2.12.1. Record 2.13.0, Chrome 154 parroting, the Hysteria-compatible masquerade socket URLs and ECH key generation, and the QUIC and TLS sniffing that now reassembles split ClientHellos without modifying the sniffed datagrams. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The current Xray code handles Unix-socket targets in the following order:
The original parsed URL is overwritten before its path is saved:
The replacement URL has an empty
Path, so the next assignment always produces:Consequently, the custom transport effectively attempts:
On Linux, this fails with an error similar to:
The Hysteria masquerade handler then returns
502 Bad Gateway, while Xray logs:This affects all supported Unix-socket target formats, not just one particular URL form, because the parsed socket path is discarded in every case.
Upstream behavior
In the upstream Hysteria implementation, the socket path is saved before constructing the synthetic HTTP target:
Only after that does it return the target used by
httputil.ReverseProxy:The custom transport therefore captures the original socket path:
The incorrect ordering was introduced while adapting this logic in #6565 it is not caused by the upstream Hysteria implementation.
Fix
Save
u.Pathbefore replacinguwith the synthetichttp://localhosttarget:This preserves the original Unix socket address while leaving HTTP and HTTPS masquerade behavior unchanged.