Skip to content

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

MediumCVSS 6.5 EPSS 0.33%
Published
Updated
Exploit status
No public exploit known
CISA SSVC
No known exploitation · automatable: no · technical impact: partial
Technology
Red Hat

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.

Upgrade path

7 packages: 0 fixed, 7 with no fix yet.

PackageAffectedFixed inStatus
redhat ansible automation platform All versions No fix listed No fix yet
redhat/ansible-automation-platform-26/ee-supported-rhel9(Red Hat ansible_automation_platform 2) All versions No fix listed No fix yet
redhat/ansible-automation-platform-27/ee-supported-rhel9(Red Hat ansible_automation_platform 2) All versions No fix listed No fix yet
redhat/python-ansible-pylibssh(Red Hat ansible_automation_platform 2) All versions No fix listed No fix yet
redhat/python3.11-ansible-pylibssh(Red Hat ansible_automation_platform 2) All versions No fix listed No fix yet
redhat/python3.12-ansible-pylibssh(Red Hat ansible_automation_platform 2) All versions No fix listed No fix yet
redhat/python3x-ansible-pylibssh(Red Hat ansible_automation_platform 2) All versions No fix listed No fix yet

Affected products

ProductAffected versionsFixed in
redhat ansible automation platform All versions No fix listed
redhat/ansible-automation-platform-26/ee-supported-rhel9(Red Hat:ansible_automation_platform:2) All versions No fix listed
redhat/ansible-automation-platform-27/ee-supported-rhel9(Red Hat:ansible_automation_platform:2) All versions No fix listed
redhat/python3.11-ansible-pylibssh(Red Hat:ansible_automation_platform:2) All versions No fix listed
redhat/python3.12-ansible-pylibssh(Red Hat:ansible_automation_platform:2) All versions No fix listed
redhat/python3x-ansible-pylibssh(Red Hat:ansible_automation_platform:2) All versions No fix listed
redhat/python-ansible-pylibssh(Red Hat:ansible_automation_platform:2) All versions No fix listed

References