SagerNet / SagerNet/sing-box

outbound.tls.enabled missing field bug

Open
#4,437 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
38.2k
Forks
4.6k
Avg merge
19d 15h
Merged PRs (30d)
1

Description

Operating system

Linux

System version

Linux void1 6.18.39_1 #1 SMP PREEMPT_DYNAMIC Sun Jul 19 22:55:12 UTC 2026 x86_64 GNU/Linux

Installation type

Original sing-box Command Line

If you are using a graphical client, please provide the version of the client.

No response

Version
sing-box version 1.13.19

Environment: go1.25.12 linux/amd64
Tags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,with_ccm,with_ocm,with_naive_outbound,badlinkname,tfogo_checklinkname0
Revision: b5ebaa1fc0f2b94256180b95468e73ef53caa27d
CGO: enabled
Description

Giving you another small piece of bug in config parser, which crashes whole app.
I did not dig deep into the parser. Hopefully, this just will give a way to parser weaknesses.
I wrote a converter from v2ray list to sing-box config. It is not perfect. And my proxy list source sometimes contains weird configs. So it reproduced incident, when outbound.tls.enabled field is missing. That caused to crash.

Reproduction

sample config:

{
"outbounds": [
{
"type": "urltest",
"tag": "autosel",
"outbounds": [
".\ud81a\udd54 \u0741 \u02d6\u05b4\ud83d\udef8\u0f04\u02d6\u00b0. | [BL] #0"
],
"url": "https://cp.cloudflare.com",
"interval": "5s",
"tolerance": 50,
"idle_timeout": "10m",
"interrupt_exist_connections": false
},
{
"type": "vless",
"tag": ".\ud81a\udd54 \u0741 \u02d6\u05b4\ud83d\udef8\u0f04\u02d6\u00b0. | [BL] #0",
"server": "144.31.168.133",
"server_port": 443,
"uuid": "423b1d79-08c4-403f-9d5e-c541f791b55f",
"flow": "xtls-rprx-vision",
"tls": {
"utls": {
"enabled": true,
"fingerprint": ""
},
"reality": {
"enabled": true,
"public_key": "b-Cm9hX-3UHsS1L_lnUB6AMjuKhlN1IDdBbZ506itjI",
"short_id": "00bca5982f82d083"
},
"server_name": "eu-central.cendora.ru"
},
"connect_timeout": "3s"
}
],
"route": {
"rules": [
{
"source_ip_cidr": "192.168.0.0/16",
"outbound": "autosel"
}
]
}
}

singbox run -c sample.json

Logs
$ ../sing-box-1.13.19-linux-amd64-glibc/sing-box run -c test_1905.json 
INFO[0000] network: updated default interface wlp2s0, index 2
INFO[0000] sing-box started (0.00s)
INFO[0000] outbound/vless[.𖥔 ݁ ˖ִ🛸༄˖°. | [BL] #0]: outbound connection to cp.cloudflare.com:443
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x29eb534]

goroutine 19 [running]:
github.com/sagernet/sing/common/tls.ClientHandshake({0xd03d58, 0xc0004c40c0}, {0xd19d40?, 0xc0001441a0?}, {0x0?, 0x0?})
	github.com/sagernet/sing@v0.8.13/common/tls/config.go:57 +0x54
github.com/sagernet/sing-box/common/tls.(*defaultDialer).dialContext(0xc0001444a0, {0xd03d58, 0xc0004c40c0}, {{{0x0, 0xffff901fa885}, {0xc000012210}}, 0x1bb, {0x0, 0x0}}, 0x1)
	github.com/sagernet/sing-box/common/tls/client.go:122 +0xe5
github.com/sagernet/sing-box/common/tls.(*defaultDialer).DialTLSContext(0xd03e00?, {0xd03d58?, 0xc0004c40c0?}, {{{0x0, 0xffff901fa885}, {0xc000012210}}, 0x1bb, {0x0, 0x0}})
	github.com/sagernet/sing-box/common/tls/client.go:114 +0x5c
github.com/sagernet/sing-box/protocol/vless.(*vlessDialer).DialContext(0xc0003ba000, {0xd03e00?, 0xc0002a8930?}, {0x8d8a92, 0x3}, {{{0x0, 0x0}, {0x0}}, 0x1bb, {0xc00012c548, ...}})
	github.com/sagernet/sing-box/protocol/vless/outbound.go:160 +0x1b1
github.com/sagernet/sing-box/protocol/vless.(*Outbound).DialContext(0xc0003ba000, {0xd03e00, 0xc0002a8930}, {0x8d8a92, 0x3}, {{{0x0, 0x0}, {0x0}}, 0x1bb, {0xc00012c548, ...}})
	github.com/sagernet/sing-box/protocol/vless/outbound.go:110 +0x3d4
github.com/sagernet/sing-box/common/urltest.urlTest({0xd03e00, 0xc0002a8930}, {0xc00012c540?, 0x439a000?}, {0x7f2ef40dffc8, 0xc0003ba000})
	github.com/sagernet/sing-box/common/urltest/urltest.go:107 +0x217
github.com/sagernet/sing-box/common/urltest.URLTest({0xd03e00, 0xc0002a8930}, {0xc00012c540, 0x19}, {0x7f2ef40dffc8, 0xc0003ba000})
	github.com/sagernet/sing-box/common/urltest/urltest.go:84 +0xb1
github.com/sagernet/sing-box/protocol/group.(*URLTestGroup).urlTest.func1()
	github.com/sagernet/sing-box/protocol/group/urltest.go:392 +0xfe
github.com/sagernet/sing/common/batch.(*Batch[...]).Go.func1()
	github.com/sagernet/sing@v0.8.13/common/batch/batch.go:59 +0xfd
created by github.com/sagernet/sing/common/batch.(*Batch[...]).Go in goroutine 58
	github.com/sagernet/sing@v0.8.13/common/batch/batch.go:50 +0xb6
Supporter
Integrity requirements
  • I confirm that I have read the documentation, understand the meaning of all the configuration items I wrote, and did not pile up seemingly useful options or default values.
  • I confirm that I have provided the server and client configuration files and process that can be reproduced locally, instead of a complicated client configuration file that has been stripped of sensitive data.
  • I confirm that I have provided the simplest configuration that can be used to reproduce the error I reported, instead of depending on remote servers, TUN, graphical interface clients, or other closed-source software.
  • I confirm that I have provided the complete configuration files and logs, rather than just providing parts I think are useful out of confidence in my own intelligence.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the supplied sample configuration with sing-box 1.13.19 and trace the panic through common/tls/client.go and protocol/vless/outbound.go, using the stack trace as the entry point. Confirm the missing outbound.tls.enabled case no longer crashes and add or update coverage in the relevant test area if one is found while tracing.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.