Summary
ESA AnomalyMatch versions before 1.3.1 unsafely deserialize model checkpoint files using torch.load() without restricting the objects that can be instantiated.
If an attacker can influence or supply crafted checkpoint files in session directories, they may be able to execute arbitrary code in the context of the AnomalyMatch process.
Affected context
This vulnerability occurs in ESA AnomalyMatch deployments that load PyTorch model checkpoint files from session-specific directories.
The risk materializes when model files are treated as trusted input, such as when they are uploaded, synchronized, or otherwise influenced by external actors without strict validation or origin controls.
In these contexts, the torch.load() call is used with full deserialization capabilities, allowing arbitrary Python object construction during model loading.
Exploit preconditions
- Attack surface: Model checkpoint loading logic within ESA AnomalyMatch.
- Required access: Ability to write, replace, or influence checkpoint/model files in the relevant session directories (e.g., via upload, synchronization, or compromised storage).
- Trigger point: Invocation of
torch.load()on a crafted checkpoint file during normal AnomalyMatch workflows (such as model initialization, session loading, or anomaly analysis). - Why exploitation is possible:
torch.load()performs generic Python object deserialization using pickle under the hood, and the application treats these checkpoint files as trusted, enabling attacker-controlled code to run when the file is loaded.
Why this happens
The underlying bug is the use of unrestricted deserialization for model checkpoint files, a classic instance of CWE-502: Unsafe Deserialization.
PyTorch's torch.load() relies on Python's pickle mechanism, which is designed for object reconstruction, not for parsing untrusted data.
When checkpoint files from session directories are deserialized without verifying their provenance, applying a restricted loading mechanism, or constraining which objects may be instantiated, an attacker can embed payloads that execute during deserialization.
Conceptually, the application conflates "structured data for model parameters" with "trusted serialized objects," leading to a code execution primitive whenever crafted checkpoints are loaded.
Potential impact
- Execution of arbitrary code with the privileges of the ESA AnomalyMatch process.
- Compromise of the host running AnomalyMatch, including further lateral movement in the environment.
- Manipulation or exfiltration of sensitive anomaly detection data and configuration.
- Tampering with detection models, potentially degrading anomaly detection accuracy or hiding malicious activity.
- Use of the compromised AnomalyMatch instance as a pivot point for broader infrastructure attacks.
General mitigation guidance
Effective mitigation focuses on reducing trust in serialized model artifacts and constraining deserialization behavior:
- Prefer safe model loading patterns over generic object deserialization, such as using APIs that load only tensors and known model structures rather than arbitrary Python objects.
- Introduce an explicit trust boundary for checkpoint files: restrict who can create or modify them, and avoid loading artifacts from user-controlled or session-temporary locations without strong validation.
- Apply cryptographic signing or integrity verification to checkpoint files, and reject any artifact that fails verification.
- Isolate the model loading component with least-privilege execution (e.g., reduced OS permissions, containerization, or sandboxing) to limit blast radius if a malformed model is encountered.
- Enforce strict file-system permissions on session directories to prevent unauthorized modification of model artifacts.
How teams detect issues like this
Detection typically involves analyzing both code patterns and runtime behavior:
- Use static analysis or code scanning rules to flag uses of
torch.load()and other pickle-based APIs when applied to data that can originate outside tightly controlled build pipelines. - During code review, treat any deserialization of model artifacts as a security-sensitive operation; verify that loading paths are restricted and that artifacts are authenticated.
- Implement logging around model loading operations, including the source path, checksum, and relevant user/session metadata; monitor for unusual or unexpected checkpoint sources.
- Employ host and application monitoring to detect anomalous processes, network connections, or file modifications originating from the AnomalyMatch service around the time model files are loaded.

