mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6060] [Question]: EDNS (ECS) leaks through the vless+xhttp #4192
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#4192
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 @JeuDeTarot on GitHub (Jul 20, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6060
What are you trying to do?
Preventing EDNS (ECS) leaks through the tunnel, as well as DNS leaks in general. Of course, server side first.
Setup:
Route:
Test Client:
What have you already tried?
X-*andForwarded,Host,True-Client-IPto127.0.0.1orVPS IP) that seems not working with the xhttp and h2c 2 transport itself3x-ui version
3.5.0
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 26.04
Screenshots or config snippets
I've tried a lot of settings, so I'm choosing not to add them because I still think it's my misunderstanding of how things work. Just for sure some VPS settings:
/etc/systemd/resolved.conf
/etc/resolv.conf
Before submitting
@github-actions[bot] commented on GitHub (Jul 20, 2026):
Server-side, EDNS Client Subnet (ECS) behavior is entirely Xray-core's own
dnsmodule, not something 3x-ui implements — the panel'sdns/fakednssettings are passed straight through to Xray-core as opaque JSON (internal/xray/config.go,DNSConfig/FakeDNSfields). The relevant panel UI is Xray Configs → DNS (/xray#dns). A few source-grounded points that should help narrow this down:Client IPis a static, admin-typed value, not something derived per connecting client. It appears in two places: the DNS tab's "General Configs" sub-tab (applies to the wholednsobject) and, per server, inside each entry under the DNS sub-tab ("Add Server" →Client IP). The field's own description is "Used to notify the server of the specified IP location during DNS queries" (internal/web/translation/en-US.json) — this is Xray's EDNS Client Subnet option;docs/xray-dns.mdin this repo states it plainly: "clientIpsends EDNS Client Subnet data upstream." Neither field is populated by default. Because it's a fixed string rather than something filled in per VLESS connection, Xray's DNS client cannot forward a visiting client's real subnet through this field unless that exact IP was typed in somewhere — worth confirming both are blank, but this is an unlikely source of a leak that would vary per client.The panel already surfaces an in-UI warning for this exact class of issue as soon as "Enable DNS" is switched on:
docs/xray-dns.mdexpands on it. Worth checking whetherdns.serverscontains any of the following, since all three are documented leak vectors:localhost— uses the VPS's own OS resolver (/etc/resolv.conf, i.e. exactly thesystemd-resolvedconfig with194.242.2.2/9.9.9.9pasted above), entirely outside Xray's routing/ECS control.tcp+local://,https+local://, orquic+local://address — these bypass Xray's routing table by design and dial out from the VPS directly via Freedom.disableFallback: false(the default when a server is added) orenableParallelQuery: true— either can send the same query to more than one upstream provider.A freshly created inbound/template has no
dnsobject and nofakednsat all (internal/web/service/config.json, the bundled default Xray template), androuting.domainStrategydefaults toAsIs. So unless DNS was explicitly enabled on that tab, any resolution Xray-core itself needs falls back to the VPS's system resolver.For sniffing's
fakednsdestOverrideto actually short-circuit a query (answer locally with a fake IP, never touching an upstream server), a Fake DNS pool must also exist under DNS → Fake DNS ("Add Fake DNS", IP Pool Subnet + Pool Size) — enabling thednsobject does not create one automatically (the panel explicitly resetsfakednstonullwhen DNS is turned on). If the domain(s) used for the ECS test aren't covered by an actual Fake DNS pool entry, they fall through to a real upstream query via whateverdns.servers/system DNS is in effect.Given point 1, if what you're observing genuinely reproduces your real client subnet (not the VPS's) after confirming
Client IPis blank anddns.serversis clean per point 2, the DNS query for that test is most likely never reaching the VPS/Xray at all — i.e. it is being resolved directly by the OS or the client app before the packet enters the VLESS+XHTTP tunnel. That is a conventional client-side DNS leak, and no server-side 3x-ui/Xray config change can fix it.To go further, it would help to have:
dig/kdigcommand) used to check for the ECS leak, and the exact subnet/IP it reported.dns,fakedns,sniffing, androutingsections of this inbound's Xray config (Xray Configs → Advanced, or raw JSON) — or at minimum, confirmation of what's set forClient IP(both places),dns.servers, and the Fake DNS pool.This reply was generated automatically. A maintainer (@MHSanaei) may follow up.
@MHSanaei commented on GitHub (Jul 23, 2026):
Server-side, EDNS Client Subnet is handled entirely by Xray-core's
dnsmodule — 3x-ui passes your DNS/FakeDNS JSON straight through. A few source-grounded points to narrow this down:localhostservers (use the VPS's/etc/resolv.conf, outside Xray's control),*+local://servers (bypass routing via Freedom), anddisableFallback:false/enableParallelQuery:true. Checkdns.serversfor these.dns/fakednsobject anddomainStrategy:AsIs. For FakeDNS to short-circuit a query you must also add a pool under DNS → Fake DNS.If the leak still reports your real subnet after Client IP and
dns.serversare clean, the query is almost certainly never entering the tunnel — a conventional client-side DNS leak that no server-side change fixes. To dig further, please share the exact test tool/command and reported subnet, plus this inbound'sdns/fakedns/sniffing/routingJSON.@JeuDeTarot commented on GitHub (Jul 24, 2026):
Well, I finally figured out things, and yes, it's impossible to prevent different DNS leakage scenarios just server-side.
Thanks for the clarification, it was helpful.
P.S. Still trying to figure out why the Fake DNS so slow.