[GH-ISSUE #4791] [Bug]: After updating 3x-ui to version 3.2.6, my SNI Spoof tunnel stopped working. #3325

Closed
opened 2026-10-31 20:31:39 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @proxyman70 on GitHub (Jun 2, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4791

Describe the bug

After updating 3x-ui to version 3.2.6 and 3.2.5, my SNI Spoof tunnel stopped working.

The configuration was working correctly before the update.

How to reproduce the problem

I am using:

Trojan
WebSocket
TLS
Local outbound
SNI Spoof

After upgrading to 3.2.6, the tunnel connects but no traffic passes through the outbound anymore.

Expected behavior

The same outbound configuration was working correctly before updating.
The issue appears only after upgrading to 3.2.6.
Restarting xray and server does not help.
Other normal outbounds work correctly.
Problem only affects Trojan WS TLS outbound with spoofed SNI.
Request

Please check whether there were any changes related to:

TLS handling
SNI validation
WebSocket transport
Trojan outbound
Local outbound routing

that could break SNI spoof functionality.

Thank you.

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

3.2.6

Xray-core version

No response

How did you install 3x-ui?

Manual build from source

Operating system

ubuntu 24

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

  • 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 @proxyman70 on GitHub (Jun 2, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4791 ### Describe the bug After updating 3x-ui to version 3.2.6 and 3.2.5, my SNI Spoof tunnel stopped working. The configuration was working correctly before the update. ### How to reproduce the problem I am using: Trojan WebSocket TLS Local outbound SNI Spoof After upgrading to 3.2.6, the tunnel connects but no traffic passes through the outbound anymore. ### Expected behavior The same outbound configuration was working correctly before updating. The issue appears only after upgrading to 3.2.6. Restarting xray and server does not help. Other normal outbounds work correctly. Problem only affects Trojan WS TLS outbound with spoofed SNI. Request Please check whether there were any changes related to: TLS handling SNI validation WebSocket transport Trojan outbound Local outbound routing that could break SNI spoof functionality. Thank you. ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.2.6 ### Xray-core version _No response_ ### How did you install 3x-ui? Manual build from source ### Operating system ubuntu 24 ### 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 - [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:31:39 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Jun 2, 2026):

Claude finished @MHSanaei's task in 10m 15s —— View job


Investigation: SNI Spoof Tunnel Broken After Upgrade to 3.2.6

Tasks

  • Load tools and set up
  • Review recent git changes related to TLS/SNI/WebSocket/Trojan/outbound
  • Examine xray config generation code and frontend form adapter
  • Identify potential root causes
  • Provide findings and recommendations

Findings

I investigated the codebase including the frontend adapter, form logic, xray service, and recent release changes (v3.2.5, v3.2.6).

Root Cause #1 — onNetworkChange drops tlsSettings (including SNI) when transport is changed

File: frontend/src/pages/xray/outbounds/OutboundFormModal.tsx, line 247

When the network/transport dropdown is changed in the outbound edit form, the entire streamSettings object is replaced with only the new network slice — tlsSettings (and its serverName/SNI field) are not carried over, even when the security mode (TLS) is still valid after the network change:

// Current code — loses tlsSettings when network changes
form.setFieldValue('streamSettings', { ...newStreamSlice(next), security: newSecurity });

If a user opened the outbound edit modal after upgrading, changed any transport-related setting (even changed network and back), and saved — the SNI (serverName) would silently be cleared.

Fix: Preserve tlsSettings/realitySettings when the security mode is still allowed after the network change:

function onNetworkChange(next: string) {
  if (next === 'hysteria') {
    form.setFieldValue('streamSettings', hysteriaStreamSlice());
    return;
  }
  const stream = (form.getFieldValue('streamSettings') ?? {}) as Record<string, unknown>;
  const currentSecurity = (stream.security as string) ?? 'none';
  const stillAllowed = canEnableTls({ protocol, streamSettings: { network: next, security: currentSecurity } });
  const stillReality = canEnableReality({ protocol, streamSettings: { network: next, security: currentSecurity } });
  const newSecurity =
    currentSecurity === 'tls' && !stillAllowed ? 'none' :
    currentSecurity === 'reality' && !stillReality ? 'none' :
    currentSecurity;
  const newStream: Record<string, unknown> = { ...newStreamSlice(next), security: newSecurity };
  // Preserve TLS/Reality settings when security is still valid
  if (newSecurity === 'tls' && stream.tlsSettings) newStream.tlsSettings = stream.tlsSettings;
  else if (newSecurity === 'reality' && stream.realitySettings) newStream.realitySettings = stream.realitySettings;
  form.setFieldValue('streamSettings', newStream);
}

Root Cause #2 — Xray-core bumped to v26.6.1 in v3.2.5

The release notes for v3.2.5 include chore: bump bundled Xray-core to v26.6.1. Changes in xray-core can affect how Trojan WS TLS outbounds negotiate traffic. If the connection handshake succeeds but no data flows, this could be a behavior change in the new xray-core around TLS SNI validation or Trojan protocol handling.

Also notable in v3.2.5 release

  • fix(outbounds): preserve TLS/Reality security on save — this fix addressed a related issue where the security field itself was dropped on save. If the user's stored config had this malformed state (missing security: "tls"), xray-core would default to no TLS, which would explain connection succeeding but no traffic passing.

Debugging Steps for @proxyman70

  1. Check the stored config JSON: Go to Xray Settings → JSON editor, find your outbound entry and verify that it contains:

    {
      "streamSettings": {
        "network": "ws",
        "security": "tls",
        "tlsSettings": {
          "serverName": "your-spoofed-sni.example.com"
        }
      }
    }
    

    If security is missing or tlsSettings.serverName is empty, that's the issue.

  2. Check xray-core logs: Look for any TLS handshake errors or routing-related messages.

  3. Try re-saving the outbound (without changing any settings in the UI) and restart xray. The v3.2.5 fix(outbounds): preserve TLS/Reality security on save may restore the security field if it was lost.

  4. If the config looks correct but traffic still doesn't flow, the issue may be in xray-core v26.6.1's behavior with Trojan WS TLS and SNI spoofing — please share the sanitized config JSON and xray logs.

<!-- gh-comment-id:4607100226 --> @github-actions[bot] commented on GitHub (Jun 2, 2026): **Claude finished @MHSanaei's task in 10m 15s** —— [View job](https://github.com/MHSanaei/3x-ui/actions/runs/26848648549) --- ### Investigation: SNI Spoof Tunnel Broken After Upgrade to 3.2.6 ### Tasks - [x] Load tools and set up - [x] Review recent git changes related to TLS/SNI/WebSocket/Trojan/outbound - [x] Examine xray config generation code and frontend form adapter - [x] Identify potential root causes - [x] Provide findings and recommendations --- ### Findings I investigated the codebase including the frontend adapter, form logic, xray service, and recent release changes (v3.2.5, v3.2.6). #### Root Cause #1 — `onNetworkChange` drops `tlsSettings` (including SNI) when transport is changed **File:** `frontend/src/pages/xray/outbounds/OutboundFormModal.tsx`, line 247 When the network/transport dropdown is changed in the outbound edit form, the entire `streamSettings` object is replaced with only the new network slice — **`tlsSettings` (and its `serverName`/SNI field) are not carried over**, even when the security mode (TLS) is still valid after the network change: ```js // Current code — loses tlsSettings when network changes form.setFieldValue('streamSettings', { ...newStreamSlice(next), security: newSecurity }); ``` If a user opened the outbound edit modal after upgrading, changed any transport-related setting (even changed network and back), and saved — the SNI (`serverName`) would silently be cleared. **Fix:** Preserve `tlsSettings`/`realitySettings` when the security mode is still allowed after the network change: ```js function onNetworkChange(next: string) { if (next === 'hysteria') { form.setFieldValue('streamSettings', hysteriaStreamSlice()); return; } const stream = (form.getFieldValue('streamSettings') ?? {}) as Record<string, unknown>; const currentSecurity = (stream.security as string) ?? 'none'; const stillAllowed = canEnableTls({ protocol, streamSettings: { network: next, security: currentSecurity } }); const stillReality = canEnableReality({ protocol, streamSettings: { network: next, security: currentSecurity } }); const newSecurity = currentSecurity === 'tls' && !stillAllowed ? 'none' : currentSecurity === 'reality' && !stillReality ? 'none' : currentSecurity; const newStream: Record<string, unknown> = { ...newStreamSlice(next), security: newSecurity }; // Preserve TLS/Reality settings when security is still valid if (newSecurity === 'tls' && stream.tlsSettings) newStream.tlsSettings = stream.tlsSettings; else if (newSecurity === 'reality' && stream.realitySettings) newStream.realitySettings = stream.realitySettings; form.setFieldValue('streamSettings', newStream); } ``` #### Root Cause #2 — Xray-core bumped to v26.6.1 in v3.2.5 The release notes for v3.2.5 include `chore: bump bundled Xray-core to v26.6.1`. Changes in xray-core can affect how Trojan WS TLS outbounds negotiate traffic. If the connection handshake succeeds but no data flows, this could be a behavior change in the new xray-core around TLS SNI validation or Trojan protocol handling. #### Also notable in v3.2.5 release - `fix(outbounds): preserve TLS/Reality security on save` — this fix addressed a related issue where the `security` field itself was dropped on save. If the user's stored config had this malformed state (missing `security: "tls"`), xray-core would default to no TLS, which would explain connection succeeding but no traffic passing. --- ### Debugging Steps for @proxyman70 1. **Check the stored config JSON:** Go to **Xray Settings → JSON editor**, find your outbound entry and verify that it contains: ```json { "streamSettings": { "network": "ws", "security": "tls", "tlsSettings": { "serverName": "your-spoofed-sni.example.com" } } } ``` If `security` is missing or `tlsSettings.serverName` is empty, that's the issue. 2. **Check xray-core logs:** Look for any TLS handshake errors or routing-related messages. 3. **Try re-saving the outbound** (without changing any settings in the UI) and restart xray. The v3.2.5 `fix(outbounds): preserve TLS/Reality security on save` may restore the `security` field if it was lost. 4. **If the config looks correct but traffic still doesn't flow**, the issue may be in xray-core v26.6.1's behavior with Trojan WS TLS and SNI spoofing — please share the sanitized config JSON and xray logs.
Author
Owner

@proxyman70 commented on GitHub (Jun 3, 2026):

Thanks for the investigation.

I tested the same scenario across 3.0.2 and 3.2.6 with identical configuration:

3.0.2 → Trojan WS TLS + SNI spoof works normally
3.2.6 → tunnel connects but no traffic passes (same config)

I also verified that the generated Xray JSON on 3.2.6 is missing or altering tlsSettings.serverName in some cases when editing/saving outbound via UI.

So this does not look like a user misconfiguration issue. It appears to be either:

A regression in outbound form state handling (streamSettings overwrite / tlsSettings lost), or
A behavioral change in bundled xray-core (v26.6.1) affecting Trojan WS TLS with SNI spoofing.

If needed I can provide:

exact diff between working and broken generated configs
sanitized outbound JSON before/after upgrade
logs showing successful handshake but no traffic flow

<!-- gh-comment-id:4608463157 --> @proxyman70 commented on GitHub (Jun 3, 2026): Thanks for the investigation. I tested the same scenario across 3.0.2 and 3.2.6 with identical configuration: 3.0.2 → Trojan WS TLS + SNI spoof works normally 3.2.6 → tunnel connects but no traffic passes (same config) I also verified that the generated Xray JSON on 3.2.6 is missing or altering tlsSettings.serverName in some cases when editing/saving outbound via UI. So this does not look like a user misconfiguration issue. It appears to be either: A regression in outbound form state handling (streamSettings overwrite / tlsSettings lost), or A behavioral change in bundled xray-core (v26.6.1) affecting Trojan WS TLS with SNI spoofing. If needed I can provide: exact diff between working and broken generated configs sanitized outbound JSON before/after upgrade logs showing successful handshake but no traffic flow
Author
Owner

@EhsanEv0101 commented on GitHub (Jun 3, 2026):

#4851
x-ui service logs (3.2.6)

📩 Updated Logs Summary

The service is running but not stable.

🔄 Service behavior

The x-ui service is repeatedly restarting:

Started → Stopped → Started → Stopped (multiple cycles observed across different timestamps)

This indicates the service is not staying stable after launch.

🌐 Web server status
Web server running HTTP on 127.0.0.1

The panel is bound to localhost only, which is expected behavior.

⚙️ Xray core status
Xray core v26.6.1 started successfully
Reading config: bin/config.json

Xray is starting, but configuration loading may be unstable or incomplete.

🔁 Sub server
Sub server running HTTP on [::]:2096
⚠️ Observed issue
WebSocket hub stopped

The WebSocket hub is stopping during runtime, which may indicate instability in service lifecycle or configuration issues.

🔴 Systemd behavior
x-ui.service: Deactivated successfully
Started x-ui Service

The service is repeatedly being restarted by systemd.

📌 Summary
Service is not stable (restart loop observed)
Web server is only bound to localhost (127.0.0.1)
Xray core starts normally but may be affected by configuration issues
WebSocket hub is stopping unexpectedly

📩 Add-on logs

The service is repeatedly restarting (multiple start/stop cycles observed).

Web server is only bound to:

127.0.0.1 (localhost)

Xray-core version:

26.6.1

Sub-server is running on:

No external listening interface is visible.

WebSocket hub is also stopping during runtime.

<!-- gh-comment-id:4611681171 --> @EhsanEv0101 commented on GitHub (Jun 3, 2026): #4851 x-ui service logs (3.2.6) 📩 Updated Logs Summary The service is running but not stable. 🔄 Service behavior The x-ui service is repeatedly restarting: Started → Stopped → Started → Stopped (multiple cycles observed across different timestamps) This indicates the service is not staying stable after launch. 🌐 Web server status Web server running HTTP on 127.0.0.1 The panel is bound to localhost only, which is expected behavior. ⚙️ Xray core status Xray core v26.6.1 started successfully Reading config: bin/config.json Xray is starting, but configuration loading may be unstable or incomplete. 🔁 Sub server Sub server running HTTP on [::]:2096 ⚠️ Observed issue WebSocket hub stopped The WebSocket hub is stopping during runtime, which may indicate instability in service lifecycle or configuration issues. 🔴 Systemd behavior x-ui.service: Deactivated successfully Started x-ui Service The service is repeatedly being restarted by systemd. 📌 Summary Service is not stable (restart loop observed) Web server is only bound to localhost (127.0.0.1) Xray core starts normally but may be affected by configuration issues WebSocket hub is stopping unexpectedly --------- 📩 Add-on logs The service is repeatedly restarting (multiple start/stop cycles observed). Web server is only bound to: 127.0.0.1 (localhost) Xray-core version: 26.6.1 Sub-server is running on: No external listening interface is visible. WebSocket hub is also stopping during runtime.
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#3325
No description provided.