Red Hat Bugzilla – Bug 87982
passwd segfaults when line lacks one or more colons
Last modified: 2007-04-18 12:52:45 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020623
Description of problem:
passwd chokes and segfaults on a user where a field is lacking in /etc/passwd.
I discovered this through a long and complicated process involving sed, regexps,
ftp logins, and renamed homedirs, but I've reproduced it very simply as in
"Steps to reproduce".
Additionally I would have thought vipw would have caught that, but that was an
impression I retained from OpenBSD where vipw does a consistency check on the
file before install.
I don't see how this could be a security problem (adding a colon too many does
not seem to have any ill effects, except the ones expected from field
displacement, otherwise one could have looked around a bit) but I don't like the
very idea of /usr/bin/passwd segfaulting.
Not reproducible on Debian 3.0.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
Edit /etc/passwd (I used vipw).
Remove one of the two colons around an empty real name field of a valid existing
user, so one colon and one field less in the file.
Exit vipw, not modifying shadow.
Execute `passwd user` in order to set a password, where user is the one that has
one colon less (other users are unaffected).
Actual Results: # passwd squid
Changing password for user squid.
Expected Results: passwd should have output an error. I see no appropriate
error messages in the binary.
The affected user cannot login, at least not using vsFTPd. No special error
message in the logs.
Can't reproduce on FC3 - passwd now reports Authentication token manipulation error
If you still can reproduce the segfault on a current Fedora/RHEL distribution,
I confirm that I cannot reproduce on FC3.