The vulnerability stems from the use of pickle for deserialization over ZeroMQ sockets, specifically through the recv_pyobj() method. The provided commit a5450f11c95847cf51a17207af9a3ca5ab569b2c patches this vulnerability by replacing recv_pyobj() and send_pyobj() calls with safer alternatives that do not use pickle (e.g., recv(), recv_multipart(), send(), send_multipart() with struct for serialization).
The analysis of the patch in vllm/distributed/kv_transfer/kv_pipe/mooncake_pipe.py reveals two key functions that were modified to remove the usage of recv_pyobj():
MooncakeKVPipe.wait_for_ack: This function previously called self.sender_ack.recv_pyobj().
MooncakeKVPipe.recv_bytes: This function previously called self.receiver_socket.recv_pyobj().
These functions are identified as vulnerable because they directly processed input received via recv_pyobj(), which performs unsafe deserialization using pickle.loads(). An attacker could exploit this by sending a malicious pickled payload, leading to remote code execution when these functions attempt to deserialize it.
The function MooncakeKVPipe.send_bytes was also modified to remove send_pyobj(). While send_pyobj() uses pickle.dumps(), which itself is not an RCE vector on the sender, it's part of the vulnerable communication channel. However, the primary RCE risk lies with recv_pyobj() which deserializes untrusted data.
The changes in _setup_metadata_sockets (binding to specific hosts instead of *) are mitigations to reduce the attack surface but do not address the core deserialization vulnerability itself. The functions wait_for_ack and recv_bytes are where the malicious data would be processed, triggering the RCE.