Description
A flaw was found in the ansible-core user module. When generate_ssh_key is enabled, User.ssh_key_gen() guards the key files against symlinks but checks the ~/.ssh directory only with os.path.exists(). An unprivileged user on a managed node who replaces their ~/.ssh with a symlink to an existing root-writable directory causes the privileged module to write the generated key pair through the symlink and then chown both files to that user. Because such files can be dropped into directories processed by schedulers (e.g. /etc/cron.daily) or dynamic MOTD (/etc/update-motd.d), the user can escalate to root on the managed node. This is an incomplete fix of CVE-2024-9902.
Published: 2026-11-06
Score: 6.7 Medium
EPSS: < 1% Very Low
KEV: No
Impact: Local Privilege Escalation
Action: Patch Immediately
AI Analysis

Impact

A flaw in the Ansible Core user module allows an unprivileged user to replace their ~/.ssh directory with a symlink to a root‑writable location. When the generate_ssh_key action is enabled, the module writes the newly created SSH key pair through that symlink and then changes the ownership of the files to the user. Because the symlink points to a world‑writable system directory, the key files can end up in directories processed by root‑owned automation services such as cron or dynamic MOTD scripts. Executing code from these files grants the attacker root privileges on the managed node. This is a symlink or relative path traversal vulnerability (CWE-59).

Affected Systems

CVE-2026-123037 impacts systems running Ansible Core on nodes where the user module generate_ssh_key is enabled. The flaw affects any user running unprivileged Ansible tasks that invoke this module on a managed host. No specific hardware or operating system versions are listed, so all current Ansible Core installations with the module are potentially vulnerable.

Risk and Exploitability

The CVSS score of 6.7 indicates a moderate severity, reflecting that the vulnerability requires local execution of the Ansible module but does not involve network interaction. The EPSS score is not available, and the flaw is not listed in the CISA KEV catalog. Nevertheless, the exploitation method is straightforward: an attacker who can run arbitrary Ansible code on the node can create the symlink and trigger the local key generation, leading to privilege escalation at the node level.

Generated by OpenCVE AI on November 5, 2026 at 15:05 UTC.

Remediation

Vendor Workaround

Do not use generate_ssh_key: yes against accounts whose home directory is controlled by an untrusted user; pre-create ~/.ssh as a real directory owned appropriately before running the module, or generate the key as the target account itself (dropping to its uid/gid) rather than as root.


OpenCVE Recommended Actions

  • Update Ansible Core to a version that resolves the symlink check in generate_ssh_key.
  • Verify that the user’s home directory is protected (chmod 700 ~/.ssh) and remove any malicious symlinks pointing to system directories.
  • Limit the use of the generate_ssh_key module to privileged users or groups, and audit remaining cron and update‑motd directories for unexpected files.

Generated by OpenCVE AI on November 5, 2026 at 15:05 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Fri, 06 Nov 2026 05:45:00 +0000

Type Values Removed Values Added
Title ansible-core: user module generate_ssh_key follows a symlinked ~/.ssh enabling local privilege escalation (incomplete fix of CVE-2024-9902) Ansible-core: user module generate_ssh_key follows a symlinked ~/.ssh enabling local privilege escalation (incomplete fix of cve-2024-9902)
First Time appeared Redhat
Redhat ansible Automation Platform
Redhat ansible Core
Redhat ansible Portal
CPEs cpe:/a:redhat:ansible_automation_platform:2
cpe:/a:redhat:ansible_core:2
cpe:/a:redhat:ansible_portal:2
Vendors & Products Redhat
Redhat ansible Automation Platform
Redhat ansible Core
Redhat ansible Portal
References

Thu, 05 Nov 2026 13:45:00 +0000

Type Values Removed Values Added
Description A flaw was found in the ansible-core user module. When generate_ssh_key is enabled, User.ssh_key_gen() guards the key files against symlinks but checks the ~/.ssh directory only with os.path.exists(). An unprivileged user on a managed node who replaces their ~/.ssh with a symlink to an existing root-writable directory causes the privileged module to write the generated key pair through the symlink and then chown both files to that user. Because such files can be dropped into directories processed by schedulers (e.g. /etc/cron.daily) or dynamic MOTD (/etc/update-motd.d), the user can escalate to root on the managed node. This is an incomplete fix of CVE-2024-9902.
Title ansible-core: user module generate_ssh_key follows a symlinked ~/.ssh enabling local privilege escalation (incomplete fix of CVE-2024-9902)
Weaknesses CWE-59
References
Metrics threat_severity

None

cvssV3_1

{'score': 6.7, 'vector': 'CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H'}

threat_severity

Moderate


Subscriptions

Redhat Ansible Automation Platform Ansible Core Ansible Portal
cve-icon MITRE

Status: PUBLISHED

Assigner: redhat

Published:

Updated: 2026-11-06T17:36:44.917Z

Reserved: 2026-11-05T07:01:01.186Z

Link: CVE-2026-123037

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Awaiting Analysis

Published: 2026-11-06T06:16:42.243

Modified: 2026-11-06T06:16:42.380

Link: CVE-2026-123037

cve-icon Redhat

Severity : Moderate

Publid Date: 2026-11-05T09:30:21Z

Links: CVE-2026-123037 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-11-05T15:15:19Z

Weaknesses
  • CWE-59

    Improper Link Resolution Before File Access ('Link Following')