-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pam-ssh-add: Fix insecure killing of session ssh-agent [CVE-2024-6126]
Some distributions like Debian 12, or possibly some administrators enable pam_env's deprecated `user_readenv` option [1]. The user session can change the `$SSH_AGENT_PID`, so that it can pass an arbitrary pid to `pam_sm_close_session()`. This is a local authenticated DoS. Avoid this by storing the agent pid in a global variable. The cockpit-session process stays around for the entire session time, so we don't need to put the pid into the PAM data. It can also happen that the user session's ssh-agent gets killed, and some other process later on recycles the PID. Temporarily drop privileges to the target user so that we at least don't kill anyone else's process. Add an integration test which checks that changing the env variable works, pointing it to a different process doesn't kill that, and ssh-agent (the original pid) is still cleaned up correctly. However, as pam_so.env in Fedora crashes hard, skip the test there. Many thanks to Paolo Perego <[email protected]> for discovering, and Luna Dragon <[email protected]> for reporting this issue! [1] https://man7.org/linux/man-pages/man8/pam_env.8.html CVE-2024-6126 https://bugzilla.redhat.com/show_bug.cgi?id=2290859
- Loading branch information
1 parent
c4fa007
commit 0896536
Showing
2 changed files
with
70 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters