Cockpit followed a home-directory symlink in a privileged key helper
Server administration consoles often perform one privileged action on behalf of a logged-in user. Cockpit's public-key addition workflow is a small example: the user supplies a key and the server places it in the target account's authorized-keys path. The helper runs with elevated authority, so every path it follows matters.
CVE-2026-91151 describes an insecure symlink-handling flaw in ssh-add-public-key.sh. A local authenticated user who controls a target account's home directory can place a symlink in the path used by the helper. When a privileged Cockpit session adds a public key, the helper follows the link and performs privileged filesystem operations on an unintended file.
The Red Hat record describes the outcome as the ability to change file ownership and modes, potentially leading to local privilege escalation. The affected products listed in public CVE metadata include multiple Red Hat Enterprise Linux generations and Red Hat OpenShift Dev Spaces images.
The helper trusted a writable path
The vulnerable sequence is not a remote command injection. It is a privileged file operation performed through a path that a different local identity can influence. The attacker needs local authentication and control over the home directory, but the effect crosses into the privileged Cockpit context.
This kind of flaw is easy to miss in a web-console review because the browser action looks like a normal administrative feature. The dangerous code is in the helper that runs outside the browser, where path ownership and symlink resolution determine whether the operation stays inside the intended account directory.
Where the conditions can exist
Consider hosts where administrators manage other users, shared service accounts, or home directories on shared storage. A department administrator with a Cockpit session may not be the owner of every target home directory. A user with write access to that directory can prepare the link before the administrator adds a key.
Containers and development environments need separate review. OpenShift Dev Spaces images contain the affected package according to public CVE metadata, even if the runtime does not expose the same management workflow. Inventory the image as part of patch planning and verify whether the helper is reachable in the deployed service.
Patch and harden the path operation
Apply the Cockpit package update from each distribution. The fixed commit in the advisory references changes to the helper's path handling. Confirm the installed package version on the host and inside long-lived images, then restart the affected service according to the vendor instructions.
Until the update is deployed, restrict the public-key workflow to administrators who are trusted to manage the target home directory. Do not allow untrusted local users to write the home of an account that a privileged Cockpit user will modify. Use a dedicated administration account and avoid shared home directories for role-bound service accounts.
Review other helper scripts that accept a username and construct a path under /home. Validate the resolved path with a file-descriptor-based operation, refuse symlinks in privileged writes, and perform the final open as the intended account rather than as root. A string comparison of the path before the open is not enough if a link can change after the check.
Verify the fix with a controlled test
Create a test home directory owned by an unprivileged user, place a symlink where the helper expects the authorized-keys file, and run the workflow through the patched Cockpit version. The helper should reject the link or write only to a verified target. Check both the file contents and the ownership and mode changes.
Inspect audit logs for ssh-add-public-key.sh executions, target usernames, and file changes outside the expected home directory. Correlate them with Cockpit login sessions and local account changes. If an affected host accepted an untrusted home-directory link, review ownership and modes of sensitive files and rebuild if the privileged operation cannot be bounded.
The patch is important, but the durable control is to treat user-controlled paths as hostile input even when the caller is already authenticated. A console's privilege should not flow through a directory another user can rewrite.