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

Medium 6.5 Published Updated

A machine-in-the-middle attacker can impersonate hosts to Ansible when host_key_auto_add is enabled, since changed host keys are accepted without warning.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Harmful if only installed
No
Needs a specific call
Yes
Fix
None listed

What is CVE-2026-126641?

CVE-2026-126641 is a medium-severity security feature bypass vulnerability in Red Hat Ansible Automation Platform 2, published on 12 Nov 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official 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.

Weakness: CWE-322

Which versions are affected by CVE-2026-126641?

An affected version is only exploitable if your software calls Session.verify_knownhost() or AutoAddPolicy. Many projects that include it are not exposed.

How do I fix CVE-2026-126641?

No fix has been published for CVE-2026-126641 yet. Limit exposure of the affected software until one is available.

Upgrade to the fixed version, and do not rely on a single control for protection. More about Security feature bypass.

Is CVE-2026-126641 being exploited?

There is no known exploitation of CVE-2026-126641 in the wild and no public exploit code.

Sources

Also known as GHSA-qvc6-2r95-pxqv.

Is CVE-2026-126641 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free