CVE-2025-23304: NVIDIA NeMo Framework RCE
1. The AI Supply Chain Threat
Section titled “1. The AI Supply Chain Threat”In modern AI engineering, researchers frequently download pre-trained weights and models from public repositories to fine-tune them using frameworks like NVIDIA NeMo. This creates a massive supply chain vulnerability.
As detailed in our research on Training Data Poisoning & AI Supply Chain, adversaries no longer need to exploit network perimeters if they can trick a developer into downloading a poisoned artifact. CVE-2025-23304 weaponizes the .nemo file format itself to achieve immediate system compromise during the loading phase.
2. Technical Vulnerability Analysis
Section titled “2. Technical Vulnerability Analysis”The core of the vulnerability lies in how the NeMo framework parses and extracts the contents of a .nemo file.
A .nemo file is essentially a compressed archive (similar to a .tar or .zip file) containing neural network weights, configuration YAMLs, and metadata. Prior to version 2.3.2, the framework used unsafe extraction methods (such as tarfile.extractall without the secure filter='data' introduced in newer Python versions) when unpacking the model.
The Path Traversal to RCE Pipeline (CWE-22 to CWE-94)
Section titled “The Path Traversal to RCE Pipeline (CWE-22 to CWE-94)”Because the framework fails to validate the file paths embedded within the archive’s headers, an attacker can craft a .nemo file containing entries with directory traversal sequences (e.g., ../../../../home/user/.bashrc or ../../../../tmp/malicious.py).
When the victim runs standard NeMo loading functions (e.g., ModelPT.restore_from()), the framework blindly extracts the files. The attacker can overwrite existing Python scripts, system binaries, or configuration files on the host machine. If the attacker overwrites a Python script that the framework subsequently imports, the malicious code is executed with the privileges of the data scientist’s environment.
3. Exploitation Flow
Section titled “3. Exploitation Flow”- Weaponization: The threat actor creates a malicious
.nemoarchive. They insert a payload designed to overwrite a critical Python module (like asite-packagesdependency) using../sequences in the tar header. - Distribution: The poisoned model is uploaded to a popular model hub (e.g., HuggingFace) with an attractive name (e.g.,
Llama3-NeMo-Uncensored). - Ingestion: A victim developer or automated CI/CD pipeline downloads and initializes the model using the NeMo framework.
- Extraction & Overwrite: The vulnerable NeMo
restore_from()function extracts the archive, triggering the path traversal and silently overwriting the target Python file. - Code Execution: The Python interpreter loads the newly overwritten module, executing the attacker’s reverse shell or data exfiltration script.
4. Forensic Investigation (CSIRT)
Section titled “4. Forensic Investigation (CSIRT)”Investigating AI infrastructure compromises requires looking beyond traditional web server logs, focusing instead on High-Performance Computing (HPC) nodes and Jupyter Notebook environments.
- Process Lineage: The primary indicator is a Python process (or Jupyter kernel) suddenly spawning interactive shells (
/bin/sh,bash) or executing network utilities (curl,wget). - File System Anomalies: Search the file system for recent modifications to
.pyfiles or hidden startup files (.bashrc) that align with the timestamp of a.nemofile download or extraction. - Network Exfiltration: AI nodes often have access to massive, sensitive datasets. Monitor for outbound connections from Python processes to unknown IPs (correlate withSRUM network artifacts if on Windows, or
auditdon Linux).
5. Detection & Threat Hunting
Section titled “5. Detection & Threat Hunting”title: Suspicious Shell Spawned by Python/AI Frameworkid: 8b1a3c4d-2e5f-4a6b-9c0d-1e2f3a4b5c6dstatus: experimentaldescription: Detects Python processes (commonly used for AI frameworks like NeMo or PyTorch) spawning suspicious child shells, indicating potential RCE via poisoned models.logsource: category: process_creation product: linuxdetection: selection_parent: ParentImage|endswith: - '/python' - '/python3' - '/jupyter-notebook' selection_child: Image|endswith: - '/bin/sh' - '/bin/bash' - '/usr/bin/curl' - '/usr/bin/wget' condition: selection_parent and selection_childlevel: hightags: - attack.execution - cve.2025-23304# Hunt for Python processes writing files outside expected /tmp/ or model directoriesindex=os_logs sourcetype=linux_auditd action=created process="*python*"| search file_path="*/*" AND NOT (file_path="/tmp/*" OR file_path="/opt/models/*")| table _time, host, process, file_path, user| sort - _time6. Mitigation & Defensive Architecture
Section titled “6. Mitigation & Defensive Architecture”- Immediate Patching: Update the NVIDIA NeMo Framework to version 2.3.2 or later.
- Sandboxing AI Workloads: Never load untrusted
.nemomodels (orPickle/PyTorchweights) directly on host machines. AI model evaluation and inference must occur within strictly isolated, ephemeral Docker containers with no network egress permissions (except to authorized internal APIs). - Secure Extraction: For developers building AI platforms, ensure Python’s
tarfileextraction utilizes thefilter='data'parameter (available in Python 3.12+) to natively block path traversal sequences during archive decompression.
Sources & References
Section titled “Sources & References”- Palo Alto Unit 42: RCE Vulnerabilities in AI Python Libraries
- Ameeba Blog: NVIDIA NeMo Framework Vulnerability (CVE-2025-23304)
- Related Research: Training Data Poisoning & Sleeper Agents