← Lab /AI/ML

NVIDIA Merlin Transformers4Rec enables remote code execution via unsafe pickle deserialization

The unsafe use of torch.load() in Transformers4Rec allows an attacker to achieve remote code execution with root privileges.

AI/ML Zero Day Initiative Blog 24 Sep 2025 Disclosure Real-world evidence

Published as “CVE-2025-23298: Getting Remote Code Execution in NVIDIA Merlin”

Why it matters

The issue demonstrates that unsafe pickle deserialization continues to be a critical attack surface in ML frameworks, requiring immediate mitigation and safer serialization standards.

Summary

The researchers examined the load_model_trainer_states_from_checkpoint function in NVIDIA's Transformers4Rec library and found it calls torch.load() without safety checks, exposing the pickle deserialization path. They crafted a malicious checkpoint that executes an os.system command during loading, demonstrating remote code execution with root privileges. NVIDIA patched the issue by adding input validation and restricting deserialization to approved classes. The writeup emphasizes that pickle-based model loading remains a systemic risk in ML pipelines.

What they found 2

  1. The vulnerable function directly uses torch.load() without safety parameters, enabling unsafe pickle deserialization.

    “The vulnerability exists in the load_model_trainer_states_from_checkpoint function, which is responsible for restoring model states during training resumption or model deployment.”

  2. Loading a crafted checkpoint triggers immediate execution of an os.system command before model weights are loaded.

    “When a victim loads this checkpoint file using the vulnerable function, the os.system command executes immediately before any model weights are loaded.”

What’s new here 4

  • Identification of a critical RCE vulnerability (CVE-2025-23298) in the Transformers4Rec checkpoint loading code.
  • Demonstration of an exploit using a malicious pickle checkpoint that runs arbitrary commands.
  • Analysis of NVIDIA's patch that introduces a restricted deserialization mechanism.
  • Recommendations for safer model serialization practices such as using safetensors or weights_only=True.