sing-box icon indicating copy to clipboard operation
sing-box copied to clipboard

`naive` outbound with IPv6 address in "server" field shows "stream failed: unsafe port"

Open Primate8423 opened this issue 8 months ago • 1 comments

Operating system

Windows

System version

Windows 11 IoT Enterprise LTSC (26100.7781)

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

Environment: go1.25.7 windows/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,with_purego,badlinkname,tfogo_checklinkname0
Revision: 4b26ab16fb6d85c2fb35e6ac4e0d75ac69a15509
CGO: disabled

Description

When using NaiveProxy outbound with IPv6 address in server field, sing-box log shows "stream failed: unsafe port". Swapping server field with domain (e.g. 2001-114-514-1919--810.nip.io) does not exhibit the same error.

NaiveProxy server certificates were issued with acme.sh --issue -d "2001:114:514:1919::810" --listen-v6 --standalone --keylength ec-256 --cert-profile shortlived --days 3 command. (Basically Let's Encrypt IP certificates with shortlived profile)

Reproduction

Client config:

{
    "log": {
        "disabled": false,
        "level": "trace",
        "timestamp": true
    },
    "inbounds": [
        {
            "type": "mixed",
            "tag": "Mixed-In",
            "listen": "::",
            "listen_port": 1088,
            "set_system_proxy": false
        }
    ],
    "outbounds": [
        {
            "type": "naive",
            "tag": "Naive-QUIC-IPv6",
            "server": "[2001:114:514:1919::810]",
            "server_port": 443,
            "username": "YJSNPI",
            "password": "1145141919810",
            "udp_over_tcp": {
                "enabled": true,
                "version": 2
            },
            "quic": true,
            "quic_congestion_control": "bbr",
            "tls": {
                "enabled": true
            }
        }
    ],
    "route": {
        "final": "Naive-QUIC-IPv6",
        "auto_detect_interface": true
    }
}

Server config:

{
    "log": {
        "disabled": false,
        "level": "info",
        "timestamp": true
    },
    "inbounds": [
        {
            "type": "naive",
            "tag": "Naive-In",
            "listen": "::",
            "listen_port": 443,
            "users": [
                {
                    "username": "YJSNPI",
                    "password": "1145141919810"
                }
            ],
            "quic_congestion_control": "bbr",
            "tls": {
                "enabled": true,
                "certificate_path": "fullchain.cer",
                "key_path": "private.key"
            }
        }
    ]
}

Logs

+0000 2026-03-09 05:44:07 TRACE initialize networkmanager
+0000 2026-03-09 05:44:07 INFO network: updated default interface Ethernet, index 114514
+0000 2026-03-09 05:44:07 TRACE initialize networkmanager completed (0.55s)
+0000 2026-03-09 05:44:07 TRACE initialize transportmanager
+0000 2026-03-09 05:44:07 TRACE initialize transportmanager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE initialize router
+0000 2026-03-09 05:44:07 TRACE initialize router completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE initialize connectionmanager
+0000 2026-03-09 05:44:07 TRACE initialize connectionmanager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE initialize router
+0000 2026-03-09 05:44:07 TRACE initialize router completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE initialize manager
+0000 2026-03-09 05:44:07 TRACE outbound: initialize outbound/naive[Naive-QUIC-IPv6]
+0000 2026-03-09 05:44:07 TRACE outbound: initialize outbound/naive[Naive-QUIC-IPv6] completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE initialize manager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE initialize manager
+0000 2026-03-09 05:44:07 TRACE inbound: initialize inbound/mixed[Mixed-In]
+0000 2026-03-09 05:44:07 TRACE inbound: initialize inbound/mixed[Mixed-In] completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE initialize manager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE initialize manager
+0000 2026-03-09 05:44:07 TRACE initialize manager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE initialize manager
+0000 2026-03-09 05:44:07 TRACE initialize manager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE start manager
+0000 2026-03-09 05:44:07 TRACE outbound: start outbound/naive[Naive-QUIC-IPv6]
+0000 2026-03-09 05:44:07 INFO outbound/naive[Naive-QUIC-IPv6]: NaiveProxy started, version: 143.0.7499.109
+0000 2026-03-09 05:44:07 TRACE outbound: start outbound/naive[Naive-QUIC-IPv6] completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE start manager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE start transportmanager
+0000 2026-03-09 05:44:07 TRACE start transportmanager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE start router
+0000 2026-03-09 05:44:07 TRACE start router completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE start networkmanager
+0000 2026-03-09 05:44:07 TRACE start networkmanager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE start connectionmanager
+0000 2026-03-09 05:44:07 TRACE start connectionmanager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE start router
+0000 2026-03-09 05:44:07 TRACE start router completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE start manager
+0000 2026-03-09 05:44:07 TRACE inbound: start inbound/mixed[Mixed-In]
+0000 2026-03-09 05:44:07 INFO inbound/mixed[Mixed-In]: tcp server started at [::]:1088
+0000 2026-03-09 05:44:07 TRACE inbound: start inbound/mixed[Mixed-In] completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE start manager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE start manager
+0000 2026-03-09 05:44:07 TRACE start manager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE start manager
+0000 2026-03-09 05:44:07 TRACE start manager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE post-start manager
+0000 2026-03-09 05:44:07 TRACE outbound: post-start outbound/naive[Naive-QUIC-IPv6]
+0000 2026-03-09 05:44:07 TRACE outbound: post-start outbound/naive[Naive-QUIC-IPv6] completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE post-start manager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE post-start networkmanager
+0000 2026-03-09 05:44:07 TRACE post-start networkmanager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE post-start transportmanager
+0000 2026-03-09 05:44:07 TRACE post-start transportmanager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE post-start router
+0000 2026-03-09 05:44:07 TRACE post-start router completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE post-start connectionmanager
+0000 2026-03-09 05:44:07 TRACE post-start connectionmanager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE post-start router
+0000 2026-03-09 05:44:07 TRACE post-start router completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE post-start manager
+0000 2026-03-09 05:44:07 TRACE inbound: post-start inbound/mixed[Mixed-In]
+0000 2026-03-09 05:44:07 TRACE inbound: post-start inbound/mixed[Mixed-In] completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE post-start manager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE post-start manager
+0000 2026-03-09 05:44:07 TRACE post-start manager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE post-start manager
+0000 2026-03-09 05:44:07 TRACE post-start manager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE finish-start networkmanager
+0000 2026-03-09 05:44:07 TRACE finish-start networkmanager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE finish-start transportmanager
+0000 2026-03-09 05:44:07 TRACE finish-start transportmanager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE finish-start router
+0000 2026-03-09 05:44:07 TRACE finish-start router completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE finish-start connectionmanager
+0000 2026-03-09 05:44:07 TRACE finish-start connectionmanager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE finish-start router
+0000 2026-03-09 05:44:07 TRACE finish-start router completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE finish-start manager
+0000 2026-03-09 05:44:07 TRACE outbound: finish-start outbound/naive[Naive-QUIC-IPv6]
+0000 2026-03-09 05:44:07 TRACE outbound: finish-start outbound/naive[Naive-QUIC-IPv6] completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE finish-start manager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE finish-start manager
+0000 2026-03-09 05:44:07 TRACE inbound: finish-start inbound/mixed[Mixed-In]
+0000 2026-03-09 05:44:07 TRACE inbound: finish-start inbound/mixed[Mixed-In] completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE finish-start manager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE finish-start manager
+0000 2026-03-09 05:44:07 TRACE finish-start manager completed (0.00s)
+0000 2026-03-09 05:44:07 TRACE finish-start manager
+0000 2026-03-09 05:44:07 TRACE finish-start manager completed (0.00s)
+0000 2026-03-09 05:44:07 INFO sing-box started (0.66s)
+0000 2026-03-09 05:44:14 INFO [876331794 0ms] inbound/mixed[Mixed-In]: inbound connection from 127.0.0.1:60426
+0000 2026-03-09 05:44:14 INFO [876331794 0ms] inbound/mixed[Mixed-In]: inbound connection to example.com:443
+0000 2026-03-09 05:44:14 INFO [876331794 0ms] outbound/naive[Naive-QUIC-IPv6]: outbound connection to example.com:443
+0000 2026-03-09 05:44:14 WARN [876331794 1ms] outbound/naive[Naive-QUIC-IPv6]: stream failed: unsafe port
+0000 2026-03-09 05:44:14 TRACE [876331794 1ms] connection: connection upload closed
+0000 2026-03-09 05:44:14 ERROR [876331794 1ms] connection: connection download closed: unsafe port
+0000 2026-03-09 05:44:14 INFO [2981776634 0ms] inbound/mixed[Mixed-In]: inbound connection from 127.0.0.1:60427
+0000 2026-03-09 05:44:14 INFO [2981776634 0ms] inbound/mixed[Mixed-In]: inbound connection to example.com:443
+0000 2026-03-09 05:44:14 INFO [2981776634 0ms] outbound/naive[Naive-QUIC-IPv6]: outbound connection to example.com:443
+0000 2026-03-09 05:44:14 WARN [2981776634 0ms] outbound/naive[Naive-QUIC-IPv6]: stream failed: unsafe port
+0000 2026-03-09 05:44:14 TRACE [2981776634 0ms] connection: connection upload closed
+0000 2026-03-09 05:44:14 TRACE [2981776634 0ms] connection: connection download closed
+0000 2026-03-09 05:44:14 INFO [3522223585 0ms] inbound/mixed[Mixed-In]: inbound connection from 127.0.0.1:60428
+0000 2026-03-09 05:44:14 INFO [3522223585 0ms] inbound/mixed[Mixed-In]: inbound connection to example.com:443
+0000 2026-03-09 05:44:14 INFO [3522223585 0ms] outbound/naive[Naive-QUIC-IPv6]: outbound connection to example.com:443
+0000 2026-03-09 05:44:14 WARN [3522223585 0ms] outbound/naive[Naive-QUIC-IPv6]: stream failed: unsafe port
+0000 2026-03-09 05:44:14 TRACE [3522223585 0ms] connection: connection upload closed
+0000 2026-03-09 05:44:14 ERROR [3522223585 0ms] connection: connection download closed: unsafe port
+0000 2026-03-09 05:44:14 INFO [2401920618 0ms] inbound/mixed[Mixed-In]: inbound connection from 127.0.0.1:60429
+0000 2026-03-09 05:44:14 INFO [2401920618 0ms] inbound/mixed[Mixed-In]: inbound connection to example.com:443
+0000 2026-03-09 05:44:14 INFO [2401920618 0ms] outbound/naive[Naive-QUIC-IPv6]: outbound connection to example.com:443
+0000 2026-03-09 05:44:14 WARN [2401920618 0ms] outbound/naive[Naive-QUIC-IPv6]: stream failed: unsafe port
+0000 2026-03-09 05:44:14 TRACE [2401920618 0ms] connection: connection upload closed
+0000 2026-03-09 05:44:14 ERROR [2401920618 0ms] connection: connection download closed: unsafe port
+0000 2026-03-09 05:44:14 INFO [997114372 0ms] inbound/mixed[Mixed-In]: inbound connection from 127.0.0.1:60430
+0000 2026-03-09 05:44:14 INFO [997114372 0ms] inbound/mixed[Mixed-In]: inbound connection to example.com:443
+0000 2026-03-09 05:44:14 INFO [997114372 0ms] outbound/naive[Naive-QUIC-IPv6]: outbound connection to example.com:443
+0000 2026-03-09 05:44:14 WARN [997114372 0ms] outbound/naive[Naive-QUIC-IPv6]: stream failed: unsafe port
+0000 2026-03-09 05:44:14 TRACE [997114372 0ms] connection: connection upload closed
+0000 2026-03-09 05:44:14 ERROR [997114372 0ms] connection: connection download closed: unsafe port
+0000 2026-03-09 05:44:14 INFO [2088062132 0ms] inbound/mixed[Mixed-In]: inbound connection from 127.0.0.1:60431
+0000 2026-03-09 05:44:14 INFO [2088062132 0ms] inbound/mixed[Mixed-In]: inbound connection to example.com:443
+0000 2026-03-09 05:44:14 INFO [2088062132 0ms] outbound/naive[Naive-QUIC-IPv6]: outbound connection to example.com:443
+0000 2026-03-09 05:44:14 WARN [2088062132 0ms] outbound/naive[Naive-QUIC-IPv6]: stream failed: unsafe port
+0000 2026-03-09 05:44:14 TRACE [2088062132 0ms] connection: connection upload closed
+0000 2026-03-09 05:44:14 ERROR [2088062132 0ms] connection: connection download closed: unsafe port
+0000 2026-03-09 05:44:14 INFO [4098307090 0ms] inbound/mixed[Mixed-In]: inbound connection from 127.0.0.1:60432
+0000 2026-03-09 05:44:14 INFO [4098307090 0ms] inbound/mixed[Mixed-In]: inbound connection to example.com:443
+0000 2026-03-09 05:44:14 INFO [4098307090 0ms] outbound/naive[Naive-QUIC-IPv6]: outbound connection to example.com:443
+0000 2026-03-09 05:44:14 WARN [4098307090 0ms] outbound/naive[Naive-QUIC-IPv6]: stream failed: unsafe port
+0000 2026-03-09 05:44:14 TRACE [4098307090 0ms] connection: connection upload closed
+0000 2026-03-09 05:44:14 ERROR [4098307090 0ms] connection: connection download closed: unsafe port
+0000 2026-03-09 05:44:14 INFO [1466084413 0ms] inbound/mixed[Mixed-In]: inbound connection from 127.0.0.1:60433
+0000 2026-03-09 05:44:14 INFO [1466084413 0ms] inbound/mixed[Mixed-In]: inbound connection to example.com:443
+0000 2026-03-09 05:44:14 INFO [1466084413 0ms] outbound/naive[Naive-QUIC-IPv6]: outbound connection to example.com:443
+0000 2026-03-09 05:44:14 WARN [1466084413 0ms] outbound/naive[Naive-QUIC-IPv6]: stream failed: unsafe port
+0000 2026-03-09 05:44:14 TRACE [1466084413 0ms] connection: connection upload closed
+0000 2026-03-09 05:44:14 ERROR [1466084413 0ms] connection: connection download closed: unsafe port
+0000 2026-03-09 05:44:14 INFO [4239895303 0ms] inbound/mixed[Mixed-In]: inbound connection from 127.0.0.1:60434
+0000 2026-03-09 05:44:14 INFO [4239895303 0ms] inbound/mixed[Mixed-In]: inbound connection to example.com:443
+0000 2026-03-09 05:44:14 INFO [4239895303 0ms] outbound/naive[Naive-QUIC-IPv6]: outbound connection to example.com:443
+0000 2026-03-09 05:44:14 WARN [4239895303 0ms] outbound/naive[Naive-QUIC-IPv6]: stream failed: unsafe port
+0000 2026-03-09 05:44:14 TRACE [4239895303 0ms] connection: connection upload closed
+0000 2026-03-09 05:44:14 ERROR [4239895303 0ms] connection: connection download closed: unsafe port
+0000 2026-03-09 05:44:14 INFO [1086986552 0ms] inbound/mixed[Mixed-In]: inbound connection from 127.0.0.1:60435
+0000 2026-03-09 05:44:14 INFO [1086986552 0ms] inbound/mixed[Mixed-In]: inbound connection to example.com:443
+0000 2026-03-09 05:44:14 INFO [1086986552 0ms] outbound/naive[Naive-QUIC-IPv6]: outbound connection to example.com:443
+0000 2026-03-09 05:44:14 WARN [1086986552 0ms] outbound/naive[Naive-QUIC-IPv6]: stream failed: unsafe port
+0000 2026-03-09 05:44:14 TRACE [1086986552 0ms] connection: connection upload closed
+0000 2026-03-09 05:44:14 ERROR [1086986552 0ms] connection: connection download closed: unsafe port

Supporter

Integrity requirements

  • [x] 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.
  • [x] 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.
  • [x] 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.
  • [x] 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.

Primate8423 avatar Mar 09 '26 06:03 Primate8423

Fixed. Closing.

Primate8423 avatar Aug 19 '26 07:08 Primate8423