6.5medium
Ansible-pylibssh: accepts a changed ssh host key when host_key_auto_add is enabled
- Severity
- 6.5medium CVSS:3.1 by redhat
- Exploit likelihood
- 0.33% (higher than 28% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- redhat
Description
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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| ansible-automation-platform-26/ee-supported-rhel9 | Not specified | CVE List |
| ansible-automation-platform-27/ee-supported-rhel9 | Not specified | CVE List |
| python3.11-ansible-pylibssh | Not specified | CVE List |
| python3.12-ansible-pylibssh | Not specified | CVE List |
| python3x-ansible-pylibssh | Not specified | CVE List |
| python-ansible-pylibssh | Not specified | CVE List |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-126641 changed 2026-11-13 | CVE Terms of Use |
| NVD | CVE-2026-126641 changed 2026-11-13 | Public domain |