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

NaiveProxy quic=false

Open AKotov-dev opened this issue 6 months ago • 11 comments

Hello, I observed that sing-box naive mode still shows UDP/QUIC traffic even when quic=false is set. I verified this using Wireshark captures under different configurations.

p.s. Linux, caddy-forwardproxy-naive-2.11.2 + sing-box. Prove me if I'm wrong.

Test results...

Case 1: naive (quic):

No.	Time	Source	Destination	Protocol	Length	Info
534	10.265622592	192.168.0.125	server_ip	UDP	71	56523 → 443 Len=29
535	10.279323228	192.168.0.125	server_ip	UDP	71	56523 → 443 Len=29
536	11.070650552	192.168.0.125	server_ip	UDP	227	56523 → 443 Len=185
537	11.071016814	192.168.0.125	server_ip	UDP	1384	56523 → 443 Len=1342
538	11.071043187	192.168.0.125	server_ip	UDP	1392	56523 → 443 Len=1350
539	11.071057412	192.168.0.125	server_ip	UDP	1392	56523 → 443 Len=1350
540	11.071068571	192.168.0.125	server_ip	UDP	1392	56523 → 443 Len=1350
541	11.071079568	192.168.0.125	server_ip	UDP	657	56523 → 443 Len=615

Case 2: naive (https):

No.	Time	Source	Destination	Protocol	Length	Info
38	2.699417340	server_ip	192.168.0.125	TCP	66	443 → 42080 [ACK] Seq=9232 Ack=6841 Win=63616 Len=0 TSval=336027017 TSecr=2956460907
39	2.699417715	server_ip	192.168.0.125	TCP	78	443 → 42080 [ACK] Seq=9232 Ack=5279 Win=64128 Len=0 TSval=336027017 TSecr=2956460906 SLE=6675 SRE=6841
40	2.699417855	server_ip	192.168.0.125	TLSv1.3	101	Application Data
41	2.699417990	server_ip	192.168.0.125	TLSv1.3	101	Application Data
42	2.699581772	192.168.0.125	server_ip	TCP	66	42080 → 443 [ACK] Seq=7378 Ack=9302 Win=89088 Len=0 TSval=2956460957 TSecr=336027018
43	2.758221725	server_ip	192.168.0.125	TLSv1.3	774	Application Data
44	2.758222140	server_ip	192.168.0.125	TLSv1.3	157	Application Data
45	2.758367437	192.168.0.125	server_ip	TCP	66	42080 → 443 [ACK] Seq=7378 Ack=10101 Win=89088 Len=0 TSval=2956461016 TSecr=336027076
46	2.759061445	192.168.0.125	server_ip	TLSv1.3	367	Application Data
48	2.798568716	server_ip	192.168.0.125	TLSv1.3	1204	Application Data
47	2.759810548	server_ip	192.168.0.125	TLSv1.3	367	Application Data

Case 3: sing-box (type=naive, "udp_over_tcp": false, "quic": true)

No.	Time	Source	Destination	Protocol	Length	Info
5551	89.820467993	server_ip	192.168.0.125	QUIC	68	Protected Payload (KP0)
5552	89.829520378	server_ip	192.168.0.125	QUIC	521	Protected Payload (KP0)
5553	89.829785597	server_ip	192.168.0.125	QUIC	100	Protected Payload (KP0)
5555	90.461479236	192.168.0.125	224.0.0.251	MDNS	186	Standard query response 0x0000 AAAA, cache flush :: NSEC, cache flush e26adccd-9756-4bb4-89c1-7320c4534425.local
5554	89.842527336	192.168.0.125	server_ip	QUIC	71	Protected Payload (KP0), DCID=51d44c78
5556	90.750269108	192.168.0.125	server_ip	QUIC	165	Protected Payload (KP0), DCID=51d44c78
5557	90.827211422	server_ip	192.168.0.125	QUIC	68	Protected Payload (KP0)
5558	90.831872119	server_ip	192.168.0.125	QUIC	692	Protected Payload (KP0)
5559	90.845777515	192.168.0.125	server_ip	QUIC	71	Protected Payload (KP0), DCID=51d44c78

Case 4: sing-box (type=naive, "udp_over_tcp": false, "quic": false) + restart browser

No.	Time	Source	Destination	Protocol	Length	Info
9359	62.461604565	192.168.0.125	server_ip	QUIC	70	Protected Payload (KP0), DCID=eacc66cd
9360	62.475154993	192.168.0.125	server_ip	QUIC	71	Protected Payload (KP0), DCID=eacc66cd
9361	62.514736182	server_ip	192.168.0.125	QUIC	382	Protected Payload (KP0)
9363	62.516617098	192.168.0.125	server_ip	QUIC	947	Protected Payload (KP0), DCID=eacc66cd
9362	62.516338565	192.168.0.125	server_ip	QUIC	348	Protected Payload (KP0), DCID=eacc66cd
9364	62.531167224	server_ip	192.168.0.125	QUIC	1279	Protected Payload (KP0)
9365	62.531167647	server_ip	192.168.0.125	QUIC	1279	Protected Payload (KP0)
9366	62.531533963	server_ip	192.168.0.125	QUIC	1424	Protected Payload (KP0)
9367	62.531903725	server_ip	192.168.0.125	QUIC	1279	Protected Payload (KP0)
9368	62.532456650	server_ip	192.168.0.125	QUIC	1279	Protected Payload (KP0)
9369	62.532707236	server_ip	192.168.0.125	QUIC	1338	Protected Payload (KP0)
9370	62.532707398	server_ip	192.168.0.125	QUIC	141	Protected Payload (KP0)
9371	62.534387497	192.168.0.125	server_ip	QUIC	333	Protected Payload (KP0), DCID=eacc66cd
9372	62.570231519	server_ip	192.168.0.125	QUIC	67	Protected Payload (KP0)

Case 5: sing-box (type=naive, "udp_over_tcp": true, "quic": false) + restart browser

No.	Time	Source	Destination	Protocol	Length	Info
857	4.157349522	server_ip	192.168.0.125	QUIC	68	Protected Payload (KP0)
859	4.166440305	192.168.0.125	server_ip	QUIC	1287	Protected Payload (KP0), DCID=388beb13
858	4.164148074	server_ip	192.168.0.125	QUIC	375	Protected Payload (KP0)
860	4.166463982	192.168.0.125	server_ip	QUIC	1292	Protected Payload (KP0), DCID=388beb13
861	4.166473937	192.168.0.125	server_ip	QUIC	494	Protected Payload (KP0), DCID=388beb13
862	4.166614360	192.168.0.125	server_ip	QUIC	1287	Protected Payload (KP0), DCID=388beb13
863	4.166630700	192.168.0.125	server_ip	QUIC	798	Protected Payload (KP0), DCID=388beb13
864	4.168206989	server_ip	192.168.0.125	QUIC	285	Protected Payload (KP0)
865	4.168520900	server_ip	192.168.0.125	QUIC	253	Protected Payload (KP0)
866	4.169291825	192.168.0.125	server_ip	QUIC	149	Protected Payload (KP0), DCID=388beb13
868	4.218241349	server_ip	192.168.0.125	QUIC	67	Protected Payload (KP0)
867	4.218240970	server_ip	192.168.0.125	QUIC	67	Protected Payload (KP0)
869	4.246060290	server_ip	192.168.0.125	QUIC	68	Protected Payload (KP0)

Case 6: sing-box (type=http) + restart browser

No.	Time	Source	Destination	Protocol	Length	Info
574	2.864948149	192.168.0.125	95.163.61.53	TCP	66	55804 → 443 [ACK] Seq=4062 Ack=362220 Win=81 Len=0 TSval=1569662056 TSecr=1123074270
575	2.879924492	server_ip	192.168.0.125	TCP	66	443 → 51136 [ACK] Seq=4877 Ack=1787 Win=64128 Len=0 TSval=337167182 TSecr=1668567544
576	2.879924866	server_ip	192.168.0.125	TLSv1.3	289	Application Data
577	2.880249403	192.168.0.125	server_ip	TLSv1.3	2081	Application Data
578	2.932496622	server_ip	192.168.0.125	TCP	66	443 → 51136 [ACK] Seq=5100 Ack=3802 Win=64128 Len=0 TSval=337167234 TSecr=1668567596
579	2.978928644	server_ip	192.168.0.125	TLSv1.3	238	Application Data
580	2.979247694	192.168.0.125	server_ip	TLSv1.3	139	Application Data
581	2.979402734	192.168.0.125	server_ip	TLSv1.3	187	Application Data
582	2.979591500	192.168.0.125	server_ip	TLSv1.3	502	Application Data
583	3.030978798	server_ip	192.168.0.125	TCP	66	443 → 51136 [ACK] Seq=5272 Ack=3996 Win=64128 Len=0 TSval=337167333 TSecr=1668567695
584	3.072063738	server_ip	192.168.0.125	TCP	66	443 → 51136 [ACK] Seq=5272 Ack=4432 Win=64128 Len=0 TSval=337167374 TSecr=1668567695
585	3.077415205	server_ip	192.168.0.125	TLSv1.3	265	Application Data

Based on the collected captures, QUIC/HTTP3 traffic is still observed when quic=false is set in sing-box naive mode.

However, it is unclear whether this flag is intended to control client-side HTTP/3 (QUIC) selection, or only proxy transport behavior.

From the current observations, it appears the flag does not affect browser QUIC usage, only the proxy layer.

Could you clarify the intended scope of quic in naive mode? Is it expected to influence HTTP/3 (QUIC) at the client level, or only the transport layer of the proxy?

AKotov-dev avatar Jun 02 '26 16:06 AKotov-dev

This is normal behavior; try deleting all configurations related to 'h3'.

bob675i avatar Jun 05 '26 23:06 bob675i

@bob675i Thanks for your participation. Based on your answer in https://github.com/SagerNet/sing-box/issues/3493 I decided to add a little more information.

OS: Linux x86_64 (Mageia 10) glibc: 2.42 Browser: Chromium-based (Brave) System proxy: gsettings (HTTP/HTTPS → 127.0.0.1:8890) Browser QUIC: disabled TUN: not used (libproxy + gsettings)

sing-box: 1.13.x

Minimal configuration:

{
  "log": {
    "level": "debug"
  },

  "inbounds": [
    {
      "type": "http",
      "listen": "127.0.0.1",
      "listen_port": 8889
    }
  ],

  "outbounds": [
    {
      "type": "naive",
      "tag": "proxy",
      "server": "my-cool-domain.org",
      "server_port": 443,
      "username": "user",
      "password": "password",
      "quic": false,
      "udp_over_tcp": false,
      "tls": {
        "enabled": true,
        "server_name": "my-cool-domain.org"
      }
    }
  ],

  "route": {
    "final": "proxy"
  }
}

Server: caddy-forwardproxy-naive (v2.11.2-naive)

Reproduction: QUIC sessions appear when accessing high-traffic HTTP/3-capable websites (e.g. google.com, youtube.com) while all traffic is forced through naive outbound.

Behavior is consistent across multiple HTTP/3-heavy websites and is not site-specific.

Comparison with reference NaiveProxy implementation:

A reference NaiveProxy client (naiveproxy-v148.0.7778.96-5-linux-x64) under identical conditions does not produce any QUIC traffic.

In contrast, sing-box 1.13.x naive outbound ("quic": false) consistently establishes QUIC sessions to the upstream proxy server.

AKotov-dev avatar Jun 06 '26 05:06 AKotov-dev

Reproduction: QUIC sessions appear when accessing high-traffic HTTP/3-capable websites (e.g. google.com, youtube.com) while all traffic is forced through naive outbound.

My bad, I misunderstood your question earlier. I thought you meant naiveproxy was still connecting to the proxy server via QUIC despite "quic": false.

That field only dictates naiveproxy's own connection to the proxy server, and sing-box doesn't fully control it. Because it relies on the Chromium network stack, the client will often switch to an h3 connection automatically if the destination server advertises HTTP/3 support.

If you want to block QUIC connections, you can simply disable udp_over_tcp or refer to here for instructions on how to block them.

bob675i avatar Jun 06 '26 05:06 bob675i

Just to clarify the scope:

Is there any way in sing-box naive outbound to fully disable HTTP/3 (QUIC) negotiation to the upstream proxy, beyond the "quic" flag?

Or is switching to "type": "http" the only way to guarantee TCP-only upstream transport?

PS: In my tests, "udp_over_tcp": false does not appear to affect QUIC behavior in this scenario.

AKotov-dev avatar Jun 06 '26 05:06 AKotov-dev

This is not a sing-box problem. After "udp_over_tcp": false, there will be no quic going through the proxy. The traffic going through quic does not go through the proxy. If you want to disable quic on some web pages, make sure that the web page goes through the proxy.

bob675i avatar Jun 06 '26 05:06 bob675i

@bob675i Thank you for the explanation.

AKotov-dev avatar Jun 06 '26 06:06 AKotov-dev

Perhaps you can disable HTTP/3 in Caddyfile.

CodeIsWar avatar Jun 14 '26 16:06 CodeIsWar

@CodeIsWar

Thanks for the idea. The situation varies across our country: in some, quic is blocked (or its speed is throttled), while in others, it's not. I still decided to leave the option to switch between https/quic on the user side.

AKotov-dev avatar Jun 14 '26 18:06 AKotov-dev

One day all this will end. And they'll look at us like idiots. Time is the only parameter we can't change.

AKotov-dev avatar Jun 23 '26 17:06 AKotov-dev

I rediscover this issue. After investigation in code, I found that this is actually a bug in cronet-go. It only enables h2 but does not disable QUIC for the Chromium network stack, which by default enable quic. https://github.com/SagerNet/cronet-go/issues/11

rogerflowey avatar Jul 01 '26 15:07 rogerflowey

This cause a 90x slow down for me

rogerflowey avatar Jul 01 '26 15:07 rogerflowey