mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[GH-ISSUE #6417] [Bug]: JSON subscription binds local inbounds to 0.0.0.0 and applies subJsonMux to xtls-rprx-vision outbounds #4346
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#4346
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @FZ1010 on GitHub (Sep 4, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6417
Describe the bug
Two independent problems in the JSON subscription (
subJsonEnable), both reproduced with per-client traffic counters on the panel andsson the box, never from a client's CONNECTED badge:1. The local inbounds are emitted without
listen.internal/sub/default.jsondeclares the 10808 and 10809 inbounds with nolisten, so a client that runs the profile verbatim binds an unauthenticated proxy on0.0.0.0(reachable from the LAN), and iOS packet-tunnel clients cannot reach it at all. This is the same symptom as #6379 (Happ iOS: CONNECTED, zero traffic). #6395 fixed it by switchingmixed→socks; on the same device themixedinbound also works once it is bound to127.0.0.1, so the missing bind is the underlying trigger, and every client's own generated config (Happ, V2Box, v2rayNG) binds its local inbound to loopback.2.
subJsonMuxis applied toxtls-rprx-visionoutbounds. XTLS flows do not support mux.cool. With a globalsubJsonMuxset, every VLESS+REALITY+Vision profile in the JSON subscription produces a tunnel that connects and then passes nothing — the server logscommon/mux: unexpected network TCPand drops the session. Affects every platform.How to reproduce the problem
Panel: 3x-ui v3.7.0, one VLESS inbound,
tcp+reality(targetwww.aws.amazon.com:443), client flowxtls-rprx-vision. Subscription:subJsonEnable=true,subJsonAutoDetect=true,subJsonUserAgentRegex=v2rayNG|Happ|Streisand|NekoBox|nekoray|Xray.Bug 1:
"listen": "127.0.0.1"on the 10808 inbound (protocol unchanged) → pages load, MBs move.sockswithoutlistenalso works;fakedns, outbound shape,dns/routing/policymake no difference.Bug 2:
subJsonMuxto{"enabled":true,"concurrency":8,"xudpConcurrency":16,"xudpProxyUDP443":"reject"}.curl --socks5-hostname 127.0.0.1:10808 https://api.ipify.org→SSL_ERROR_SYSCALL. Client log:tunneling request to tcp:v1.mux.cool:9527. Server (show: trueon the REALITY inbound): handshake completes, thenproxy/vless/inbound: received request for tcp:v1.mux.cool:0→common/mux: unexpected network TCP.subJsonMux→ all pass.Expected behavior
Local inbounds bound to
127.0.0.1; nomuxblock on outbounds that carry an XTLS flow.Actual behavior
Inbounds bound to all interfaces;
muxapplied regardless of flow.Relevant logs
3x-ui version
v3.7.0 (install.sh, systemd) —
mainated6bc1d8still has bothXray-core version
26.7.28 (panel), 26.6.27 / 26.7.11 (clients)
How did you install 3x-ui?
install.sh (systemd)
Operating system
Ubuntu (HostVDS), clients: iOS 26, Android 16, macOS
@github-actions[bot] commented on GitHub (Sep 4, 2026):
Both defects are real and both are still present on
mainated6bc1d8. I confirmed the emitted-config half of each in the source; the client-side consequence of #1 on iOS is the one thing I could not verify here (I cannot run a panel or a client), so I have scoped that below.1. The local inbounds are emitted with no
listenConfirmed.
internal/sub/default.json:14-40declares both local inbounds without alistenkey:Neither carries credentials either — the SOCKS inbound is
"auth": "noauth"and the HTTP inbound has noaccounts.That block reaches the client byte-for-byte.
SubJsonService.getConfigshallow-copies the embedded template and replaces only two keys:Nothing in the package ever assigns
configJson["inbounds"]— the only writes areconfigJson["routing"]forsubJsonRules(json_service.go:50-55). So no panel setting can reach the inbounds block, which matches what #6379 already stated.An absent
listenis the wildcard bind by the panel's own convention, stated twice in this repo:Nothing pins the current wildcard bind as intended. The test added with the
mixed→sockschange,TestDefaultJSONUsesCompatibleLocalInbounds(internal/sub/json_service_test.go:38-73), asserts port, protocol, tag andudpand says nothing aboutlisten. The reference template quoted in #6379 did carry"listen": "127.0.0.1"; commit0c72dd83took only the protocol half of it.One correction to your version line: v3.7.0 does not contain the
sockschange.0c72dd83("fix(sub): restore compatible SOCKS subscription inbound", #6395) landed after the v3.7.0 tag and is unreleased, so your v3.7.0 box is still serving"protocol": "mixed"and the missing bind. That matters for your A/B test — onmainonly the bind is left.The docs-site copy of the same skeleton has the same gap:
docs/lib/xray/subscription.ts:146-155.2.
subJsonMuxis attached to Vision outboundsConfirmed, and the panel already enforces the opposite rule elsewhere.
genVlesssets the mux with no reference to the flow it is about to write into the same outbound:The only suppression on the caller side is for XHTTP
xmux(json_service.go:509-514); nothing looks at the flow. And yourtcp+realityinbound passes the flow gate atjson_service.go:578—vlessFlowAllowedreturns true fortcpwithsecurity == "reality"(internal/sub/service.go:920-928) — soflowis kept andmuxis attached to the same outbound. The per-hostmuxParamsoverride runs through the samejsonMux()helper (json_service.go:564, 737-743), so it has the identical gap.The panel's own outbound editor refuses exactly this combination:
pinned by
frontend/src/test/outbound-form-adapter.test.ts:372— "mux is only emitted when enabled AND protocol/network/flow allow it" — whose third case (:405-419) is literallyflow: 'xtls-rprx-vision'+mux: { enabled: true }assertingexpect(withFlow).not.toHaveProperty('mux'). The JSON subscription does not apply that rule.The payload you quoted is what the UI switch writes, not something you had to hand-craft —
DEFAULT_MUXatfrontend/src/pages/settings/SubscriptionFormatsTab.tsx:27-32is{ enabled: true, concurrency: 8, xudpConcurrency: 16, xudpProxyUDP443: 'reject' }, stored verbatim bysetMuxEnabled(:85-87). So one toggle in Settings → Subscription → Formats breaks every Vision profile in the JSON subscription.Workaround until this is addressed
For #2, turn that Mux switch off (
subJsonMuxback to"", which is the shipped default —internal/web/service/setting.go:118). For #1 there is no panel-side workaround: as shown above, no setting reaches theinboundsblock.Verdict: Confirmed bug
Severity: High
Confidence: High
Root cause: (1)
internal/sub/default.json:14-40— both local inbounds omitlisten, andSubJsonService.getConfig(internal/sub/json_service.go:595-600) copies the template'sinboundsthrough untouched, replacing onlyoutboundsandremarks; an absentlistenis the wildcard bind perinternal/database/model/model.go:344-347. Triggers for every client of a JSON subscription (subJsonEnable), unconditionally. (2)SubJsonService.genVless(internal/sub/json_service.go:773-775) assignsoutbound.Muxwithout consultingclient.Flow, which the same function writes 16 lines later (:789-791); triggers wheneversubJsonMux(or a host'smuxParams) is non-empty and the client's flow survives the transport gate at:578.Already fixed: Still present on the default branch (
ed6bc1d8). Related commit0c72dd83(#6395) changed only"mixed"→"socks"in the same file and is itself not yet in a release — v3.7.0 predates it.Duplicate of: None. Related: #6379 — same file and same reported symptom, but its accepted root cause (the
mixedprotocol alias) is a different line from the missinglisten, so this is not the same defect.Evidence:
internal/sub/default.json:14-40(nolisten,"auth": "noauth", no HTTPaccounts);internal/sub/json_service.go:595-600(maps.Copy+ onlyoutbounds/remarksreplaced);internal/sub/json_service.go:50-55(the only write toconfigJson, and it isrouting);internal/database/model/model.go:344-347andinternal/web/entity/entity.go:301-303(empty listen == wildcard, in-repo);internal/sub/json_service_test.go:38-73TestDefaultJSONUsesCompatibleLocalInbounds(asserts protocol/tag/udp/port, neverlisten);internal/sub/json_service.go:768-791genVless(mux and flow set unconditionally in one outbound);internal/sub/json_service.go:509-514(onlyxmuxsuppresses mux);internal/sub/service.go:920-928vlessFlowAllowed(tcp+reality keeps the flow);internal/sub/json_service.go:564, 737-743(muxParamshost override shares the path);frontend/src/lib/xray/outbound-form-adapter.ts:700-704muxAllowed(if (flow) return false;) andfrontend/src/test/outbound-form-adapter.test.ts:372, 405-419(asserting test for the opposite rule);frontend/src/pages/settings/SubscriptionFormatsTab.tsx:27-32, 85-87(DEFAULT_MUX== your payload);internal/web/service/setting.go:118(subJsonMuxdefault"");docs/lib/xray/subscription.ts:146-155(docs mirror, same omission); commit0c72dd83.Not determined: Why an iOS packet-tunnel client fails on a wildcard-bound inbound rather than merely exposing the port — a socket on
0.0.0.0:10808normally still accepts a loopback connection, so I cannot derive your "zero traffic" result from the config alone, and I cannot run a client here. What would settle it: the client's own Xray log atloglevel: "info"from tunnel start, with and without"listen": "127.0.0.1", showing whether the 10808 inbound reports a bind/listen failure. The LAN-exposure half needs no client evidence — it follows from the emitted JSON.Suggested fix: add
"listen": "127.0.0.1"to both inbounds ininternal/sub/default.jsonand mirror it indocs/lib/xray/subscription.ts:146-155, extendingTestDefaultJSONUsesCompatibleLocalInboundsto pin it. Separately, gate the mux ingenVlesson the flow that the same function emits, so the JSON subscription applies the rulemuxAllowed()already applies in the outbound editor. The two are independent and could land separately.@MHSanaei
This reply was generated automatically; a maintainer may follow up.