CVE-2026-106440
Remote code execution via hydra-optuna-sweeper custom_search_space misuse.
- CVSS 7.8
- CWE-470
- Design Defects
- Remote
Hydra is a framework for elegantly configuring complex applications. From 1.2.0 until 1.3.0 and 1.4.0.dev10, the hydra-optuna-sweeper package accepts a configuration-controlled dotted path in hydra.sweeper.custom_search_space, resolves it with hydra.utils.get_method(), and later invokes the returned callable in the Hydra controller process. Because get_method() is a trusted-input lookup helper and does not apply the execution policy used by instantiate(), an attacker who controls Optuna sweep configuration or command-line overrides can select importable Python code for execution with the application's privileges, including bypassing a trusted execution whitelist on affected Hydra 1.4 development releases. This issue is fixed in versions 1.3.0 and 1.4.0.dev10.
- CWE
- CWE-470
- CVSS base score
- 7.8
- Published
- 2026-10-06
- OWASP
- A03 Injection
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Design Defects
- Subcategory
- Command Injection
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- Hydra
- Fixed by upgrading
- Yes
Solution
Upgrade Hydra to version 1.3.0 (or later, e.g., 1.4.0.dev10).
Vulnerable code sample
import hydra
from hydra.utils import get_method
from omegaconf import OmegaConf
def run_sweep(cfg):
# VULNERABLE: arbitrary callable execution via get_method
custom_search = get_method(cfg.sweeper.custom_search_space)
# The callable is invoked without any policy enforcement
return custom_search(cfg)
# Example configuration loading (normally provided by Hydra)
cfg = OmegaConf.create({
"sweeper": {
"custom_search_space": "os.system" # attacker-controlled
}
})
run_sweep(cfg)Patched code sample
import hydra
from hydra.utils import get_method, instantiate
from omegaconf import OmegaConf
def run_sweep(cfg):
# FIX: restrict to safe callables using instantiate's policy
# Only callables listed in a whitelist are allowed
whitelist = {"my_package.search_spaces.my_search"}
method_path = cfg.sweeper.custom_search_space
if method_path not in whitelist:
raise ValueError(f"Disallowed search space: {method_path}")
custom_search = get_method(method_path)
# Use instantiate to enforce any execution policy (even though whitelist already applied)
return instantiate(custom_search, cfg)
cfg = OmegaConf.create({
"sweeper": {
"custom_search_space": "my_package.search_spaces.my_search"
}
})
run_sweep(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.
- Merge commit from fork (hydra-ecosystem/hydra)
hydra/core/plugins.py,hydra/core/plugins.py · Plugins._instantiate,hydra/core/utils.py · run_job,hydra/main.py,hydra/utils.py,hydra/utils.py · get_class,hydra/utils.py · get_method,hydra/utils.py · get_object,hydra/_internal/execution_policy.py,hydra/_internal/execution_policy.py · _authorize_discovery_path,hydra/_internal/execution_policy.py · _authorize_discovery_result,hydra/_internal/execution_policy.py · _authorize_resolved_target_identityand 28 more - Merge commit from fork (hydra-ecosystem/hydra)
hydra/core/plugins.py,hydra/core/plugins.py · Plugins._instantiate,hydra/utils.py · get_class,hydra/utils.py · get_method,hydra/utils.py · get_object,hydra/_internal/instantiate/_instantiate2.py,hydra/_internal/instantiate/_instantiate2.py · instantiate,hydra/_internal/instantiate/_instantiate2.py · _call_target,hydra/_internal/logging_config.py,hydra/_internal/logging_config.py · HydraDictConfigurator.configure_formatter,hydra/_internal/logging_config.py · HydraDictConfigurator.configure_handler,hydra/_internal/logging_config.py · HydraDictConfigurator.resolveand 13 more
Cite this entry
@misc{vaitp:cve2026106440,
title = {{Remote code execution via hydra-optuna-sweeper custom_search_space misuse.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-106440},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-106440/}}
}
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 ::
