freenode

← CVE tracker

CVE-2026-126641

Ansible-pylibssh: accepts a changed ssh host key when host_key_auto_add is enabled

Severity
medium CVSS 6.5 (v3.1)
Affects
Red Hat Ansible Automation Platform 2 · Red Hat
Weakness
CWE-322: Key Exchange without Entity Authentication
Published
12 November 2026 by redhat
First seen on our lists
12 November 2026
A host key verification flaw was found in ansible-pylibssh and in the ansible.netcommon libssh connection plugin. When trust-on-first-use is enabled (host_key_auto_add on the libssh connection plugin, or AutoAddPolicy in ansible-pylibssh), a host that is already present in known_hosts but now presents a different key is accepted without warning. The pylibssh Session.verify_knownhost() method passes the SSH_KNOWN_HOSTS_CHANGED and SSH_KNOWN_HOSTS_OTHER states to the same missing_host_key() policy hook used for unknown hosts, and the bundled AutoAddPolicy/RejectPolicy classes (as well as ansible.netcommon's MyAddPolicy, which is modeled on paramiko's AutoAddPolicy) therefore add the changed key and continue the connection rather than aborting as paramiko's BadHostKeyException path would. As a result the controller authenticates to the substitute host, runs the play there, and appends the new key to known_hosts, which can disclose connection credentials to an attacker performing a machine-in-the-middle attack. Default configurations (host_key_checking enabled, host_key_auto_add unset) are not affected; non-interactive runs fail closed.

Our coverage

We have not written about this one. Know why it matters? Send a tip.

On the lists