Description
The _load_model() function in the neural_magic_training.py script of the optimate project in commit a6d302f912b481c94370811af6b11402f51d377f (2024-07-21) allows arbitrary code execution. When a user supplies a directory path via the --model command-line argument, the function reads a module.py file from that directory and executes its contents directly using Python's exec() function. This design does not validate or sanitize the file's content, allowing an attacker who controls the input directory to execute arbitrary Python code in the context of the process running the script.
Published: 2026-05-12
Score: n/a
EPSS: n/a
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

The load_model() routine in the neural_magic_training.py script of the Optimate project executes a module.py file from a user‑supplied directory using Python's exec() without any validation. An attacker who can supply or control the contents of the directory specified with the --model option can thus run arbitrary Python code in the context of the process that invokes the script. This flaw effectively gives the attacker local code execution privileges within the environment where the script is executed, potentially allowing system compromise, data exfiltration, or further lateral movement.

Affected Systems

The vulnerability affects the Optimate repository maintained by Nebuly AI, specifically the state captured by commit a6d302f912b481c94370811af6b11402f51d377f dated 2024-07-21. No vendor product list beyond this open‑source project is specified in the CNA data.

Risk and Exploitability

The EPSS score for this issue is not available and the vulnerability is not listed in CISA's KEV catalog, but the weakness is clearly high in severity due to the direct use of exec() on untrusted input. The most likely attack vector is local: an attacker who can place files in or specify a directory for the --model argument can trigger arbitrary code execution. The flaw does not require any special network exposure and has no dependency on external services. Because the code runs with whatever privileges the script owner has, the impact can be full system compromise if the process is privileged.

Generated by OpenCVE AI on May 12, 2026 at 17:47 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Apply the latest patched release of Optimate, or backport a fix that removes the unvalidated exec() call or implements proper validation of the module file.
  • If an update is not available, restrict the --model parameter to directories that contain only files signed or otherwise verified by your deployment process, and implement a checksum or hash validation step before execution.
  • Execute the Optimate script in a container or virtual environment with the minimum necessary privileges, ensuring that the process cannot write to or read sensitive system locations.

Generated by OpenCVE AI on May 12, 2026 at 17:47 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Tue, 12 May 2026 18:15:00 +0000

Type Values Removed Values Added
Title Arbitrary Code Execution via Unvalidated Exec in Optimate's load_model Function
Weaknesses CWE-94

Tue, 12 May 2026 16:00:00 +0000

Type Values Removed Values Added
Description The _load_model() function in the neural_magic_training.py script of the optimate project in commit a6d302f912b481c94370811af6b11402f51d377f (2024-07-21) allows arbitrary code execution. When a user supplies a directory path via the --model command-line argument, the function reads a module.py file from that directory and executes its contents directly using Python's exec() function. This design does not validate or sanitize the file's content, allowing an attacker who controls the input directory to execute arbitrary Python code in the context of the process running the script.
References

Subscriptions

No data.

cve-icon MITRE

Status: PUBLISHED

Assigner: mitre

Published:

Updated: 2026-05-12T15:06:42.759Z

Reserved: 2026-03-09T00:00:00.000Z

Link: CVE-2026-31217

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-05-12T16:16:13.600

Modified: 2026-05-12T16:16:13.600

Link: CVE-2026-31217

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-05-12T18:00:12Z

Weaknesses