XTLS / Xray-core

Xray, Penetrates Everything. Also the best v2ray-core, with XTLS support. Fully compatible configuration.
https://t.me/projectXray
Mozilla Public License 2.0
22.76k stars 3.65k forks source link

Wireguard Inbound Panic when connecting via WiresockUI client #3388

Closed amir-devman closed 1 month ago

amir-devman commented 1 month ago

Integrity requirements

Version

1.8.13

Description

Since I upgraded from 1.8.6 I could connect to Wireguard inbound from a WiresockUI client but after upgrading to 1.8.13 I get a panic error on xray-core when some traffics sends to server after handshake (not sure).

Update: As I tested version 1.8.12 and 1.8.13 are crashing.

Reproduction Method

Try to connect to Wireguard inbound on xray-core from a WiresockUI (windows client)

Client config


[Interface]
Address = 172.16.0.71/32
PrivateKey = MFgHZSz2yK7hvec5vnzzrO5hByumNPDmqBWUlgSqlHs=
#pub = XN6ev6FHmdBPGhLGpLQcBLQLByibC7nLDinOloay8hU=

[Peer]
PublicKey = v+3jMD2FZce3opmGLvCC1LRlzWUobsFk8dzNTJnHl0I=
AllowedIPs = 0.0.0.0/0
Endpoint = SERVER_IP:41199

Server config


{
    "log": {
        "loglevel": "error"
    },
    "inbounds": [
        {
            "tag": "wireguard",
            "listen": "0.0.0.0",
            "port": 41199,
            "protocol": "wireguard",
            "settings": {
                "secretKey": "kH19vP4Wf5DsEmCJXsbpIajeFgOACz94WO3GHrHV8WU=",
                "peers": [
                    {
                        "publicKey": "XN6ev6FHmdBPGhLGpLQcBLQLByibC7nLDinOloay8hU=",
                        "allowedIPs": [
                            "172.16.0.71/32"
                        ]
                    }
                ],
                "kernelMode": false
            }
        }
    ]
}

Client log


2024-05-26 10:04:03 WireSock WireGuard VPN Client Service 1.2.37
The service is starting using local.conf WireGuard client configuration.

WireSock WireGuard VPN Client 1.2.37 is running as a regular process.
2024-05-26 10:04:03 WireSock Service has started.
2024-05-26 10:04:03 [MGR]: Using WireGuard server: SERVER_IP : 41199
2024-05-26 10:04:03 [TUN]: Detected default interface {B404DFD0-745B-4C91-B5C7-BA78647826B8}
2024-05-26 10:04:03 [TUN]: Using local IPv4 = 192.168.1.110 for the {B404DFD0-745B-4C91-B5C7-BA78647826B8}
2024-05-26 10:04:03 [TUN]: Local IPv6 address for the {B404DFD0-745B-4C91-B5C7-BA78647826B8} not available
2024-05-26 10:04:03 [TUN]: Sent handshake packet to the WireGuard server at SERVER_IP:41199

2024-05-26 10:04:03 [MGR]: Tunnel has started
2024-05-26 10:04:03 Wireguard tunnel has been started.
2024-05-26 10:04:05 [FILTER]: C:\Program Files\Google\Chrome\Application\chrome.exe : UDP : 192.168.1.110:61555 -> 239.255.255.250:1900
2024-05-26 10:04:07 [FILTER]: C:\Program Files\Google\Chrome\Application\chrome.exe : UDP : 192.168.1.110:50060 -> 5.200.200.200:53
2024-05-26 10:04:08 [FILTER]: C:\Program Files\Google\Chrome\Application\chrome.exe : UDP : 192.168.1.110:56031 -> 5.200.200.200:53
2024-05-26 10:04:08 [FILTER]: C:\Program Files\Google\Chrome\Application\chrome.exe : UDP : 192.168.1.110:64868 -> 5.200.200.200:53
2024-05-26 10:04:08 [FILTER]: C:\Program Files\Google\Chrome\Application\chrome.exe : UDP : 192.168.1.110:55162 -> 217.218.127.127:53
2024-05-26 10:04:09 [FILTER]: C:\Program Files\Google\Chrome\Application\chrome.exe : UDP : 192.168.1.110:49950 -> 217.218.127.127:53
2024-05-26 10:04:09 [TUN]: keep_alive_thread: Sending Handshake packet to WireGuard Server success

2024-05-26 10:04:09 [FILTER]: C:\Program Files\Google\Chrome\Application\chrome.exe : UDP : 192.168.1.110:63707 -> 217.218.127.127:53
2024-05-26 10:04:09 [FILTER]: C:\Program Files\Google\Chrome\Application\chrome.exe : UDP : 192.168.1.110:64132 -> 217.218.127.127:53
2024-05-26 10:04:09 [FILTER]: C:\Program Files\Google\Chrome\Application\chrome.exe : UDP : 192.168.1.110:59045 -> 5.200.200.200:53
2024-05-26 10:04:10 [FILTER]: C:\Program Files\Google\Chrome\Application\chrome.exe : UDP : 192.168.1.110:59043 -> 5.200.200.200:53
2024-05-26 10:04:10 [FILTER]: C:\Program Files\Google\Chrome\Application\chrome.exe : UDP : 192.168.1.110:54144 -> 217.218.127.127:53
2024-05-26 10:04:10 [FILTER]: C:\Program Files\Google\Chrome\Application\chrome.exe : UDP : 192.168.1.110:52336 -> 5.200.200.200:53

Server log


May 26 06:32:18 node105 systemd[1]: Started Xray Service.
May 26 06:32:19 node105 xray[137794]: Xray 1.8.13 (Xray, Penetrates Everything.) 3120ca4 (go1.22.3 linux/amd64)
May 26 06:32:19 node105 xray[137794]: A unified platform for anti-censorship.
May 26 06:32:19 node105 xray[137794]: 2024/05/26 06:32:19 [Info] infra/conf/serial: Reading config: /usr/local/etc/xray/config.json
May 26 06:34:04 node105 xray[137794]: panic: runtime error: index out of range [-1]
May 26 06:34:04 node105 xray[137794]: goroutine 52 [running]:
May 26 06:34:04 node105 xray[137794]: github.com/xtls/xray-core/proxy/wireguard.(*Server).Process(0xc00033b130, {0x15566b8, 0xc0003281e0}, 0x1538cb8?, {0x155d450, 0xc0003ba080}, {0x1558b20, 0xc00031f1a0})
May 26 06:34:04 node105 xray[137794]:         github.com/xtls/xray-core/proxy/wireguard/server.go:84 +0x772
May 26 06:34:04 node105 xray[137794]: github.com/xtls/xray-core/app/proxyman/inbound.(*udpWorker).callback.func1()
May 26 06:34:04 node105 xray[137794]:         github.com/xtls/xray-core/app/proxyman/inbound/worker.go:330 +0x397
May 26 06:34:04 node105 xray[137794]: created by github.com/xtls/xray-core/app/proxyman/inbound.(*udpWorker).callback in goroutine 15
May 26 06:34:04 node105 xray[137794]:         github.com/xtls/xray-core/app/proxyman/inbound/worker.go:306 +0x305
May 26 06:34:04 node105 systemd[1]: xray.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
May 26 06:34:04 node105 systemd[1]: xray.service: Failed with result 'exit-code'.
yuhan6665 commented 1 month ago

Can you try the latest build https://github.com/XTLS/Xray-core/actions/runs/9244670953

amir-devman commented 1 month ago

@yuhan6665 Thanks, problem is solved!