v2fly / v2ray-core

A platform for building proxies to bypass network restrictions.
https://v2fly.org
MIT License
28.33k stars 4.53k forks source link

Crash report: panic: chacha20poly1305: invalid buffer overlap #2833

Closed Ali-Razmjoo closed 2 months ago

Ali-Razmjoo commented 6 months ago

Hi,

My v2ray servers are crashing from time to time with an error. Here are some information.

Information

Server, here is the server configuration sample.


{
    "api": {
        "services": [
            "HandlerService",
            "StatsService"
        ],
        "tag": "api"
    },
    "dns": null,
    "fakeDns": null,
    "inbounds": [
        {
            "listen": "127.0.0.1",
            "port": 62789,
            "protocol": "dokodemo-door",
            "settings": {
                "address": "127.0.0.1"
            },
            "sniffing": {
                "destOverride": [
                    "http",
                    "tls"
                ],
                "enabled": false
            },
            "streamSettings": null,
            "tag": "api"
        },
        {
            "listen": null,
            "port": 443,
            "protocol": "vless",
            "settings": {
                "clients": [
                    {
                        "alterId": 0,
                        "email": "xxxx@xxxxxx.com",
                        "id": "xxxxxxxxxxx",
                        "level": 0
                    }
                ],
                "decryption": "none"
            },
            "sniffing": {
                "destOverride": [
                    "http",
                    "tls"
                ],
                "enabled": false
            },
            "streamSettings": {
                "grpcSettings": {
                    "serviceName": "GunService"
                },
                "network": "gun",
                "security": "tls",
                "tlsSettings": {
                    "allowInsecure": true,
                    "alpn": [
                        "h2"
                    ],
                    "certificates": [
                        {
                            "certificateFile": "/secrets/fullchain.pem",
                            "keyFile": "/secrets/privkey.pem"
                        }
                    ],
                    "serverName": "xxxxxxxxxxxxxxxxx.com"
                }
            }
        },
        {
            "listen": null,
            "port": 80,
            "protocol": "vmess",
            "settings": {
                "clients": [
                    {
                        "alterId": 0,
                        "email": "some1@email.com",
                        "id": "xxxxxxxxx",
                        "level": 0
                    }
                ],
                "default": {
                    "alterId": 0,
                    "level": 0
                },
                "disableInsecureEncryption": false
            },
            "sniffing": {
                "destOverride": [
                    "http",
                    "tls"
                ],
                "enabled": false
            },
            "streamSettings": {
                "mux": {
                    "concurrency": 8,
                    "enabled": true
                },
                "network": "ws",
                "security": "none",
                "wsSettings": {
                    "acceptProxyProtocol": false,
                    "headers": {
                        "Connection": "keep-alive",
                        "Content-Type": "application/x-shockwave-flash, application/octet-stream, text/html,  application/x-shockwave-flash",
                        "Pragma": "no-cache",
                        "Transfer-Encoding": "chunked"
                    },
                    "path": "/somepath"
                }
            },
            "tag": "inbound-80"
        }
    ],
    "log": {
        "enabled": false
    },
    "outbounds": [
        {
            "protocol": "freedom",
            "settings": {},
            "tag": "direct"
        },
        {
            "protocol": "blackhole",
            "settings": {},
            "tag": "blocked"
        }
    ],
    "policy": {
        "levels": {
            "0": {
                "statsUserDownlink": true,
                "statsUserUplink": true
            }
        },
        "system": {
            "statsInboundDownlink": true,
            "statsInboundUplink": true
        }
    },
    "reverse": null,
    "routing": {
        "rules": [
            {
                "inboundTag": [
                    "api"
                ],
                "outboundTag": "api",
                "type": "field"
            },
            {
                "ip": [
                    "geoip:private"
                ],
                "outboundTag": "blocked",
                "type": "field"
            },
            {
                "outboundTag": "blocked",
                "protocol": [
                    "bittorrent"
                ],
                "type": "field"
            }
        ]
    },
    "stats": {
        "port": 62789
    },
    "transport": null
}

Crash details

v2ray    | panic: chacha20poly1305: invalid buffer overlap
v2ray    |
v2ray    | goroutine 112496 [running]:
v2ray    | golang.org/x/crypto/chacha20poly1305.(*chacha20poly1305).sealGeneric(0x4000e47948?, {0x4000400002?, 0x4000e8e800?, 0xcec880?}, {0x400237cac0?, 0x4583f4?, 0x400237cac0?}, {0x4000400000, 0x35c, 0x800}, ...)
v2ray    |      golang.org/x/crypto@v0.15.0/chacha20poly1305/chacha20poly1305_generic.go:34 +0x344
v2ray    | golang.org/x/crypto/chacha20poly1305.(*chacha20poly1305).seal(...)
v2ray    |      golang.org/x/crypto@v0.15.0/chacha20poly1305/chacha20poly1305_noasm.go:10
v2ray    | golang.org/x/crypto/chacha20poly1305.(*chacha20poly1305).Seal(0x4000f4c3c0?, {0x4000400002?, 0x28?, 0xeaa440?}, {0x400237cac0?, 0x2?, 0xfffe49c34c38?}, {0x4000400000?, 0x4000e47a18?, 0x9b534c?}, ...)
v2ray    |      golang.org/x/crypto@v0.15.0/chacha20poly1305/chacha20poly1305.go:66 +0x40
v2ray    | github.com/v2fly/v2ray-core/v5/common/crypto.(*AEADAuthenticator).Seal(0x4000ac9ea0, {0x4000400002, 0x0, 0x7fe}, {0x4000400000, 0x35c, 0x800})
v2ray    |      github.com/v2fly/v2ray-core/v5/common/crypto/auth.go:83 +0xe0
v2ray    | github.com/v2fly/v2ray-core/v5/common/crypto.(*AuthenticationWriter).seal(0x4001dc5360, {0x4000400000, 0x35c, 0x800})
v2ray    |      github.com/v2fly/v2ray-core/v5/common/crypto/auth.go:266 +0x2ec
v2ray    | github.com/v2fly/v2ray-core/v5/common/crypto.(*AuthenticationWriter).writeStream(0x4001dc5360, {0x4001f419e8, 0x1, 0x1})
v2ray    |      github.com/v2fly/v2ray-core/v5/common/crypto/auth.go:304 +0x314
v2ray    | github.com/v2fly/v2ray-core/v5/common/crypto.(*AuthenticationWriter).WriteMultiBuffer(0x1?, {0x4001f419e8?, 0x4000e47d08?, 0x3df5c0?})
v2ray    |      github.com/v2fly/v2ray-core/v5/common/crypto/auth.go:356 +0x5c
v2ray    | github.com/v2fly/v2ray-core/v5/common/buf.copyInternal({0x11bcdc0, 0x40014bef48}, {0x11be260, 0x4001dc5360}, 0x40014e44e0)
v2ray    |      github.com/v2fly/v2ray-core/v5/common/buf/copy.go:87 +0x148
v2ray    | github.com/v2fly/v2ray-core/v5/common/buf.Copy({0x11bcdc0, 0x40014bef48}, {0x11be260, 0x4001dc5360}, {0x4000e47df8, 0x1, 0x40018aeb20?})
v2ray    |      github.com/v2fly/v2ray-core/v5/common/buf/copy.go:104 +0x90
v2ray    | github.com/v2fly/v2ray-core/v5/proxy/vmess/inbound.transferResponse({0x11bddc0, 0x40018afc20}, 0x40018afc80?, 0x40018afb90, 0x4001720d20?, {0x11bcdc0, 0x40014bef48?}, 0x3ddbb4?)
v2ray    |      github.com/v2fly/v2ray-core/v5/proxy/vmess/inbound/inbound.go:203 +0x1e4
v2ray    | github.com/v2fly/v2ray-core/v5/proxy/vmess/inbound.(*Handler).Process.func2()
v2ray    |      github.com/v2fly/v2ray-core/v5/proxy/vmess/inbound/inbound.go:312 +0x2f8
v2ray    | github.com/v2fly/v2ray-core/v5/common/task.Run.func1(0x301620035?)
v2ray    |      github.com/v2fly/v2ray-core/v5/common/task/task.go:28 +0x34
v2ray    | created by github.com/v2fly/v2ray-core/v5/common/task.Run in goroutine 112493
v2ray    |      github.com/v2fly/v2ray-core/v5/common/task/task.go:27 +0xd4
github-actions[bot] commented 2 months ago

This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 5 days