From 683707c3141d67a9e67fe64da586cc92871b71c6 Mon Sep 17 00:00:00 2001 From: Adarsh Shirawalmath <114558126+adarshxs@users.noreply.github.com> Date: Tue, 6 May 2025 00:51:45 +0530 Subject: [PATCH] [Security][Bug] Prevent binding to all TCP interfaces (#5752) --- .../srt/distributed/device_communicators/shm_broadcast.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/distributed/device_communicators/shm_broadcast.py b/python/sglang/srt/distributed/device_communicators/shm_broadcast.py index 7a3b22e27..4e5c55a99 100644 --- a/python/sglang/srt/distributed/device_communicators/shm_broadcast.py +++ b/python/sglang/srt/distributed/device_communicators/shm_broadcast.py @@ -225,7 +225,8 @@ class MessageQueue: remote_subscribe_port = get_open_port() if is_valid_ipv6_address(connect_ip): self.remote_socket.setsockopt(IPV6, 1) - socket_addr = f"tcp://*:{remote_subscribe_port}" + connect_ip = f"[{connect_ip}]" + socket_addr = f"tcp://{connect_ip}:{remote_subscribe_port}" self.remote_socket.bind(socket_addr) else: