Exploited now
Vulnerability WatchVulnerabilities, exploits & advisories — updated every 15 minutes
Alerts

Home › News › Linux

Advisory Medium CVE Analysis

CVE-2026-126641: Ansible SSH Key Acceptance Flaw

A vulnerability in Ansible's SSH handling allows attackers to accept changed host keys without warning, potentially leading to credential exposure and persistent access.

LinuxSSHOperating systemsVulnerabilities

Key points

  • A security flaw, designated CVE-2026-126641, was made public on November 12, 2026, following a report to Red Hat Product Security on October 22, 2026.
  • The flaw impacts the ansible-pylibssh and ansible.netcommon libssh connection plugins, enabling the system to accept a modified SSH host key without any warning when host key auto-add is active.
  • The vulnerability could be exploited by an attacker who intercepts SSH communication between an Ansible controller and a previously connected host.

A security flaw, designated CVE-2026-126641, was made public on November 12, 2026, following a report to Red Hat Product Security on October 22, 2026. This flaw impacts the ansible-pylibssh and ansible.netcommon libssh connection plugins, enabling the system to accept a modified SSH host key without any warning when host key auto-add is active. The issue arises when a host already listed in the known_hosts file provides a different key, and the controller proceeds to authenticate without alerting the user. An attacker could intercept SSH communications between an Ansible controller and a previously connected host, possibly leading to the exposure of credentials and the ability to alter commands or configurations. Red Hat Product Security confirmed the vulnerability and categorized it as moderate with a CVSS score of 6.5. The affected versions include ansible-pylibssh 1.4.0 with libssh 0.12.0 and ansible.netcommon 8.7.1 with ansible-core 2.21.5. The flaw does not affect default configurations where host_key_checking is enabled and host_key_auto_add is not set. The root cause lies in pylibssh sending three distinct libssh states to a policy hook, which fails to differentiate between a new host and a modified key. The ansible.netcommon's MyAddPolicy is designed to accept changed keys, unlike paramiko, which raises an exception for mismatched keys. In interactive sessions with default settings, an empty response to the host key prompt is interpreted as consent, even if the key has changed. Testing procedures demonstrate that with host_key_auto_add enabled, the Ansible controller accepts a changed key and adds it to known_hosts without notification. To mitigate the risk, users should disable host_key_auto_add, pre-fill the known_hosts file, and ensure host_key_checking remains active. The vulnerability may be used to maintain ongoing access, since the attacker's key is persisted and later runs keep trusting it. The vulnerability was identified and reported by Satriyo Utomo from aleens-labs. The paramiko transport is no longer recommended, and users are being guided toward libssh. This flaw could allow an attacker to sustain trust in a compromised key for future connections. The problem stems from how the policy hook processes different libssh states, resulting in the incorrect acceptance of modified keys. The report includes links to the CVE record, bug report, and relevant GitHub repositories. The vulnerability could be exploited by an attacker who intercepts SSH communication between an Ansible controller and a previously contacted host. The issue is classified under CWE-322, which relates to key exchange without entity authentication. The flaw could enable an attacker to access or modify commands and configurations sent to a device. The report includes a timeline detailing the disclosure process and the confirmation by Red Hat. The vulnerability could be used to maintain persistent access to a system by keeping the attacker's key trusted. This issue is not limited to a specific platform and may affect any environment using the affected Ansible components.

What to do

  1. Disable host_key_auto_add to prevent automatic acceptance of changed keys.
  2. Pre-fill the known_hosts file to avoid automatic key addition.
  3. Ensure host_key_checking remains active to guarantee host key verification.

Our article, written with AI assistance from the facts of the original report and the official vulnerability data below. Read the original for full details.

Original report

oss-securityseclists.org

“CVE-2026-126641: ansible-pylibssh / ansible.netcommon libssh: changed SSH host key accepted when host_key_auto_add is enabled”

Posted by Ryo utomo on Nov 12 Hello, This is a public disclosure of CVE-2026-126641, a host key verification flaw in ansible-pylibssh and in the ansible.netcommon libssh connection plugin. Red Hat Product Security confirmed the issue, assigned the CVE and lifted the embargo on 2026-11-12. Summary ------- When trust-on-first-use is enabled (host_key_auto_add on the ansible.netcommon libssh plugin,…

Vulnerabilities mentioned

More on this topic