A second Ansible run against a server whose SSH host key had changed completed with ok=1 failed=0, no warning, and the replacement key appended to known_hosts. The same disclosure records the substitute server logging an accepted password for the controller’s user.
In this article
Why this matters
The failure is not that Ansible lacks a host-key check. It is that the check’s central assumption is wrong: trust-on-first-use is treated as permission to trust any key presented by a host, including one that contradicts a previously recorded key. That converts a signal of possible interception into routine key enrollment.
The affected path matters because it is the direction in which Ansible is moving. The paramiko transport is deprecated in favor of libssh, while the libssh-specific auto-add option can silently accept a changed key. Automation that manages network devices may therefore combine a deprecated backend with a replacement whose trust-on-first-use behavior is broader than operators expect (oss-security disclosure).
The consequences extend beyond a failed task. A controller that authenticates to an attacker-controlled server can disclose passwords or keyboard-interactive answers, while the attacker can read or alter commands and configuration sent to the target. Because the substituted key is written to known_hosts, subsequent runs can continue trusting it without repeating the initial interception (Red Hat CVE record).
| Claim | Status | Basis |
|---|---|---|
| Auto-add accepts a changed key without warning | Confirmed | Researcher reproduction and current source review |
| The substitute server receives controller credentials | Observed | Replacement server’s sshd log recorded an accepted password |
| Default non-interactive configurations fail closed | Confirmed | Disclosure reproduction and Red Hat assessment |
| The flaw affects only the libssh-specific auto-add path | Confirmed | Disclosure scoping and plugin source |
| A fixed release was available on 2026-11-13 | Not established | Disclosure, GitHub advisory and commit review found none |
| Active exploitation had occurred | Not established | CISA ADP records exploitation as “none” |
What happened
The researcher reported the issue to security@ansible.com and Red Hat Product Security on 2026-10-22. Red Hat confirmed it and assigned CVE-2026-126641 on 2026-11-11, then lifted the embargo on 2026-11-12. The MITRE CVE timeline records the report to Red Hat on November 11, so the earlier October date remains the researcher’s account of first contact rather than a date reconciled by a primary record (oss-security disclosure).
The technical defect begins in ansible-pylibssh. Its Session.verify_knownhost() asks libssh whether the server is known and returns success only for SSH_KNOWN_HOSTS_OK. The other states—SSH_KNOWN_HOSTS_CHANGED, SSH_KNOWN_HOSTS_OTHER and SSH_KNOWN_HOSTS_UNKNOWN—are routed to a single missing_host_key() policy hook. That hook receives a free-text message rather than the underlying libssh state, so a policy cannot reliably distinguish a first contact from a changed key (pylibssh session source).
The ansible.netcommon plugin then widens that ambiguity into acceptance. Its MyAddPolicy.missing_host_key() prompts only when host-key checking is enabled and auto-add is disabled. Otherwise, execution reaches session.hostkey_auto_add(username), which appends the presented key. The same path handles both changed and different-key-type states, so enabling auto-add bypasses the prompt and warning for a host already present in known_hosts (ansible.netcommon libssh plugin).
The reproduction used a local OpenSSH server started with host key A and restarted with host key B, with a fresh known_hosts file for each scenario. Under ANSIBLE_LIBSSH_HOST_KEY_AUTO_ADD=true, the first run saved A; the second ran against the key-B server without warning and appended B. The network_cli path with ssh_type=libssh produced the same result, while the library-level test connected and authenticated through ansible-pylibssh. By comparison, paramiko raised BadHostKeyException and OpenSSH StrictHostKeyChecking=accept-new refused the changed key (oss-security disclosure).
The behavior also diverges from libssh’s own guidance. Its ssh_known_hosts_e documentation describes SSH_KNOWN_HOSTS_CHANGED and SSH_KNOWN_HOSTS_OTHER as possible attack indicators requiring a warning, and the library’s tutorial stops the connection in those states. The flaw is therefore not an unavoidable consequence of trust-on-first-use; it is a policy mapping that collapses distinct security states into one permissive action (libssh known-hosts implementation).
Limits of the record
The exposure is narrower than the headline may suggest. It requires the libssh-specific auto-add setting—ANSIBLE_LIBSSH_HOST_KEY_AUTO_ADD=true, host_key_auto_add in [libssh_connection], or direct use of AutoAddPolicy—plus an existing known_hosts entry and an attacker able to intercept the SSH connection. The similarly named network_cli option ANSIBLE_HOST_KEY_AUTO_ADD is not forwarded to the libssh transport and does not by itself trigger this path (oss-security disclosure).
Default configurations are not affected. With host_key_checking enabled and auto-add unset, non-interactive runs fail closed for both unknown and changed keys, leaving known_hosts unchanged. Red Hat rates the issue Moderate with CVSS 3.1 score 6.5 and vector CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:N, classifying it as CWE-322. The NVD record was awaiting enrichment and carried no independent score, while CISA’s ADP data recorded no known exploitation (Red Hat CVE record).
A secondary weakness remains even outside the auto-add path: in an interactive run, the prompt treats an empty answer—pressing Enter—as consent, including when the message says the host key has changed. The upstream and published documentation for host_key_auto_add is also marked “TODO: write it,” leaving operators without a clear statement of its security boundary (Ansible libssh connection documentation).
The record does not establish a fixed release. As of 2026-11-13, the disclosure said no fixed release had been announced, the GitHub advisory listed affected and patched versions as unknown and remained marked “Unreviewed,” and no dedicated Red Hat errata had been published. Review of recent commits in both projects found only unrelated container, packaging, release-preparation and channel-handling work (GitHub advisory).
Mitigation
Until a fix is available, operators should not enable host_key_auto_add for the libssh connection plugin and should not use AutoAddPolicy with ansible-pylibssh. Host-key checking should remain enabled, and known_hosts should be populated from a trusted path—for example, through ssh-keyscan over a trusted channel—rather than learned automatically during the connection (oss-security disclosure).
Interactive operators should also avoid answering a host-key prompt with a bare Enter, because the current prompt logic treats the empty response as acceptance even for a changed key. The disclosure’s proposed code fix is to fail closed on SSH_KNOWN_HOSTS_CHANGED and SSH_KNOWN_HOSTS_OTHER before any policy runs, consult missing_host_key() only for unknown hosts, and stop treating an empty answer as consent in MyAddPolicy (Red Hat Bugzilla).
Method and sources
This analysis relies on the public oss-security disclosure, Red Hat’s CVE record and Bugzilla entry, the MITRE CVE record, the GitHub advisory, current upstream source for ansible-pylibssh and ansible.netcommon, and the projects’ commit histories. The disclosure’s reproduction and source excerpts support the behavioral claims; Red Hat supports the severity, affected-product and default-configuration assessment; the commit review supports the conclusion that no fix had landed by 2026-11-13 (MITRE CVE record).
The record is sufficient to establish the defect, its preconditions and the immediate mitigations. It does not establish exploitation in the wild, the full set of affected releases beyond those tested and listed, or the availability of a remediation at any later date.