lib/pam_pass_non_interactive.c, src/{chfn,chsh,newgrp,passwd}.c: Don't log user-provided strings#1627
Open
alejandro-colomar wants to merge 1 commit into
Open
Conversation
…t log user-provided strings A few years ago, we started validating these strings as user or group names, which made them safe to log. However, these strings may be more than just a simple local user or group name. They may be fully qualified names, which don't pass the validation. This patch reverts the old one, and so we don't validate the strings anymore. Instead, let's not trust those strings, and thus don't log them. In some cases, we can log the UID or GID, which could be similarly useful. In others, we don't have that information, so just remove the string; that's less informative, but it's as much as we can do safely. Fixes: 326889c (2024-10-22; "Fix coverity unbound buffer issues") Closes: <shadow-maint#1626> Reported-by: Noor Eldeen Mansour <nooreldeen.mansour@canonical.com> Cc: Marcin Nowakowski <marcin.w.nowakowski@gmail.com> Cc: Iker Pedrosa <ipedrosa@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
| "Failed to crypt password with previous salt of group '%s'", | ||
| groupname); | ||
| "Failed to crypt password with previous salt of group %ju", | ||
| (uintmax_t) grp->gr_gid); |
Collaborator
Author
There was a problem hiding this comment.
/etc/group (which is what getgrnam(3) reads) is world-readable. How is this supposed to be sensitive?
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.
A few years ago, we started validating these strings as user or group names, which made them safe to log. However, these strings may be more than just a simple local user or group name. They may be fully qualified names, which don't pass the validation.
This patch reverts the old one, and so we don't validate the strings anymore. Instead, let's not trust those strings, and thus don't log them. In some cases, we can log the UID or GID, which could be similarly useful. In others, we don't have that information, so just remove the string; that's less informative, but it's as much as we can do safely.
Fixes: 326889c (2024-10-22; "Fix coverity unbound buffer issues")
Closes: #1626
Reported-by: @nooreldeenmansour
Cc: @MarcinDigitic
Cc: @ikerexxe
Please be very skeptic when reviewing this patch. I'm less comfortable than usually. I believe the changes from username/groupname to uid/gid are good, but please revise. Also, I've removed much information, especially from the audit log. Please check that this is okay.
The regression affects all versions since (and including) 4.17.0.