Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2025-23349

CVE-2025-23349: Nvidia Megatron-lm RCE Vulnerability

CVE-2025-23349 is a remote code execution vulnerability in Nvidia Megatron-lm caused by code injection in the nq.py component. Attackers can exploit this to execute code and escalate privileges. Read on for technical details.

Updated:

CVE-2025-23349 Overview

NVIDIA Megatron-LM contains a code injection vulnerability in the tasks/orqa/unsupervised/nq.py component [CWE-94]. An authenticated local attacker can supply crafted input that Megatron-LM evaluates as code during execution. Successful exploitation leads to arbitrary code execution, privilege escalation, information disclosure, and data tampering on affected systems. The flaw affects all platforms running Megatron-LM through version 0.13.0, including release candidates rc0 through rc4. NVIDIA published advisory a_id/5698 addressing the issue.

Critical Impact

Local attackers with low privileges can achieve code execution on hosts running NVIDIA Megatron-LM, compromising confidentiality, integrity, and availability of large language model training environments.

Affected Products

  • NVIDIA Megatron-LM (all versions up to and including 0.13.0)
  • NVIDIA Megatron-LM 0.13.0 release candidates rc0, rc1, rc2, rc3, rc4
  • All platforms hosting the vulnerable tasks/orqa/unsupervised/nq.py component

Discovery Timeline

  • 2025-09-24 - CVE CVE-2025-23349 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2025-23349

Vulnerability Analysis

The vulnerability resides in the tasks/orqa/unsupervised/nq.py module of NVIDIA Megatron-LM, a framework used to train large transformer language models. The component processes Natural Questions (NQ) data as part of open-retrieval question answering (ORQA) unsupervised tasks. Attackers can inject code that the Python interpreter executes with the privileges of the training process. Megatron-LM workloads typically run on GPU-equipped systems with access to model weights, training datasets, and other sensitive artifacts. Code execution in this context enables theft of proprietary models, tampering with training data, and lateral movement within machine learning infrastructure.

Root Cause

The root cause is improper neutralization of special elements used in a code statement [CWE-94]. The nq.py component processes attacker-controllable input without adequate sanitization, allowing that input to be interpreted as executable code rather than data. This pattern typically arises from unsafe use of functions such as eval, exec, pickle.load, or dynamic import mechanisms on untrusted input.

Attack Vector

Exploitation requires local access and low privileges on the target system. No user interaction is needed. An attacker with a foothold on the training host, or one able to influence input files or dataset paths consumed by tasks/orqa/unsupervised/nq.py, can trigger the code injection when the vulnerable task runs. The attack does not traverse a network boundary, which limits remote exploitation but does not reduce impact on multi-tenant ML platforms where multiple users share GPU hosts.

No public proof-of-concept exploit is available, and the vulnerability is not listed in the CISA Known Exploited Vulnerabilities catalog. Refer to the NVIDIA Support Advisory for vendor-specific technical details.

Detection Methods for CVE-2025-23349

Indicators of Compromise

  • Unexpected child processes spawned by Python interpreters executing Megatron-LM training scripts, particularly under the tasks/orqa/unsupervised/ path.
  • Outbound network connections from GPU training hosts to previously unseen destinations during or after ORQA task execution.
  • Modifications to model checkpoints, training data, or configuration files that do not correspond to scheduled training jobs.
  • Unauthorized reads of credential files, SSH keys, or cloud provider metadata endpoints from ML training hosts.

Detection Strategies

  • Audit invocations of nq.py and log the source of any input files or dataset paths passed to the script.
  • Deploy endpoint telemetry on GPU training hosts to capture process ancestry, command-line arguments, and file writes originating from Python processes.
  • Monitor for the use of dangerous Python functions such as eval, exec, and pickle.load within Megatron-LM job execution traces.
  • Correlate Megatron-LM job scheduling events with subsequent process, network, and file-system activity to detect deviations from expected training behavior.

Monitoring Recommendations

  • Enable command-line and process-creation auditing on Linux training hosts, and forward logs to a centralized analytics platform.
  • Establish baselines for normal Megatron-LM job resource usage and alert on statistical outliers in CPU, memory, or network activity.
  • Track integrity of Megatron-LM installation directories using file integrity monitoring to detect tampering with tasks/orqa/unsupervised/nq.py or related modules.

How to Mitigate CVE-2025-23349

Immediate Actions Required

  • Inventory all systems running NVIDIA Megatron-LM and identify versions at or below 0.13.0, including release candidates.
  • Apply the fixed version referenced in the NVIDIA Support Advisory as soon as it is available in your environment.
  • Restrict local access to training hosts to authorized ML engineers and enforce least privilege on shared GPU clusters.
  • Review recent Megatron-LM ORQA task executions for anomalous input files, command-line arguments, or output.

Patch Information

NVIDIA has published guidance in advisory a_id/5698. Consult the NVIDIA Support Advisory and the CVE.org Record for CVE-2025-23349 for the specific fixed version and upgrade instructions. Upgrade all Megatron-LM installations to the patched release across development, staging, and production environments.

Workarounds

  • Do not execute tasks/orqa/unsupervised/nq.py against untrusted or attacker-controllable inputs until the patched version is deployed.
  • Run Megatron-LM training jobs inside isolated containers or virtual machines with restricted file-system and network egress permissions.
  • Enforce mandatory access controls, such as SELinux or AppArmor profiles, on Python processes executing Megatron-LM code to limit the blast radius of code execution.
  • Validate and sanitize all dataset paths and configuration inputs supplied to Megatron-LM ORQA tasks through code review or automated policy checks.
bash
# Configuration example
# Verify installed Megatron-LM version and identify vulnerable hosts
pip show megatron-lm | grep -i version

# Upgrade to the patched release referenced in NVIDIA advisory a_id/5698
pip install --upgrade megatron-lm

# Restrict execution of the vulnerable task pending patch deployment
chmod 000 tasks/orqa/unsupervised/nq.py

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.