Summary
AI Tensor Engine for ROCm (AITER) uses Python pickle deserialization in its MessageQueue.recv() function without authentication, integrity checks, or input validation on ZMQ SUB sockets.
An unauthenticated attacker who can reach the XPUB/SUB messaging endpoints can send a crafted pickle payload that executes arbitrary code in the context of the inference worker processes across all connected reader workers.
Affected context
This vulnerability arises in AITER deployments that rely on ZeroMQ-based broadcast messaging between writer and reader workers using the MessageQueue.recv() API implemented in shm_broadcast.py.
In affected versions, the SUB socket accepts pickled messages from a writer XPUB endpoint without authentication, HMAC verification, or format validation, and then directly deserializes them.
Environments where cluster messaging networks are reachable from other services, tenants, or partially untrusted segments are particularly exposed, since the messaging layer is implicitly trusted to carry only well-formed, benign pickle objects.
Exploit preconditions
- Attack surface: ZMQ XPUB/SUB messaging endpoints used for distributing inference-related messages.
- Required access: Network-level ability to:
- Reach the writer XPUB endpoint on the cluster network, or
- Provide a forged Handle configuration with an attacker-controlled
remote_subscribe_addrthat points to an attacker-controlled publisher. - Authentication: No authentication, HMAC, or message signing is required; endpoints implicitly trust any publisher reachable over the configured address.
- Trigger point: The MessageQueue.recv() function on the SUB side automatically receives and unpickles messages as part of normal worker operation.
- Why exploitation is possible: The code path uses Python's pickle deserialization on untrusted data without enforcing a safe format, schema, or source validation, allowing attacker-controlled object graphs to execute arbitrary code during deserialization.
Why this happens
The core issue is the use of Python's pickle module to deserialize untrusted messages received over the network.
Pickle is a general-purpose serialization format that supports object construction and arbitrary code execution during loading, and is not designed for untrusted inputs.
In AITER, the MessageQueue.recv() implementation assumes that all incoming ZMQ messages are benign and directly passes them to pickle.loads (or equivalent) without:
- Authenticating the sender,
- Enforcing integrity via HMAC or signatures, or
- Restricting the types or structure of deserialized objects.
This is a textbook instance of CWE-502: Unsafe Deserialization, where attacker-controlled serialized data is treated as trusted program state, enabling the execution of arbitrary code when the object graph is reconstructed.
Potential impact
- Execution of arbitrary code in the context of the inference worker processes.
- Simultaneous compromise of all remote reader workers subscribed to the malicious publisher.
- Theft or exfiltration of model weights, configuration secrets, or in-memory data processed by workers.
- Manipulation or poisoning of inference results and AI pipelines.
- Establishment of a foothold for lateral movement within the cluster or surrounding infrastructure.
- Denial of service by crashing or destabilizing distributed worker nodes.
General mitigation guidance
Effective mitigation focuses on eliminating unsafe deserialization and reducing implicit trust in messaging channels:
- Avoid pickle for untrusted data:
- Replace pickle-based serialization with safer, data-only formats such as JSON, MessagePack, or protocol buffers, ensuring that deserialization reconstructs plain data structures rather than arbitrary objects.
- Constrain trusted sources:
- Treat cluster messaging endpoints as sensitive interfaces and ensure they are only reachable from explicitly trusted components and networks.
- Use network segmentation and strict access control lists to narrow which entities can publish to XPUB/SUB endpoints.
- Add authentication and integrity:
- Introduce message authentication (e.g., shared-key HMAC, mutual TLS, or equivalent) so that workers only accept messages from authenticated publishers.
- Enforce integrity checks before processing or deserializing message payloads.
- Schema and type validation:
- Enforce strict schemas on incoming messages, validating structure, types, and expected fields before deserialization, and reject anything that deviates from expected formats.
- Runtime hardening:
- Run inference and reader workers with least-privilege identities and minimal filesystem or network permissions to constrain blast radius if a worker is compromised.
- Isolate high-risk components—such as message receivers—in separate processes or containers, so deserialization faults are contained.
How teams detect issues like this
Detection efforts can target both code-level issues and runtime behavior:
- Static analysis and code review:
- Search for usage of
pickle.load,pickle.loads, or similar APIs in message-handling code, especially where inputs originate from network sockets, queues, or IPC mechanisms. - Flag patterns where deserialization occurs on data from ZMQ, sockets, shared memory queues, or other remote sources without prior validation or authentication.
- Incorporate secure serialization guidelines into code review checklists, particularly for distributed systems and cluster messaging logic.
- Policy and CI/CD enforcement:
- Enforce policies in CI pipelines that disallow unsafe deserialization APIs in network-facing components, optionally allowing them only in clearly documented, tightly controlled contexts.
- Use automated code scanning tools configured with rules specific to unsafe deserialization (CWE-502) and unsafe use of pickle.
- Runtime monitoring:
- Monitor inference worker processes for unexpected child processes, suspicious command executions, or anomalous file and network activity indicative of arbitrary code execution.
- Capture and inspect ZMQ message traffic at the boundary (where legally and technically permissible) for unusual or malformed payloads that could signal an attack attempt.

