Arbitrary Code Execution via hydra.utils.instantiate
The hydra.utils.instantiate() function in hydra-core versions 1.3.3 and below is vulnerable to arbitrary code execution when processing untrusted configuration input, allowing attackers to hijack object instantiation.
CVE search metadata
CVE search record: CVE-2026-68508. Severity: high. CVSS: 7.8. KEV: no. Product: hydra-core (1.3.3 and earlier). Brief: Arbitrary Code Execution via hydra.utils.instantiate. Brief link: https://feed.craftedsignal.io/briefs/2026-08-hydra-rce/
Hydra is a framework used primarily for configuring complex applications, often in the machine learning and research domains. The library provides the hydra.utils.instantiate() function, which is designed to dynamically resolve and instantiate Python objects based on provided configuration structures. The vulnerability exists because instantiate() acts as a powerful object-construction engine; when a consuming application passes untrusted or semi-trusted configuration - such as model metadata or user-supplied CLI overrides - directly to this function, an attacker who can control the _target_ field within the configuration can force the application to instantiate arbitrary Python callables. This facilitates arbitrary code execution within the security context of the parent process. This vulnerability (CVE-2026-68508) is a design-level risk common in frameworks that provide recursive instantiation capabilities without default sandboxing or strict allowlisting. Users are advised to upgrade to version 1.3.4, which introduces a blacklist for dangerous targets, or to migrate to the allowlist-based model found in the 1.4 development branch.
Attack Chain
- Attacker identifies an application or research tool that consumes external data (e.g., model metadata or config files) and uses Hydra to process it.
- Attacker prepares a malicious configuration file containing a crafted
_target_key targeting a dangerous Python callable. - Attacker triggers the application to load the malicious configuration (e.g., via file upload, model import, or CLI argument).
- The application reads the external data and passes the dictionary structure into
hydra.utils.instantiate(). - Hydra resolves the malicious
_target_string into a Python class or function pointer. - Hydra invokes the callable with the attacker-controlled arguments provided in the configuration.
- The target callable executes, leading to arbitrary system commands or unauthorized logic execution within the host process.
Impact
Successful exploitation allows for execution of code within the privileges of the target process. This may result in unauthorized access to sensitive data (e.g., environment variables, API keys, training data), unauthorized modification of file systems, or process disruption. The severity is dependent on the role of the process - services running with elevated privileges or on sensitive infrastructure face the highest risk.
Recommendation
- Upgrade the
hydra-corepackage to version 1.3.4 or higher to benefit from the built-in blacklist of dangerous targets (CVE-2026-68508). - For applications handling untrusted inputs, implement a strict application-side allowlist for
_target_keys before passing data tohydra.utils.instantiate(). - Audit application code to identify call sites where external data, CLI overrides, or user-provided configuration files reach the
instantiate()function. - Monitor for anomalous file access or network connections originating from AI/ML research pipelines or model-loading services.
Immediate actions
Inventory all internal applications using hydra-core to assess if they process external/untrusted config.
Mitigations
Upgrade hydra-core to 1.3.4 or higher
CVE-2026-68508