WireGuard outbound: non-IP `remoteDNS` entry panics via netip.MustParseAddr at config load

Aperta Adatta ai principianti
#7,556 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
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
networking

Direzione di ricerca

Parti da proxy/wireguard/client.go:103-104, dove ogni voce di remoteDNS viene passata a netip.MustParseAddr, e segui come NewClient segnala gli errori di configurazione. Esegui xray run -test -c cfg.json con la configurazione fornita per riprodurre il panic. Il lavoro è completato quando una voce che non è un IP produce 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).

proxy/wireguard/client.go:103-104 calls netip.MustParseAddr(dns) on every settings.remoteDNS entry with no validation. A host name (or any non-IP string) therefore panics during core construction: panic: ParseAddr("dns.example.com"): unexpected character. The panic is raised in core.New (app/proxyman/outbound.NewHandler -> wireguard.NewClient), not in the conf builder, and xray run -test reaches it too.

Reproduction Method

Save the client config below as cfg.json.

xray run -test -c cfg.json

Expected result: a config error such as invalid remoteDNS address, no panic.

Client config


{
  "log": {
    "loglevel": "warning"
  },
  "outbounds": [
    {
      "protocol": "wireguard",
      "settings": {
        "secretKey": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
        "address": [
          "10.0.0.2/32"
        ],
        "remoteDNS": [
          "dns.example.com"
        ],
        "noKernelTun": true,
        "peers": [
          {
            "publicKey": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
            "endpoint": "192.0.2.1:51820",
            "allowedIPs": [
              "0.0.0.0/0"
            ]
          }
        ]
      }
    }
  ]
}

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/wgdns.json Format:json}
panic: ParseAddr("dns.example.com"): unexpected character (at "dns.example.com")

goroutine 1 [running]:
net/netip.MustParseAddr(...)
net/netip/netip.go:135
github.com/xtls/xray-core/proxy/wireguard.NewClient({0x24c9158, 0x3e7bcb4a4630}, 0x3e7bcb1f3200)
github.com/xtls/xray-core/proxy/wireguard/client.go:104 +0x17f7
github.com/xtls/xray-core/proxy/wireguard.init.2.func1({0x24c9158?, 0x3e7bcb4a4630?}, {0x2225038?, 0x3e7bcb1f3200?})
github.com/xtls/xray-core/proxy/wireguard/wireguard.go:13 +0x45
github.com/xtls/xray-core/common.CreateObject(...)
github.com/xtls/xray-core/common/type.go:32
github.com/xtls/xray-core/app/proxyman/outbound.NewHandler({0x24c9158, 0x3e7bcb4a45d0}, 0x3e7bcb219c80)
github.com/xtls/xray-core/app/proxyman/outbound/handler.go:110 +0x559
github.com/xtls/xray-core/app/proxyman/outbound.init.0.func2({0x24c9158?, 0x3e7bcb4a45d0?}, {0x218aa38?, 0x3e7bcb219c80?})
github.com/xtls/xray-core/app/proxyman/outbound/outbound.go:195 +0x36
github.com/xtls/xray-core/common.CreateObject(...)
github.com/xtls/xray-core/common/type.go:32
github.com/xtls/xray-core/core.CreateObject(0x2590c90?, {0x218aa38, 0x3e7bcb219c80})
github.com/xtls/xray-core/core/functions.go:21 +0x1c2
github.com/xtls/xray-core/core.AddOutboundHandler(...)
github.com/xtls/xray-core/core/xray.go:128
github.com/xtls/xray-core/core.addOutboundHandlers(0x3e7bcb302700, {0x3e7bcb410508, 0x1, 0x1?})
github.com/xtls/xray-core/core/xray.go:144 +0xd6
github.com/xtls/xray-core/core.initInstanceWithConfig(0x3e7bcb3e0120, 0x3e7bcb302700)
github.com/xtls/xray-core/core/xray.go:251 +0x766
github.com/xtls/xray-core/core.New(...)
github.com/xtls/xray-core/core/xray.go:172
main.startXray()
github.com/xtls/xray-core/main/run.go:230 +0x2b7
main.executeRun(0x25b6c50?, {0x3e7bcb11c070?, 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.