VLESS outbound: malformed `encryption` (mlkem768x25519plus.… with no key segment) panics with slice bounds out of range at config load

Aperta Adatta ai principianti
#7,554 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à
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
backend, security

Direzione di ricerca

Leggi infra/conf/vless.go in corrispondenza dei controlli segnalati e dell’operazione sulla slice in VLessOutboundConfig.Build; l’issue fornisce due valori encryption malformati che riproducono il panic. Inizia eseguendo xray run -test -c cfg.json con la configurazione fornita, quindi controlla i test VLESS outbound esistenti per trovare un punto in cui coprire entrambi i casi. Il lavoro è completo quando entrambi gli input restituiscono un errore di configurazione senza causare un panic.

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).

A VLESS outbound whose encryption starts with mlkem768x25519plus.<mode>.<0rtt|1rtt>. but has no 32/1184-byte key segment is accepted by the parser's first checks and then sliced past the end of the string (infra/conf/vless.go:342-352: segments shorter than 20 characters are counted as padding, and account.Encryption[padding:] is taken without checking that a key segment remains). The process panics while loading the config instead of reporting unsupported "encryption". Both mlkem768x25519plus.native.0rtt. (slice bounds out of range [1:0]) and mlkem768x25519plus.native.0rtt.abc ([4:3]) reproduce.

Reproduction Method

Save the client config below as cfg.json.

xray run -test -c cfg.json

Expected result: a config error (for example VLESS users: unsupported "encryption": ...), no panic. Same for xray run.

Client config


{
  "log": {
    "loglevel": "warning"
  },
  "outbounds": [
    {
      "protocol": "vless",
      "settings": {
        "vnext": [
          {
            "address": "192.0.2.1",
            "port": 443,
            "users": [
              {
                "id": "00000000-0000-4000-8000-000000000000",
                "encryption": "mlkem768x25519plus.native.0rtt."
              }
            ]
          }
        ]
      }
    }
  ]
}

Server config

Not needed: the client config panics on its own.

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:../cfg/enc.json Format:json}
panic: runtime error: slice bounds out of range [1:0]

goroutine 1 [running]:
github.com/xtls/xray-core/infra/conf.(*VLessOutboundConfig).Build.func1(...)
github.com/xtls/xray-core/infra/conf/vless.go:370
github.com/xtls/xray-core/infra/conf.(*VLessOutboundConfig).Build(0x3a21a9a39860)
github.com/xtls/xray-core/infra/conf/vless.go:373 +0x11c5
github.com/xtls/xray-core/infra/conf.(*OutboundDetourConfig).Build(0x3a21a986f860)
github.com/xtls/xray-core/infra/conf/xray.go:395 +0xd48
github.com/xtls/xray-core/infra/conf.(*Config).Build(0x3a21a9a46580)
github.com/xtls/xray-core/infra/conf/xray.go:749 +0x1f25
github.com/xtls/xray-core/infra/conf/serial.BuildConfig({0x3a21a9b10200?, 0x23b9e38?, 0x3a21a986fb50?})
github.com/xtls/xray-core/infra/conf/serial/builder.go:66 +0x2a
github.com/xtls/xray-core/core.LoadConfig({0x1417b55, 0x4}, {0x23372e8?, 0x3a21a98cf008?})
github.com/xtls/xray-core/core/config.go:150 +0x573
main.startXray()
github.com/xtls/xray-core/main/run.go:225 +0x15c
main.executeRun(0x25b6c50?, {0x3a21a98d2020?, 0x25b6c88?, 0x80000025b6c88?})
github.com/xtls/xray-core/main/run.go:83 +0x130
github.com/xtls/xray-core/main/commands/base.Execute()
github.com/xtls/xray-core/main/commands/base/execute.go:65 +0x708
main.main()
github.com/xtls/xray-core/main/main.go:22 +0x1b2
exit=2

Server log

Not applicable.

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.