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
25.3k stars 3.91k forks source link

Wireguard panic: runtime error: index out of range [-1] #3380

Closed 0xland closed 5 months ago

0xland commented 5 months ago

Integrity requirements

Version

1.8.12

Description

WireGuard crashes immediately after receiving the first few requests.

Reproduction Method

Run xray-core version 1.8.12 with WireGuard as the outbound protocol.

Client config


{
    "log": {
        "logLevel": "warning"
    },
    "inbounds": [
        {
            "listen": "127.0.0.1",
            "port": 1080,
            "protocol": "socks",
            "settings": {
                "auth": "noauth",
                "udp": true
            },
            "sniffing": {
                "destOverride": ["http", "tls", "quic", "fakedns"],
                "enabled": false,
                "routeOnly": true
            },
            "tag": "socks"
        }
    ],
    "outbounds": [
        {
            "protocol": "wireguard",
            "tag": "proxy",
            "settings": {
                "secretKey": "",
                "address": [
                    "172.16.0.2/32",
                    "2606:4700:110:8ac2:46bf:9062:4022:75c1/128"
                ],
                "peers": [
                    {
                        "endpoint": "engage.cloudflare.com:2048",
                        "publicKey": "bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo="
                    }
                ],
                "mtu": 1280,
                "reserved": [67, 75, 203]
            }
        },
        {
            "protocol": "freedom",
            "tag": "direct"
        },
        {
            "protocol": "blackhole",
            "tag": "block"
        }
    ]
}

Server config



Client log


Xray 1.8.12 (Xray, Penetrates Everything.) 416f2df (go1.22.3 darwin/arm64)
A unified platform for anti-censorship.
2024/05/22 11:07:06 [Info] infra/conf/serial: Reading config: wireguard.json
2024/05/22 11:07:06 [Warning] core: Xray 1.8.12 started
2024/05/22 11:07:06 tcp:127.0.0.1:58563 accepted tcp:one.one.one.one:853 [socks >> proxy]
panic: runtime error: index out of range [-1]

goroutine 98 [running]:
github.com/xtls/xray-core/app/proxyman/outbound.(*Handler).Dial(0x14000388e80, {0x1016f9e70, 0x10206a920}, {{0x1016fa3e8, 0x14000385308}, 0x943, 0x3})
    github.com/xtls/xray-core/app/proxyman/outbound/handler.go:288 +0xac8
github.com/xtls/xray-core/proxy/wireguard.(*netBindClient).connectTo(0x14000392690, 0x14000395620)
    github.com/xtls/xray-core/proxy/wireguard/bind.go:131 +0x54
github.com/xtls/xray-core/proxy/wireguard.(*netBindClient).Send(0x14000392690, {0x140005067b0, 0x1, 0x10223e1d8?}, {0x1016fe998?, 0x14000395620})
    github.com/xtls/xray-core/proxy/wireguard/bind.go:174 +0x54
golang.zx2c4.com/wireguard/device.(*Peer).SendBuffers(0x14000264308, {0x140005067b0, 0x1, 0x1})
    golang.zx2c4.com/wireguard@v0.0.0-20231211153847-12269c276173/device/peer.go:136 +0x218
golang.zx2c4.com/wireguard/device.(*Peer).SendHandshakeInitiation(0x14000264308, 0x38?)
    golang.zx2c4.com/wireguard@v0.0.0-20231211153847-12269c276173/device/send.go:136 +0x43c
golang.zx2c4.com/wireguard/device.(*Peer).SendStagedPackets(0x14000264308)
    golang.zx2c4.com/wireguard@v0.0.0-20231211153847-12269c276173/device/send.go:350 +0xd4
golang.zx2c4.com/wireguard/device.(*Device).RoutineReadFromTUN(0x140001fec88)
    golang.zx2c4.com/wireguard@v0.0.0-20231211153847-12269c276173/device/send.go:293 +0x694
created by golang.zx2c4.com/wireguard/device.NewDevice in goroutine 11
    golang.zx2c4.com/wireguard@v0.0.0-20231211153847-12269c276173/device/device.go:322 +0x3e8

Server log



hkint commented 5 months ago

same question,but 1.8.11 version works

yuhan6665 commented 5 months ago

Can you help testing if it is fixed? https://github.com/XTLS/Xray-core/actions/runs/9191528834

swxk521 commented 5 months ago

Can you help testing if it is fixed? https://github.com/XTLS/Xray-core/actions/runs/9191528834

Xray-linux-64测试wireguard正常了

yuhan6665 commented 5 months ago

感谢大家高速反馈

Fangliding commented 5 months ago

现在怎么办 修改一下git历史把修复移到1.8.12前面吗()

yuhan6665 commented 5 months ago

不搞魔法了 承认失败 稍候再发 .13

RPRX commented 5 months ago

https://github.com/XTLS/Xray-core/releases/tag/v1.8.13