T05 · Unauthorized Access and Privilege Escalation
- Location
s2_indoor_air_adapter.py:19- Finding
Active LAN Discovery Occurs Without Explicit Scan-Level Consent
- Content
View full analysis
list: """发送 UDP 广播,扫描局域网内的传感器""" discovered_devices = [] try: # 建立真正的 UDP 广播 Socket sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) sock.settimeout(1.5) msg = b"S2-SP-OS: DISCOVER_SENSORS" sock.sendto(msg, ('', self.port)) # 接收响应 (此处为演示,真实环境会抓取所有响应的设备) while True: data, addr = sock.recvfrom(1024) discovered_devices.append({"ip": addr[0], "mac": "XX:XX:XX", "type": "Air_Sensor"}) except socket.timeout: pass # 扫描结束 except Exception: pass ``` ### Technical Analysis Discovery mode creates a broadcast-enabled UDP socket, sends an active probe to UDP port `54321` across the local broadcast domain, and records the IP addresses of responding devices. The read workflow has a consent flag, but the discovery workflow has no equivalent authorization check. Although LAN discovery is an advertised feature of the Skill, initiating network probes without explicit, scan-specific approval weakens least-privilege controls. It also exposes local network topology through the command output. The broad `except Exception` handler suppresses operational and permission errors, preventing the caller from reliably determining whether the scan was successful. ### Attack Path 1. A caller or Agent invokes the script with `--mode discover`. 2. No consent or authorization check is performed. 3. The script broadcasts `S2-SP-OS: DISCOVER_SENSORS` to UDP port `54321`. 4. Devices on the local broadcast domain may respond. 5. Responding IP addresses are collected and returned in the generated JSON. 6. The resulting addresses can be used as ...[truncated 472 chars]- Remediation
View remediation
