CVE-2026-68508
Arbitrary code execution via untrusted Hydra instantiate target values before v1.3.4.
- CVSS 7.8
- CWE-94
- Input Validation and Sanitization
- Remote
Hydra is a framework for elegantly configuring complex applications. Prior to 1.3.4, hydra.utils.instantiate() resolves and calls Python objects selected by configuration through _resolve_target() in hydra/_internal/instantiate/_instantiate2.py, allowing attacker-controlled target values and arguments to choose dangerous callables. A consuming application, library, CLI workflow, or model loader that passes untrusted configuration, CLI overrides, or model metadata into hydra.utils.instantiate() can therefore execute arbitrary code in its own process, including reading or modifying files and credentials or terminating the process. Version 1.3.4 adds target blocking with an explicit HYDRA_INSTANTIATE_ALLOWLIST_OVERRIDE escape hatch. This issue is fixed in version 1.3.4.
- CWE
- CWE-94
- CVSS base score
- 7.8
- Published
- 2026-08-21
- OWASP
- A08 Software and Data Integrity Failures
- Orthogonal defect classification
- Interface
- Code defect classification
- Missing Check
- Category
- Input Validation and Sanitization
- Subcategory
- Insecure Parsing or Deserialization
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- Hydra
- Fixed by upgrading
- Yes
Solution
Upgrade Hydra to version 1.3.4 or newer.
Vulnerable code sample
import os
from hydra.utils import instantiate
def load_component(user_cfg):
# VULNERABLE: untrusted _target_ can invoke arbitrary callables
component = instantiate(user_cfg)
return component
def run():
# Example untrusted configuration (could come from CLI or file)
cfg = {
"_target_": os.getenv("TARGET_CLASS", "builtins.eval"),
"code": "print('Executed malicious code')"
}
load_component(cfg)Patched code sample
import os
from hydra.utils import instantiate
def load_component(user_cfg):
# FIX: restrict instantiation to a safe allowlist
component = instantiate(user_cfg, _allowlist_override={"builtins": []})
return component
def run():
# Example untrusted configuration (could come from CLI or file)
cfg = {
"_target_": os.getenv("TARGET_CLASS", "builtins.eval"),
"code": "print('Executed malicious code')"
}
load_component(cfg)Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- Harden instantiate target blocklist (#3261) (hydra-ecosystem/hydra)
hydra/_internal/instantiate/_instantiate2.py,hydra/_internal/instantiate/_instantiate2.py · _resolve_target
Cite this entry
@misc{vaitp:cve202668508,
title = {{Arbitrary code execution via untrusted Hydra instantiate target values before v1.3.4.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-68508},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-68508/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
