# Random Segmentation: New Traffic Obfuscation against Packet-Size-Based Side-Channel Attacks
## 1 Introduction  
The wide adoption of IoT devices comes with a privacy threat. Even with encryption, the metadata of encrypted traffic, such as the packet size, data volume, and packet inter-arrival time, can be utilized by passive observers to conduct _device fingerprinting_ (DF) attacks [1, 2]. These attacks enable observers to identify the presence of devices and their operational states, thereby allowing adversaries to infer privacy-sensitive information about user behaviors and activities. For example, [PERSON] et al. [3] show that an observer can identify which command a user gives to a smart speaker using the packet length sequence and direction. DF becomes feasible due to correlated information in encrypted traffic associated with IoT devices. Several studies [4, 5] have validated that an observer can passively capture the network traffic and use features of packets' lengths and timing to build machine learning-based classifiers for device identification. Once a device is successfully fingerprinted, the adversary may monitor the fluctuations in the device traffic to detect network events (e.g., Nest Thermostat is in Active or Idle mode) [6]. Hence, protecting against device identification would not only prevent DF, but also hinder event detection (i.e., event-level adversaries must identify the device first and then monitor for status-indicating patterns). WiFi observers can passively capture network traffic transmitted over the WiFi channel without joining the network (see Section 3). Furthermore, secured WiFi encryption cannot hide the MAC-layer traffic metadata, including the frame size, observation timestamp,and signal strength. The signal strength was not found to be a useful attribute for DF [2]. Thus, fingerprinting defense approaches aim to mutate the lengths and/or transmission time. For example, to address the packet-size leakage, the current traffic shaping methods mainly pad packets with additional bytes to obscure the related characteristics [7]. Regarding the timing side-channel, which falls outside the scope of this paper, adding a random packet delay has been employed as a means to prevent such information leakage [8]. Obviously, both countermeasures introduce data and time overhead. There has been active research on improving privacy with minimum data overhead [9; 10]. These methods are typically centered on minimizing the injected noisy data to conceal IoT traffic. However, these improvements fail to balance privacy protection and overhead [11] (i.e., the attack accuracy or data overhead is high). Inspired by the principles of TCP segmentation [12], we propose an alternative approach to distort length-based patterns without adding noise, thus achieving anonymity with a significantly lower data overhead. Our defensive strategy randomizes the packet lengths by breaking the data stream into random-sized chunks instead of injecting noise data for packet-size obfuscation. We implement our approach at the application level using TCP socket programming, which makes our defense easier to deploy. In this way, an IoT device manufacturer needs a simple software update on its devices to deploy the proposed defense without changing the devices' operating system or low-level codes. We realize our packet-size control by adjusting two local socket-programming parameters. First, we enable the TCP_NODELAY option to force the operating system to push out each packet with our specified length without waiting for additional data. TCP_NODELAY is a TCP socket option that can be used to turn on/off [PERSON]'s algorithm [13], which by default adds a small latency to improve the network efficiency. It minimizes the number of small TCP segments sent over the network by buffering the data and combining them into larger segments for transmission. Second, we downsize the sending buffer of the socket to prevent the sender from pushing out more data than can be received, which could disable our control of packet sizes.