mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6664] [Bug]: Outbound IP Leak and Routing Protocol Issues #4452
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#4452
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 @barbod1123-bit on GitHub (Sep 27, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6664
Describe the bug
I found two issues related to the Outbound and Routing sections:
When I add WARP or Psiphon as an Outbound, my main server's IP address is still leaked. I tested the connection on https://browserleaks.com/webrtc and the original server IP is visible.
In the Routing section, the Outbound protocol must be set to TCP. When it is set to Any or UDP, Google does not open properly. TCP works normally.
I tested both issues on multiple different servers, and the same problems occurred, so it appears to be related to the panel.
How to reproduce the problem
For the second issue:
Expected behavior
No response
Actual behavior
No response
Relevant logs
Screenshots
No response
3x-ui version
3.8.5
Xray-core version
No response
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 22
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
@github-actions[bot] commented on GitHub (Sep 27, 2026):
The IP leak (issue 1) looks like a result of the routing rule, not a panel bug. With the rule's Network set to
tcp, only TCP goes through WARP/Psiphon. All UDP falls through to the defaultdirectoutbound and leaves from your server's own IP. The WebRTC test on browserleaks uses STUN, which runs over UDP, so it sees the server IP. Issue 2 (Google breaking when UDP is sent through the outbound) is the real problem. I can't find its cause without your Xray log.Why the leak happens
networkmatch field. The panel offersconst NETWORKS = ['', 'tcp', 'udp', 'tcp,udp'];(frontend/src/pages/xray/routing/RuleFormModal.tsx:62) and copies it into the Xray rule unchanged (network: v.network,, line 144). It only decides which connections the rule catches. It does not change how the outbound carries them."protocol": "freedom"…"tag": "direct"(internal/web/service/config.json:31-39).tcp-only rule sends UDP (STUN, QUIC, DNS over UDP) out directly. The panel can't send UDP through WARP while also keeping UDP out of it.Why Google may break when UDP goes through the outbound (not confirmed)
With
udportcp,udp, Chrome reaches Google over QUIC (UDP 443) through the outbound. Two likely causes:mtu: 1420,domainStrategy: 'ForceIPv4v6'andnoKernelTun: true(frontend/src/pages/xray/overrides/WarpModal.tsx:133-151). WireGuard carries UDP, so a failure here needs the log to explain.Workarounds you can try now
tcp,udp(or empty = any) so no UDP leaks. Then add a rule above it with Networkudp, Port443and outboundblocked. Chrome then falls back from QUIC to TCP, and Google should load again.tcprule and add a second rule forudp→blocked. UDP is then dropped instead of leaking.To settle issue 2, please reply with:
debug, orx-ui log) from loading google.com with the rule set totcp,udp.I couldn't read the attached image. Please paste its contents as text if it matters.
Verdict: Not a bug (user configuration) for the leak; issue 2 is Insufficient information
Severity: N/A
Confidence: Medium
Root cause: No panel defect found. The
network: tcprule (RuleFormModal.tsx:144) sends all UDP to the defaultdirectfreedom outbound (config.json:31-39), and WebRTC/STUN uses UDP. I found no panel-side cause for the UDP-through-outbound failure.Already fixed: Not applicable
Duplicate of: Related: #3026 (WebRTC leak caused by routing-rule selection)
Evidence:
RuleFormModal.tsx:62NETWORKS list;RuleFormModal.tsx:144passesnetworkthrough unchanged;config.json:31-39first outbound isdirect;WarpModal.tsx:133-151WARP outbound shapeNot determined: Why UDP/QUIC through WARP or Psiphon breaks Google. The Xray debug log for that request would settle it.
This reply was generated automatically; a maintainer may follow up.
@barbod1123-bit commented on GitHub (Sep 27, 2026):
The main issue I am reporting is the IP leak itself.
Even when I configure WARP as the Outbound and set the routing rule's Network to Any, the original IP address of my main server is still leaked on https://browserleaks.com/webrtc.
My Xray-core version is 26.9.9.
This issue did not occur in older versions of 3x-ui. I have noticed it in the last 2–3 versions of the panel.
I also tested this with different Outbounds, and the same issue occurs. Regardless of which Outbound I add, when I check the connection on BrowserLeaks WebRTC, the original IP address of the main server is still exposed.
So my issue is not limited to a TCP-only routing rule. The IP is still leaked even when the rule is set to Any and the traffic is supposed to use the configured Outbound.
@github-actions[bot] commented on GitHub (Sep 27, 2026):
Thanks, that narrows it down to the leak itself. I still can't find a panel-side cause, and nothing in the source explains UDP bypassing a rule that has Network set to Any. The next step is to ask your running Xray which outbound it picks for WebRTC's UDP traffic. That answer will show whether this is a routing-rule problem or something the panel generates.
What I checked on the current code
networkkey from the rule:if (v === '') continue;(frontend/src/pages/xray/routing/RuleFormModal.tsx:164). The rule then matches only on its other fields (domain, IP, port, inbound, user). So a rule built only from domains orgeosite:entries never catches STUN, because STUN connects to a raw IP. That traffic falls through to the first outbound,direct(internal/web/service/config.json:31-39), and leaves from the server's own IP.internal/web/service/xray.go:488-502,577-627,702-712), private-IP DNS on thedirectoutbound (xray_setting_dns_routing.go:383-389), or AmneziaWG IPv6 peers.git log v3.6.0..v3.8.5on those files), none changes how client UDP is routed.Please reply with:
stun.l.google.com, Port19302, set Network to UDP, and pick the inbound your client connects to. Then press Test Route. Paste the "Matched outbound" line, or say whether it shows "No routing rule matched". The tester asks the live Xray instance (internal/xray/api.go:319-329) and sends no traffic.routingandoutboundsJSON from Xray Configs → Advanced, with keys and addresses redacted. This shows exactly which fields your WARP rule matches on.Verdict: Insufficient information
Severity: N/A
Confidence: Medium
Root cause: Not established. No panel code routes client UDP around a user rule. The likely explanation, not yet confirmed, is a rule whose remaining matchers (domain/geosite) can't match STUN's raw-IP UDP, so it falls through to the first outbound,
direct.Already fixed: Not applicable
Duplicate of: Related: #3026 (WebRTC leak caused by which fields a routing rule matches)
Evidence:
RuleFormModal.tsx:164drops an emptynetwork;config.json:31-39first outbound isdirect; the panel-injected rules inxray.go:488-502,577-627,702-712all key on loopbackinboundTag;xray_setting_dns_routing.go:383-389covers private DNS IPs onlyNot determined: Which outbound the live core chooses for UDP to a STUN server. The Route Tester result in item 1 would settle it.
This reply was generated automatically; a maintainer may follow up.
@barbod1123-bit commented on GitHub (Sep 27, 2026):
I ran the test you requested in:
Xray Configs → Routing Rules → Route Tester
I tested:
The result is shown in the Route Tester, but my Outbound does not appear as the matched outbound. The Outbound JSON I am testing is:
{
"protocol": "socks",
"settings": {
"servers": [
{
"address": "127.0.0.1",
"port": 1085,
"users": []
}
]
},
"tag": "Test"
}
Unfortunately, I don't remember exactly which 3x-ui version did not have this issue. However, I am certain that previously, when using WARP as an Outbound, my server's IP was not leaked.
Also, the IP shown by BrowserLeaks is the public IP address of my main VPS/server, not the public IP address of the device I am testing from.
The issue can be reproduced when checking the connection on:
https://browserleaks.com/webrtc
The main server's IP is exposed even when using WARP as the Outbound.
@github-actions[bot] commented on GitHub (Sep 27, 2026):
Your Route Tester result explains the leak: Xray itself does not send UDP to
stun.l.google.com:19302through yourTestoutbound. None of your routing rules match that connection, so it goes out another way (another rule's outbound, or the default first outbounddirect), from the server's own IP. That is WebRTC's STUN request, and it is the IP browserleaks shows. The fix is in the routing rule, not in the panel, so I'm closing this as a configuration issue.Why this is the routing rule and not the panel
TestRouteininternal/xray/api.go:343, "without sending any traffic"). If the core says the connection doesn't go toTest, then no rule in the running config sends it there.domain,ip,port,network,inboundTag, … infrontend/src/pages/xray/routing/RuleFormModal.tsx:135-151). Only empty fields are dropped (if (v === '') continue;, line 164). It doesn't narrow or rewrite what a rule matches.geosite:entries or IPs, WebRTC/STUN traffic to a raw IP won't match it. Xray checks rules top to bottom and uses the first match.How to route all of a client inbound's traffic, UDP included, through the outbound
inbound-443), Network =tcp,udp, Outbound =Test(or your WARP outbound). Leave domain, IP and port empty. In JSON it looks like this:Test.Testoutbound is SOCKS to127.0.0.1:1085. UDP only works through it if the local proxy on port 1085 supports SOCKS5 UDP ASSOCIATE. If it doesn't, UDP (and so QUIC to Google) will fail through it. In that case, add a rule above it with Networkudp→ outboundblocked: WebRTC then can't leak, and Chrome falls back to TCP for Google. That the proxy on 1085 has no UDP support is my guess, not something I can check from this repository.If the Route Tester still does not show your outbound after step 1, reopen with the
routingsection of Xray Configs → Advanced (secrets redacted) and the tester's exact "Matched outbound" text. That would point to a real defect.Verdict: Not a bug (user configuration)
Severity: N/A
Confidence: Medium
Root cause: No panel defect. The live core's router (Route Tester,
internal/xray/api.go:343) does not match UDP to the STUN server against the reporter's rule, so it leaves through a non-proxy outbound. The panel copies rule fields unchanged (RuleFormModal.tsx:135-167).Already fixed: Not applicable
Duplicate of: Related: #3026 (WebRTC leak caused by which fields a routing rule matches)
Evidence: Reporter's Route Tester run:
stun.l.google.com:19302/udpon their client inbound does not match outboundTest.RuleFormModal.tsx:135-151builds the rule from form fields verbatim;:164drops only empty values;internal/web/service/config.json:31-39default first outbound isfreedom/direct.Not determined: The reporter's exact rule JSON, so which field keeps it from matching is inferred. It does not change the verdict, because the core's own decision is what the tester reports.
This reply was generated automatically; a maintainer may follow up.
@barbod1123-bit commented on GitHub (Sep 27, 2026):
Just to clarify, the following Outbound configuration:
{
"protocol": "socks",
"settings": {
"servers": [
{
"address": "127.0.0.1",
"port": 1085,
"users": []
}
]
},
"tag": "Test"
}
is for Psiphon, not WARP.
I also tested the issue separately with the WARP Outbound, and the same IP leak occurs.