[GH-ISSUE #6750] [Bug]: TUIC cannot proxy TLS connections. #4500

Closed
opened 2026-10-31 20:40:04 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @wgp-2020 on GitHub (Oct 6, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6750

Describe the bug

TUIC cannot proxy Warframe's chat server (172.232.25.131:6697), although other types of inbound protocols work.
This is a TCP connection with a TLS certificate, but the certificate's domain name is not bound to any IP address.

How to reproduce the problem

  1. Connect the client to the Tuic proxy and run
    openssl s_client -connect 172.232.25.131:6697 -servername irc.warframe.com
  2. Server-side logs
    2026/10/06 06:39:53 ERROR - XRAY: [2810145435] transport/internet: failed to resolve ip > lookup irc.warframe.com on 8.8.8.8:53: no such host
    2026/10/06 06:39:52 ERROR - XRAY: [2810145435] transport/internet: failed to resolve ip > lookup irc.warframe.com on 8.8.8.8:53: no such host
    2026/10/06 06:39:52 ERROR - XRAY: [2810145435] transport/internet: failed to resolve ip > lookup irc.warframe.com on 8.8.8.8:53: no such host
    2026/10/06 06:39:52 ERROR - XRAY: [2810145435] transport/internet: failed to resolve ip > lookup irc.warframe.com on 8.8.8.8:53: no such host
    2026/10/06 06:39:52 ERROR - XRAY: [2810145435] transport/internet: failed to resolve ip > lookup irc.warframe.com on 8.8.8.8:53: no such host
    

Expected behavior

No response

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

3.9.0

Xray-core version

No response

How did you install 3x-ui?

Docker / Docker Compose

Operating system

Ubuntu 18.04 LTS

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 response

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 @wgp-2020 on GitHub (Oct 6, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6750 ### Describe the bug TUIC cannot proxy Warframe's chat server (172.232.25.131:6697), although other types of inbound protocols work. This is a TCP connection with a TLS certificate, but the certificate's domain name is not bound to any IP address. ### How to reproduce the problem 1. Connect the client to the Tuic proxy and run `openssl s_client -connect 172.232.25.131:6697 -servername irc.warframe.com` 2. Server-side logs ```shell 2026/10/06 06:39:53 ERROR - XRAY: [2810145435] transport/internet: failed to resolve ip > lookup irc.warframe.com on 8.8.8.8:53: no such host 2026/10/06 06:39:52 ERROR - XRAY: [2810145435] transport/internet: failed to resolve ip > lookup irc.warframe.com on 8.8.8.8:53: no such host 2026/10/06 06:39:52 ERROR - XRAY: [2810145435] transport/internet: failed to resolve ip > lookup irc.warframe.com on 8.8.8.8:53: no such host 2026/10/06 06:39:52 ERROR - XRAY: [2810145435] transport/internet: failed to resolve ip > lookup irc.warframe.com on 8.8.8.8:53: no such host 2026/10/06 06:39:52 ERROR - XRAY: [2810145435] transport/internet: failed to resolve ip > lookup irc.warframe.com on 8.8.8.8:53: no such host ``` ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.9.0 ### Xray-core version _No response_ ### How did you install 3x-ui? Docker / Docker Compose ### Operating system Ubuntu 18.04 LTS ### 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 response_ ### 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:40:04 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@github-actions[bot] commented on GitHub (Oct 6, 2026):

This is a real bug. Xray's sniffer on the TUIC relay replaces your IP target 172.232.25.131 with the TLS SNI irc.warframe.com, then tries to resolve that name. It has no DNS record, so the dial fails. Other inbounds work because their sniffing is whatever you set in the panel. The TUIC relay's sniffing is hardcoded, and it is missing routeOnly.

How it happens. A TUIC inbound doesn't dial the target itself. internal/tuic/socks_bridge.go (SocksRelay.DialTCP) forwards the address your client sent, the raw IP here, to a loopback SOCKS inbound that the panel injects into the Xray config. That injected inbound has this sniffing block:

// internal/web/service/xray.go:800 (used at :824 in injectTuicSocks)
tuicEgressSniffingSettings = `{"enabled":true,"destOverride":["http","tls","quic","fakedns"]}`

Without "routeOnly":true, Xray uses the sniffed domain as the real destination. Your log shows exactly that: failed to resolve ip > lookup irc.warframe.com on 8.8.8.8:53: no such host.

The same bug was already fixed for the AmneziaWG relay, which sits right above it. That relay sets routeOnly and has a comment explaining why:

// internal/web/service/xray.go:736-738
// Peers resolve DNS inside the tunnel, so domain rules match only via sniffing; routeOnly
// keeps the dial on the peer's IP, else Telegram's FakeTLS (IP + foreign SNI) breaks.
const amneziawgEgressSniffingSettings = `{"enabled":true,"destOverride":["http","tls","quic","fakedns"],"routeOnly":true}`

The TUIC relay never got that change.

Workaround until it is fixed. The relay inbound is generated, so you can't set routeOnly on it from the panel. Use another inbound type for this traffic, since you said those work. Or, if your client allows it, exclude 172.232.25.131 from the TUIC proxy.

Verdict: Confirmed bug
Severity: Medium
Confidence: High
Root cause: internal/web/service/xray.go:800: tuicEgressSniffingSettings turns on TLS/HTTP/QUIC sniffing without routeOnly. injectTuicSocks (:824) attaches it to every TUIC relay inbound. Any TCP/QUIC flow to an IP whose SNI or Host doesn't resolve to that IP (no DNS record, split-horizon DNS, domain fronting, Telegram FakeTLS) is redirected to the sniffed name. Introduced in 0054e671 "feat(tuic): implement native in-process Go TUIC v5 server (#6577)", first released in v3.9.0.
Already fixed: No. Still present on the default branch (tip 66ef5bbc) and in v3.9.0, the latest release.
Duplicate of: None. Related: #6560 and #6704 (TUIC routing, a different cause). The same defect in the AmneziaWG relay was fixed in 788b76c5 "fix(amneziawg): sniff the relay with routeOnly …" (#6654).
Evidence:

  • internal/web/service/xray.go:800 and :824: the TUIC relay sniffing has no routeOnly.
  • internal/web/service/xray.go:736-738: AmneziaWG relay, the same design with "routeOnly":true and the reason for it.
  • internal/web/service/xray_config_inject_test.go:616 TestInjectAmneziawgnetSocks_SniffingRouteOnly: pins routeOnly for AmneziaWG only.
  • internal/web/service/inbound_tuic_test.go:53: compares the TUIC sniffing to the constant itself, so it can't catch this.
  • internal/tuic/socks_bridge.go:53-120: DialTCP / buildSocks5ConnectRequest forward the client's address type (IPv4/IPv6/domain) unchanged.
    Not determined: Which TUIC client you use. It doesn't matter here: the server log shows the domain lookup happening in Xray, after the relay received the IP.

Suggested fix: Add "routeOnly":true to tuicEgressSniffingSettings, matching amneziawgEgressSniffingSettings. Sniffing stays on for domain routing rules, and the dial stays on the client's IP. Replace the constant-equality check in inbound_tuic_test.go with a decoded RouteOnly assertion like the AmneziaWG test.

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:6008783451 --> @github-actions[bot] commented on GitHub (Oct 6, 2026): This is a real bug. Xray's sniffer on the TUIC relay replaces your IP target `172.232.25.131` with the TLS SNI `irc.warframe.com`, then tries to resolve that name. It has no DNS record, so the dial fails. Other inbounds work because their sniffing is whatever you set in the panel. The TUIC relay's sniffing is hardcoded, and it is missing `routeOnly`. **How it happens.** A TUIC inbound doesn't dial the target itself. `internal/tuic/socks_bridge.go` (`SocksRelay.DialTCP`) forwards the address your client sent, the raw IP here, to a loopback SOCKS inbound that the panel injects into the Xray config. That injected inbound has this sniffing block: ```go // internal/web/service/xray.go:800 (used at :824 in injectTuicSocks) tuicEgressSniffingSettings = `{"enabled":true,"destOverride":["http","tls","quic","fakedns"]}` ``` Without `"routeOnly":true`, Xray uses the sniffed domain as the real destination. Your log shows exactly that: `failed to resolve ip > lookup irc.warframe.com on 8.8.8.8:53: no such host`. The same bug was already fixed for the AmneziaWG relay, which sits right above it. That relay sets `routeOnly` and has a comment explaining why: ```go // internal/web/service/xray.go:736-738 // Peers resolve DNS inside the tunnel, so domain rules match only via sniffing; routeOnly // keeps the dial on the peer's IP, else Telegram's FakeTLS (IP + foreign SNI) breaks. const amneziawgEgressSniffingSettings = `{"enabled":true,"destOverride":["http","tls","quic","fakedns"],"routeOnly":true}` ``` The TUIC relay never got that change. **Workaround until it is fixed.** The relay inbound is generated, so you can't set `routeOnly` on it from the panel. Use another inbound type for this traffic, since you said those work. Or, if your client allows it, exclude `172.232.25.131` from the TUIC proxy. Verdict: Confirmed bug Severity: Medium Confidence: High Root cause: `internal/web/service/xray.go:800`: `tuicEgressSniffingSettings` turns on TLS/HTTP/QUIC sniffing without `routeOnly`. `injectTuicSocks` (`:824`) attaches it to every TUIC relay inbound. Any TCP/QUIC flow to an IP whose SNI or Host doesn't resolve to that IP (no DNS record, split-horizon DNS, domain fronting, Telegram FakeTLS) is redirected to the sniffed name. Introduced in 0054e671 "feat(tuic): implement native in-process Go TUIC v5 server (#6577)", first released in v3.9.0. Already fixed: No. Still present on the default branch (tip 66ef5bbc) and in v3.9.0, the latest release. Duplicate of: None. Related: #6560 and #6704 (TUIC routing, a different cause). The same defect in the AmneziaWG relay was fixed in 788b76c5 "fix(amneziawg): sniff the relay with routeOnly …" (#6654). Evidence: - `internal/web/service/xray.go:800` and `:824`: the TUIC relay sniffing has no `routeOnly`. - `internal/web/service/xray.go:736-738`: AmneziaWG relay, the same design with `"routeOnly":true` and the reason for it. - `internal/web/service/xray_config_inject_test.go:616` `TestInjectAmneziawgnetSocks_SniffingRouteOnly`: pins `routeOnly` for AmneziaWG only. - `internal/web/service/inbound_tuic_test.go:53`: compares the TUIC sniffing to the constant itself, so it can't catch this. - `internal/tuic/socks_bridge.go:53-120`: `DialTCP` / `buildSocks5ConnectRequest` forward the client's address type (IPv4/IPv6/domain) unchanged. Not determined: Which TUIC client you use. It doesn't matter here: the server log shows the domain lookup happening in Xray, after the relay received the IP. Suggested fix: Add `"routeOnly":true` to `tuicEgressSniffingSettings`, matching `amneziawgEgressSniffingSettings`. Sniffing stays on for domain routing rules, and the dial stays on the client's IP. Replace the constant-equality check in `inbound_tuic_test.go` with a decoded `RouteOnly` assertion like the AmneziaWG test. *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
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#4500
No description provided.