Repository navigation
Conversation
sudo_logsrvd shares one filter handle between all connections, so a password prompt seen in one session could be cancelled or used up by I/O from another and the password logged in the clear. Move the is_filtered flag out of the handle and into the caller.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
sudo_logsrvd runs every client's I/O buffers through the one filter handle returned by logsrvd_conf_iolog_passprompt_regex, and iolog_pwfilt_run kept its is_filtered flag inside that handle, so all connections shared a single filter state. When one session prints a password prompt and another session sends terminal output before the password arrives, the flag is cleared and the password lands in ttyin in the clear; if the other session sends input first, that input is starred out instead and the password still gets through. This is the default configuration (log_passwords = false) and only needs two sessions that overlap.
Take the flag out of the handle and have iolog_pwfilt_run use a bool supplied by the caller: sudo_logsrvd keeps it in the connection closure, and the sudoers I/O plugin, which only ever has one session, keeps a static. The handle is then just the compiled patterns, so sharing it between connections is fine, and behaviour for a single session is unchanged. check_iolog_filter gains a case that interleaves two sessions over one handle.