VLESS Vision: user `testseed` with zero entries panics in crypto/rand.Int at the first write; `-test` passes

Aperta
#7,560 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
66/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
networking

Direzione di ricerca

Start with proxy/proxy.go:508-514, where testseed values are passed to crypto/rand.Int, and trace how the config builder validates those values. Check the existing tests for Vision padding and configuration validation. Done means invalid non-positive values produce a config error instead of a panic, with tests covering the reported case.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Integrity requirements

  • I read the issue template.
  • I confirm I read the documentation and did not pile up options.
  • Complete configs and logs are provided below.
  • I searched issues and found no similar ones.
  • Reproduced on the latest release.

Description

Version: Xray 26.11.9 (Xray, Penetrates Everything.) 676eaf6 (go1.27.3 linux/amd64), the v26.11.9 release Xray-linux-64.zip (sha256 b651f7e1d9966ee2c1b1ee1bf8b52c72771824d3065dce96bbc8bcc19ed95f82). The panic site is also unchanged on main at 919d0ae (2026-11-30).

proxy/proxy.go:508-514 passes testseed[1] and testseed[3] to rand.Int(rand.Reader, big.NewInt(...)), which panics for a value <= 0 (crypto/rand: argument to Int is <= 0). The conf builder accepts any four numbers, so "testseed": [0,0,0,0] passes -test and kills the process at the first Vision write. The argument is also used for int32(testseed[3]) conversions and the padding length, so huge values are unchecked as well (not tested here).

Reproduction Method

Save the client config below as cfg.json and the server config as server.json (both on 127.0.0.1).

# server: xray run -c server.json ; client: xray run -c client.json, then
curl -x socks5h://127.0.0.1:10808 http://127.0.0.1:20002/

Expected result: a config error for non-positive testseed entries; no panic.

(xray run -test on the client config prints Configuration OK, exit 0. The server uses a throwaway self-signed certificate; the client pins its leaf hash.)

Client config


{
  "log": {
    "loglevel": "warning"
  },
  "inbounds": [
    {
      "listen": "127.0.0.1",
      "port": 10808,
      "protocol": "socks"
    }
  ],
  "outbounds": [
    {
      "protocol": "vless",
      "settings": {
        "vnext": [
          {
            "address": "127.0.0.1",
            "port": 20002,
            "users": [
              {
                "id": "c20965b7-c354-405b-a3ef-f886415c9181",
                "encryption": "none",
                "flow": "xtls-rprx-vision",
                "testseed": [
                  0,
                  0,
                  0,
                  0
                ]
              }
            ]
          }
        ]
      },
      "streamSettings": {
        "network": "raw",
        "security": "tls",
        "tlsSettings": {
          "serverName": "localhost",
          "alpn": [
            "http/1.1"
          ],
          "pinnedPeerCertSha256": "208773ca012415a909c508eeaab62107341e8dcb096c649bb3bb50540d1baf62"
        }
      }
    }
  ]
}

Server config


{
  "log": {
    "loglevel": "warning"
  },
  "inbounds": [
    {
      "listen": "127.0.0.1",
      "port": 20002,
      "protocol": "vless",
      "settings": {
        "clients": [
          {
            "id": "c20965b7-c354-405b-a3ef-f886415c9181",
            "flow": "xtls-rprx-vision"
          }
        ],
        "decryption": "none"
      },
      "streamSettings": {
        "network": "raw",
        "security": "tls",
        "tlsSettings": {
          "certificates": [
            {
              "certificateFile": "/tmp/repro/lab/srv.crt",
              "keyFile": "/tmp/repro/lab/srv.key"
            }
          ]
        }
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom"
    }
  ]
}

Client log

Full output of the panicking process (ends with the exit code):


Xray 26.11.9 (Xray, Penetrates Everything.) 676eaf6 (go1.27.3 linux/amd64)
A unified platform for anti-censorship.
[Info] infra/conf/serial: Reading config: &{Name:/tmp/repro/cfg/testseed-run.json Format:json}
[Warning] core: Xray 26.11.9 started
from tcp:127.0.0.1:57894 accepted tcp:127.0.0.1:20002
panic: crypto/rand: argument to Int is <= 0

goroutine 26 [running]:
crypto/rand.Int({0x24bff20?, 0x25f5aa0?}, 0x77361baa11f0?)
crypto/rand/util.go:73 +0x55e
github.com/xtls/xray-core/proxy.XtlsPadding(0x1401fc78a390, 0x0, 0x1401fc649b48, 0x60?, {0x24c9120, 0x1401fc6afc20}, {0x1401fc2bb4d0?, 0x49f380?, 0x1401fc78e0a8?})
github.com/xtls/xray-core/proxy/proxy.go:514 +0x255
github.com/xtls/xray-core/proxy.(*VisionWriter).WriteMultiBuffer(0x1401fc649b00, {0x1401fc382028, 0x1, 0x1})
github.com/xtls/xray-core/proxy/proxy.go:396 +0x6b9
github.com/xtls/xray-core/proxy/vless/outbound.(*Handler).Process.func4()
github.com/xtls/xray-core/proxy/vless/outbound/outbound.go:326 +0x662
github.com/xtls/xray-core/common/task.Run.func1(0x1401fc40c090?)
github.com/xtls/xray-core/common/task/task.go:28 +0x28
created by github.com/xtls/xray-core/common/task.Run in goroutine 24
github.com/xtls/xray-core/common/task/task.go:27 +0xe5
exit=2

Server log

Server started normally, no warnings (loglevel: warning).

Lingua principale
Go
Stelle
43.3k
Fork
6.2k
Merge medio
2g 11h
PR unite (30g)
55

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di XTLS/Xray-core

Tutte le issue di XTLS/Xray-core

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.