CVE-2026-126641 — Red Hat Ansible Automation Platform 2
One of 5 Red Hat Ansible Automation Platform 2 vulnerabilities published together by NVD: our article covers all of them.
LinuxOperating systemsVulnerabilitiesResearch article
CVE-2026-126641: Host Key Change Silently Accepted in ansible-pylibssh and ansible.netcommon libssh Plugin Under TOFU Settings
| CVE | CVE-2026-126641 |
|---|---|
| Vendor and product | Red Hat Ansible Automation Platform 2 |
| Published | November 12, 2026 11:50 UTC |
| Research cut-off | November 12, 2026 11:45 UTC |
| Sources reviewed | 2: NVD record (last modified 2026-11-12); CISA KEV catalog |
Executive summary
CVE-2026-126641 is a host key verification weakness affecting ansible-pylibssh and the libssh connection plugin within ansible.netcommon [1]. When trust-on-first-use behavior is turned on via hostkey_auto_add on the libssh plugin, or AutoAddPolicy in ansible-pylibssh, a remote host whose SSH key no longer matches the entry stored in known_hosts is accepted without any alert rather than being rejected [1]. NVD scored the flaw CVSS 3.1 at 6.5 (MEDIUM), vector CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:N, submitted by secalert@redhat.com [1]. The record maps to CWE-322, Key Exchange without Entity Authentication [1]. Exploitation requires an attacker capable of intercepting or redirecting the SSH session (a machine-in-the-middle position) at the moment the Ansible controller connects to a host it has previously trusted [1]. Consequence is that the controller authenticates to the attacker-controlled endpoint, executes the play against it, and writes the substitute key into known_hosts, exposing connection credentials and potentially play content to the interceptor [1]. Default configurations, where host key checking is enabled and hostkey_auto_add is left unset, are not affected, and non-interactive automation runs fail closed rather than silently connecting [1]. The CVE is not present in the CISA Known Exploited Vulnerabilities catalog as of the research cut-off, which is not proof that exploitation has not occurred [2]. The most urgent action is to audit all ansible.netcommon libssh and ansible-pylibssh configurations for hostkey_auto_add or AutoAddPolicy usage and disable trust-on-first-use acceptance of changed keys until patched guidance is applied [1].
Key points
- A dispatch flaw in ansible-pylibssh's Session.verify_known_host() routes both 'host key changed' and 'unknown host' states to the same auto-accept policy hook, so changed keys are silently trusted under TOFU settings [1].
- Exploitation requires hostkey_auto_add enabled on the ansible.netcommon libssh connection plugin, or AutoAddPolicy enabled in ansible-pylibssh, plus an attacker able to intercept the controller-to-host SSH connection (MITM) [1].
- Default Ansible configurations with host key checking enabled and hostkey_auto_add unset are not affected, and non-interactive runs fail closed [1].
- CVSS 3.1 score is 6.5 MEDIUM (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:N), mapped to CWE-322, Key Exchange without Entity Authentication [1].
- CVE-2026-126641 is not listed in the CISA KEV catalog as of 2026-11-12, and no proof-of-concept or in-the-wild exploitation evidence is present in the reviewed sources [2].
- No fixed version or vendor patch identifier is given in the reviewed sources; only Red Hat tracking references (CVE page and Bugzilla 2571719) are available [1].
Vulnerability identification
| Field | Value |
|---|---|
| CVE ID | CVE-2026-126641 [1] |
| Affected projects | ansible-pylibssh; ansible.netcommon libssh connection plugin [1] |
| Vendor/ecosystem | Red Hat / Ansible project (advisory tracked via Red Hat Bugzilla) [1] |
| Component | SSH host key verification logic (Session.verify_known_host, missing_host_key policy hook) [1] |
| Record status | Awaiting Analysis [1] |
| Published | 2026-11-12T11:17:11 UTC [1] |
| Last modified | 2026-11-12T11:17:11 UTC [1] |
| CVSS 3.1 | 6.5 MEDIUM, CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:N, scored by secalert@redhat.com (Primary) [1] |
| CWE | CWE-322, Key Exchange without Entity Authentication: the software negotiates or establishes a secure session without adequately verifying the identity of the remote party, here manifesting as acceptance of a changed host key [1] |
| Related references | Red Hat CVE page (access.redhat.com/security/cve/CVE-2026-126641); Red Hat Bugzilla 2571719 [1] |
| KEV status | Not listed as of 2026-11-12 [2] |
Only one CVSS score is present in the reviewed evidence; no conflicting vendor or third-party score was found.
Technical background
Ansible automates configuration and command execution on remote hosts primarily over SSH. Two components in this ecosystem implement SSH transport using the libssh library rather than OpenSSH's client binary: ansible-pylibssh, a Python binding around libssh used as a connection backend, and the libssh connection plugin shipped in the ansible.netcommon collection, which is commonly used for network device automation [1].
SSH host key verification is the mechanism by which an SSH client confirms that the server it has connected to is the one it previously trusted, based on a locally stored known_hosts file mapping hostnames to public keys. Trust-on-first-use (TOFU) is a model where a client automatically accepts and records a host's key the first time it connects, without independent out-of-band verification, and then expects that key to remain constant on subsequent connections. A change in a previously recorded key is the primary signal SSH clients use to detect a possible machine-in-the-middle (MITM) interception, where an attacker interposes itself between client and server and presents its own key.
In ansible-pylibssh, the behavior for known_hosts handling is configurable through policy classes, including AutoAddPolicy, modeled conceptually on paramiko's class of the same name, and a RejectPolicy. In ansible.netcommon's libssh connection plugin, the equivalent behavior is governed by the hostkey_auto_add setting, implemented via a policy class named MyAddPolicy that is also modeled on paramiko's AutoAddPolicy [1].
Vulnerability description
The flaw violates the authentication/entity-verification property that SSH host key checking is meant to provide: confirmation that the server being connected to is the one previously trusted, not an impostor [1]. The defective component is the verify_known_host() method in the pylibssh Session class together with the AutoAddPolicy, RejectPolicy and ansible.netcommon MyAddPolicy classes built on it [1].
When host key auto-add behavior is enabled, a server presenting a key that differs from the one stored for it is treated the same as a server being contacted for the very first time: its new key is silently accepted and the connection proceeds [1]. The practical effect is that an attacker positioned to intercept the connection can substitute their own host key, and the controller will connect, authenticate, run the requested play, and store the attacker's key for future use — all without any warning or interruption [1].
This requires that trust-on-first-use acceptance is explicitly enabled (hostkey_auto_add on the netcommon plugin, or AutoAddPolicy in ansible-pylibssh) [1]. The evidence does not establish that default Ansible installations are exposed: with host key checking enabled and hostkey_auto_add left unset, the behavior described does not occur, and interactive-free (non-interactive) runs are stated to fail closed instead of connecting [1]. The record does not describe any flaw in password or key-based user authentication to the target host, nor any vulnerability in libssh's cryptographic primitives themselves — the defect is confined to how a changed-key event is routed through policy logic.
Root cause analysis
Confirmed: the verify_known_host() method in pylibssh's Session class passes two distinct libssh verification outcomes — SSH_KNOWN_HOSTS_CHANGED (key differs from a known entry) and SSH_KNOWN_HOSTS_OTHER (key type differs from what is recorded) — into the same missing_host_key() policy hook that is invoked for a genuinely unknown host (SSH_KNOWN_HOSTS_NOT_FOUND equivalent conditions) [1].
Because the policy hook cannot distinguish "never seen before" from "key changed since last seen," any policy that is configured to auto-accept unknown hosts — AutoAddPolicy in ansible-pylibssh, or MyAddPolicy in ansible.netcommon's libssh plugin — ends up also auto-accepting changed hosts [1]. This differs from the behavior of paramiko, where a changed-key condition raises a distinct BadHostKeyException that is not routed through the same unknown-host policy path, and would therefore abort the connection rather than silently continue [1].
The root cause is therefore an error-handling/state-classification defect: a failure to preserve the distinction between "no record exists" and "record exists but conflicts" when dispatching to policy code, Confirmed by the NVD description's technical detail [1]. No further detail on why this design choice was made, or whether it was an intentional simplification versus an oversight, is given in the reviewed sources; that aspect is Unknown.
Technical mechanics
- The Ansible controller initiates an SSH connection to a managed host using either ansible-pylibssh as the connection backend or the ansible.netcommon libssh connection plugin [1].
- The remote peer completes the SSH key exchange and presents its host public key.
- libssh compares the presented key against the known_hosts store and returns one of several states, including "not found" (new host), "ok" (matches), "changed" (key differs from stored entry), and "other" (key type differs) [1].
- In pylibssh's Session.verify_known_host(), both the "changed" and "other" states are forwarded to the same missing_host_key() policy callback used for the "not found" state [1] — this is the validation-routing failure at the core of the issue.
- If the active policy is AutoAddPolicy (pylibssh) or MyAddPolicy (ansible.netcommon libssh plugin), the callback adds the presented key to known_hosts and returns success, regardless of whether the key was new or had actually changed [1].
- The SSH session proceeds to user authentication and command/play execution against the peer that presented the key, without the controller operator receiving any indication that the key differed from a previously trusted value [1].
- known_hosts is updated to reflect the new key, meaning a subsequent legitimate connection to the real host, if the attacker is no longer interposed, would again trigger a "changed" state against the attacker's now-recorded key rather than against the original legitimate key.
Preconditions: hostkey_auto_add set on the netcommon libssh plugin, or AutoAddPolicy configured in ansible-pylibssh; interactive or otherwise permissive execution context, since non-interactive runs fail closed [1]. The control that should have prevented this is a policy branch that rejects or explicitly warns on a "changed" state rather than treating it identically to "not found"; RejectPolicy is listed among the affected policy classes as well, which the description groups with AutoAddPolicy as reusing the same flawed dispatch [1] — the evidence does not clarify RejectPolicy's exact resulting behavior, so its practical effect is Unknown beyond the general dispatch flaw.
[SSH connect attempt] -> [libssh key-state check]
|-- NOT_FOUND --> missing_host_key() --> AutoAddPolicy adds key --> connect (intended TOFU)
|-- CHANGED ----> missing_host_key() --> AutoAddPolicy adds key --> connect (FLAW: should warn/reject)
|-- OTHER ------> missing_host_key() --> AutoAddPolicy adds key --> connect (FLAW: should warn/reject)
|-- OK ---------> connect normally
This diagram reflects the dispatch behavior Confirmed in the NVD description [1]; it is not a literal reproduction of source code.
Attack surface and exploitation prerequisites
| Factor | Value | Basis |
|---|---|---|
| Attack vector | Network (AV:N) | CVSS vector [1] |
| Attack complexity | High (AC:H) | CVSS vector [1] |
| Privileges required | None (PR:N) | CVSS vector [1] |
| User interaction | None (UI:N) | CVSS vector [1] |
| Scope | Unchanged (S:U) | CVSS vector [1] |
| Authentication to target | Not required by attacker beyond intercepting the controller's own SSH session | CVSS vector; description [1] |
| Required configuration | hostkey_auto_add enabled on ansible.netcommon libssh plugin, or AutoAddPolicy enabled in ansible-pylibssh | Description [1] |
| Attacker position | Must be able to intercept or redirect network traffic between the Ansible controller and the target host (MITM position) | Description [1] |
| Execution context | Interactive or otherwise non-fail-closed run; non-interactive runs are stated to fail closed | Description [1] |
| Excluded configuration | Default settings (host key checking enabled, hostkey_auto_add unset) are not affected | Description [1] |
The High attack complexity rating in the CVSS vector reflects the difficulty of achieving a MITM position against the specific controller-to-host path at the right time, inferred from the vector rather than elaborated upon narratively in the description [1].
Exploitation scenarios and attack lifecycle
Illustrative scenario, consistent with the documented mechanism but not a confirmed incident: An organization uses ansible.netcommon's libssh connection plugin to manage network devices and has hostkey_auto_add enabled to simplify onboarding of new devices. An attacker who gains a position on the management network segment — for example through ARP spoofing or a compromised intermediate switch — intercepts a connection attempt from the controller to a known device. The attacker presents its own SSH host key instead of the device's. Because the plugin's policy treats the changed-key condition the same as a first-time connection, the controller accepts the new key, authenticates using whatever credentials the play specifies, and executes the play's tasks against the attacker's host instead of the intended device [1]. The attacker can then observe authentication material used in the session and any command output or data the play transmits. The known_hosts file is updated with the attacker's key, so the substitution can persist across subsequent runs until an administrator notices or the attacker's network position is removed [1].
Defensive opportunities include: verifying the active connection plugin configuration before enabling hostkey_auto_add; monitoring for unexpected known_hosts modifications; restricting network paths between the controller and managed hosts to trusted segments; and using out-of-band key verification when onboarding devices rather than relying on TOFU alone. These measures are derived from the documented mechanism [1], not from vendor-issued guidance explicitly tied to this CVE, since no such guidance is present in the reviewed sources.
Impact analysis
| Dimension | Demonstrated impact | Plausible downstream consequence |
|---|---|---|
| Confidentiality | High (C:H) — connection credentials and session data reach the MITM attacker [1] | Exposure of any secrets, variables, or file contents transmitted during the hijacked play |
| Integrity | Low (I:L) — known_hosts is modified with an unauthorized key entry [1] | Possible drift between recorded and actual trusted host identities, complicating future detection |
| Availability | None (A:N) | Not established by the reviewed sources |
| Authentication/authorization | The controller authenticates to an attacker-controlled endpoint instead of the intended host [1] | Credential reuse elsewhere if the exposed credentials are shared across systems |
| Privilege boundaries | Not altered on the Ansible controller itself per the evidence | Not established by the reviewed sources |
| Data/privacy | Credentials used for the SSH session are disclosed to the interceptor [1] | Any data within play output or transferred files during the session |
| Business operations | Not established by the reviewed sources | Operational disruption if automation targets are silently diverted |
| Regulatory/contractual | Not established by the reviewed sources | Possible notification obligations if credential exposure affects regulated systems |
Affected products and versions
| Vendor/Project | Component | Affected versions | Platform | Fixed version | Source/confidence |
|---|---|---|---|---|---|
| ansible-pylibssh (upstream project) | Session.verify_known_host / AutoAddPolicy / RejectPolicy | Not specified as a version range in the reviewed sources | Any platform running ansible-pylibssh as an Ansible SSH connection backend | Not stated in the reviewed sources | NVD description [1], no version range given |
| ansible.netcommon | libssh connection plugin (MyAddPolicy, hostkey_auto_add) | Not specified as a version range in the reviewed sources | Ansible network automation deployments using the libssh plugin | Not stated in the reviewed sources | NVD description [1], no version range given |
The NVD record and Red Hat references do not supply a CPE configuration or explicit affected/fixed version table in the reviewed evidence; this is an evidence gap, not an assumption that all versions are affected equally.
Exploitation and threat intelligence status
Exploitation in the wild is not confirmed by the reviewed sources. CVE-2026-126641 does not appear in the CISA Known Exploited Vulnerabilities catalog as of the research cut-off date of 2026-11-12 [2]; CISA's catalog absence is explicitly noted as not being proof that exploitation has not occurred [2]. No proof-of-concept exploit code, threat actor attribution, campaign reporting, or sector targeting is present in the reviewed sources. The record status itself is "Awaiting Analysis," indicating NVD has not completed its own independent technical review at the time of this article [1].
Indicators of compromise
No file hashes, domains, IP addresses, URLs, process names, command lines, log event identifiers, or network signatures are provided in the reviewed sources. Organizations cannot rely on published indicators for this CVE; any detection must be based on behavioral and configuration review described in the following section. Indicators, if later published elsewhere, would need validation before use in blocking rules, since indicators associated with any vulnerability degrade in relevance over time.
Detection and exposure assessment
- Inventory all Ansible control nodes and identify which use ansible-pylibssh as a connection backend or the ansible.netcommon collection's libssh connection plugin. Confirm installed package presence with the Python/Ansible environment's own package manager, for example
pip show ansible-pylibsshoransible-galaxy collection list ansible.netcommon, run on the control node; expected output lists the installed version. This confirms presence of the component, not exploitability [1]. - Review Ansible inventory and playbook configuration (ansible.cfg, connection variables) for
host_key_auto_addsettings on the libssh connection plugin, and review any ansible-pylibssh integration code for explicit use ofAutoAddPolicyorRejectPolicy. Presence of these settings indicates the configuration precondition described in the record is met [1]. - Check whether
host_key_checkingis enabled globally; per the description, default configurations with host key checking enabled andhostkey_auto_addunset are not affected [1], so this check narrows exposure. - Inspect known_hosts files used by the controller for entries that have been modified recently without a corresponding, explained infrastructure change (e.g., planned host rebuild), as unexplained key churn is consistent with, though not proof of, the described failure mode.
- Review controller logs for connection attempts against hosts where a known_hosts entry previously existed, looking for the absence of any warning despite a key change — the absence of warning is itself the defect, so standard SSH client logs that would normally flag a changed key may not show the expected alert when this plugin/library combination is in auto-add mode.
Immediate mitigation
- Disable
host_key_auto_addon the ansible.netcommon libssh connection plugin wherever it is currently enabled, reverting to default host key checking behavior. This protects against silent acceptance of a changed key; side effect is that first-time connections to genuinely new hosts will require explicit key acceptance or pre-population of known_hosts. Verify by confirming the setting is absent or set to false in ansible.cfg or inventory variables [1]. - Replace
AutoAddPolicywith a verification-aware approach in any custom code calling ansible-pylibssh's Session directly, avoiding reliance on the flawed missing_host_key() dispatch for changed-key events. This is an inference from the documented mechanism [1] rather than vendor-issued guidance, since no patch identifier is present in the reviewed evidence. - Restrict network paths between Ansible controllers and managed hosts to trusted, monitored segments to reduce the feasibility of an attacker achieving the MITM position the CVSS vector's High attack complexity implies is required [1]. This is a general network-segmentation control, not specific guidance from the sources.
- Where feasible, run Ansible in non-interactive mode, which the description states fails closed rather than silently accepting a changed key [1]; confirm this behavior in a controlled test environment before relying on it operationally, since the reviewed sources do not provide a verification command.
- Increase scrutiny of known_hosts file modification timestamps on affected controllers as an interim monitoring measure, pending a vendor fix.
Permanent remediation
The reviewed sources do not provide a fixed version number, patch release, or vendor advisory confirming a shipped fix for ansible-pylibssh or ansible.netcommon addressing CVE-2026-126641; this is an evidence gap. The only remediation references available are the Red Hat CVE page and Red Hat Bugzilla entry 2571719, which are tracking references rather than confirmed patch identifiers in this evidence pack [1]. Organizations should monitor the Red Hat CVE page and Bugzilla 2571719 for an eventual fixed package version, and apply it through their standard ansible-pylibssh/ansible.netcommon update channel once published, since no exact version is confirmed here [1]. Until a vendor-confirmed patched release is identified, the controls in Immediate Mitigation should be treated as the operative risk-reduction measures rather than a permanent fix.
Workarounds and compensating controls
Disabling trust-on-first-use behavior (host_key_auto_add / AutoAddPolicy) and reverting to strict host key checking, as described above, is a supported configuration change rather than a patch, and is the primary available workaround given the absence of a confirmed fixed version [1]. Its residual risk is that strict checking will reject legitimate key rotations unless known_hosts is updated through an out-of-band, verified process, which can create operational friction and prompt administrators to re-enable auto-add under time pressure — reintroducing the exposure. A workaround of this kind does not address the underlying dispatch defect in verify_known_host(); it only prevents the vulnerable configuration state from being reached, so it must be revisited once a vendor fix is available [1].```(end of workaround note)
Validation and verification
- Confirm
host_key_auto_addis disabled (or absent) on all ansible.netcommon libssh connection plugin configurations by reviewing ansible.cfg and inventory variable files; record the file path and setting value reviewed. - Confirm no application code path still instantiates ansible-pylibssh's
AutoAddPolicyby searching the codebase for that class name and reviewing each usage. - Re-check
host_key_checkingis enabled in ansible.cfg across all controllers in scope. - Attempt a controlled, authorized test connection to a host with a deliberately altered (test) known_hosts entry in a non-production environment to confirm the controller now rejects or flags the mismatch rather than silently connecting, rather than inferring behavior from configuration alone.
- Review known_hosts files for unexpected entries added during the exposure window identified in step 4 of Detection and Exposure Assessment, and reconcile each against a verified source of truth for host keys.
- Record the owner, date, systems checked, and any exceptions (e.g., systems still requiring auto-add for legitimate onboarding workflows) in change-management documentation.
- Re-run the package/collection version check from Detection and Exposure Assessment once a vendor-confirmed fixed version is published and applied, to confirm the update took effect.
Incident response
If a controller's known_hosts file is found to contain an unexplained changed entry for a managed host, treat it as a possible indicator of MITM interception consistent with this CVE's documented mechanism [1]. Scope the investigation to identify every play executed against that host entry since the key change, and preserve the current known_hosts file and relevant controller logs before making changes. Rotate any credentials used in plays executed against the suspect host entry, since the description states connection credentials can be disclosed to the interceptor [1]. Identify the network path used at the time of the suspected change and determine whether an intermediate device or segment could have enabled interception. After containment, remove the untrusted key entry, re-establish the correct host key through an out-of-band verified channel, and re-enable strict host key checking per the Immediate Mitigation section. Document findings and timeline for lessons-learned review, and evaluate whether regulatory or contractual notification applies based on the specific credentials and data exposed, which is organization-specific and not determined by the reviewed sources.
Security hardening and prevention
As defence-in-depth, beyond this specific CVE: maintain known_hosts entries through a verified, centrally managed process rather than relying on TOFU for any automation targeting sensitive infrastructure; segment management networks so that Ansible controllers reach managed hosts only through controlled, monitored paths; include SSH connection plugin configuration review (host_key_checking, host_key_auto_add) in periodic Ansible configuration audits; and track ansible-pylibssh and ansible.netcommon releases through the organization's patch management process so fixes for CVE-2026-126641 are applied promptly once published. These are general practices consistent with the vulnerability's nature, not vendor-mandated steps documented in the reviewed sources.
Risk assessment
Technical severity is Medium per the single available CVSS 3.1 score of 6.5 [1]. Exploit prerequisites are non-trivial: the attacker needs a network MITM position against the specific controller-to-host path, reflected in the High attack complexity rating [1], and the vulnerable configuration (TOFU auto-add enabled) must be present, which is not the default [1]. No evidence of in-the-wild exploitation or KEV listing exists as of the research cut-off [2], though absence of evidence is not evidence of absence. Potential business impact centers on credential and session data disclosure in environments that rely on auto-add host key policies for network device or dynamic infrastructure onboarding, a pattern common in network automation use cases for ansible.netcommon specifically. Organizations using default host key checking settings face materially lower risk than those that have enabled hostkey_auto_add or AutoAddPolicy for operational convenience. Recommended remediation priority: Medium-High for organizations confirmed to have the TOFU auto-add configuration enabled on controllers reaching sensitive or externally reachable network segments; Low for organizations confirmed to be running default host key checking with auto-add unset. This prioritization is an analyst assessment based on the documented configuration precondition [1] and is not a substitute for the CVSS score itself.
Conclusion
The core flaw is a dispatch error in ansible-pylibssh's host key verification logic that routes both "key changed" and "unknown host" conditions through the same auto-accept policy hook, which ansible.netcommon's libssh connection plugin inherits through its MyAddPolicy implementation [1]. Teams operating Ansible controllers that use ansible-pylibssh or the ansible.netcommon libssh plugin with hostkey_auto_add or AutoAddPolicy enabled should act first by disabling that auto-add behavior and reverting to strict host key checking. A vendor-confirmed permanent fix and fixed version number are not established in the reviewed sources; closing this issue requires monitoring the Red Hat CVE page and Bugzilla 2571719 for a published patch, after which affected organizations should update and re-validate configuration per the checklist above [1].
Remediation checklist
- Immediately audit all Ansible control nodes for ansible-pylibssh and ansible.netcommon libssh connection plugin usage with hostkey_auto_add or AutoAddPolicy enabled; verify via ansible.cfg, inventory variables, and application code review [1].
- Disable hostkey_auto_add on the ansible.netcommon libssh connection plugin and remove AutoAddPolicy usage in ansible-pylibssh integrations, reverting to strict host key checking; verify by confirming the setting's absence or false value [1].
- Confirm host_key_checking is enabled in ansible.cfg on all controllers; this is the documented default-safe condition [1].
- Restrict and monitor network paths between Ansible controllers and managed hosts to reduce feasibility of a machine-in-the-middle position, given the High attack complexity requirement in the CVSS vector [1].
- Review known_hosts files on affected controllers for unexplained recent key changes and reconcile each entry against a verified source of truth.
- Monitor the Red Hat CVE page and Bugzilla 2571719 for a published fixed version of ansible-pylibssh or ansible.netcommon, since no fixed version is given in the reviewed sources [1].
- Once a fix is published, apply it through the standard package/collection update channel and re-verify installed versions with pip show ansible-pylibssh or ansible-galaxy collection list ansible.netcommon.
- Rotate credentials used on any host where a known_hosts key change cannot be explained by a legitimate infrastructure event, per incident response guidance [1].
Evidence gaps
- No fixed/patched version number is given for ansible-pylibssh or ansible.netcommon in the reviewed sources; this would be settled by a vendor advisory or release note specifying the patched release [1].
- No complete affected version range (earliest affected version) is published in the reviewed sources; settled by a CPE configuration or vendor advisory listing specific version boundaries.
- No confirmation of in-the-wild exploitation, threat actor activity, or public proof-of-concept exists in the reviewed sources; settled by future KEV listing, incident reporting, or researcher publication.
- No indicators of compromise (hashes, IPs, domains, log signatures) are provided; settled if a vendor or researcher publishes detection signatures tied to this CVE.
- The reasoning behind the original design choice to route changed/other key states through the same policy hook as unknown hosts is not explained; settled by a maintainer statement or code history review beyond this evidence pack.
References
- CVE-2026-126641 record. NIST National Vulnerability Database (NVD), 2026-11-12. https://nvd.nist.gov/vuln/detail/CVE-2026-126641. Accessed 2026-11-12.
- Known Exploited Vulnerabilities Catalog. Cybersecurity and Infrastructure Security Agency (CISA), 2026-11-12. https://www.cisa.gov/known-exploited-vulnerabilities-catalog. Accessed 2026-11-12.
Summary
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.
Severity breakdown
Medium · 6.5
An attacker without an account can exploit this over the network, without any user action, but only under specific conditions.
- Attack from
- the network (remotely)
- Attack complexity
- high (only works under specific conditions)
- Login needed
- no
- User action needed
- no
- Scope
- stays within the vulnerable component
- Impact
- high on confidentiality, low on integrity, none on availability
Weakness
- CWE-322: Key Exchange without Entity Authentication
References by type
Other references
Affected
- Red Hat Ansible Automation Platform 2
Frequently asked questions
What is CVE-2026-126641?
CVE-2026-126641 is a host key verification weakness affecting ansible-pylibssh and the libssh connection plugin within ansible.netcommon. When trust-on-first-use behavior is turned on via hostkeyautoadd on the libssh plugin, or AutoAddPolicy in ansible-pylibssh, a remote host whose SSH key no longer matches the entry stored in knownhosts is accepted without any alert rather than being rejected. Weakness type: Key Exchange without Entity Authentication (CWE-322).
How severe is CVE-2026-126641?
CVE-2026-126641 has a CVSS 3.1 base score of 6.5 (medium), from the CNA (redhat.com). An attacker without an account can exploit this over the network, without any user action, but only under specific conditions.
Is CVE-2026-126641 being exploited?
Not as far as is known: CVE-2026-126641 is not in CISA's Known Exploited Vulnerabilities catalog as of November 26, 2026. EPSS estimates a 0.4% chance that it is exploited in the next 30 days.
How do I fix CVE-2026-126641?
Immediately audit all Ansible control nodes for ansible-pylibssh and ansible.netcommon libssh connection plugin usage with hostkeyautoadd or AutoAddPolicy enabled; verify via ansible.cfg, inventory variables, and application code review. Disable hostkeyautoadd on the ansible.netcommon libssh connection plugin and remove AutoAddPolicy usage in ansible-pylibssh integrations, reverting to strict host key checking; verify by confirming the setting's absence or false value. Confirm hostkeychecking is enabled in ansible.cfg on all controllers; this is the documented default-safe condition.
Timeline & sources
- NVD: CVE-2026-126641 — Red Hat Ansible Automation Platform 2
- oss-security: CVE-2026-126641: ansible-pylibssh / ansible.netcommon libssh: changed SSH host key accepted when...
References
Related vulnerabilities & news
- Ubuntu USN-9214-1 patches multiple GNU binutils flaws, mostly local denial-of-service bugs
- Ubuntu ships linux-hwe-7.0 kernel update for several unnamed Linux kernel flaws
- Ubuntu Security Notice USN-9208-1 Fixes Multiple alsa-lib Flaws on 22.04, 24.04 and 26.04 LTS
- CERT-In Rates Multiple Cisco ClamAV Flaws High; Affected Secure Endpoint Connector Versions Listed
- SolarWinds Patches 18 Serv-U Flaws, Including Root-Access Bugs on Linux