Bug 87982 - passwd segfaults when line lacks one or more colons
Summary: passwd segfaults when line lacks one or more colons
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: passwd
Version: 8.0
Hardware: i686
OS: Linux
Target Milestone: ---
Assignee: Tomas Mraz
QA Contact: Mike McLean
Depends On:
TreeView+ depends on / blocked
Reported: 2003-04-04 09:46 UTC by Lorens Kockum
Modified: 2007-04-18 16:52 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2005-03-25 11:54:33 UTC

Attachments (Terms of Use)

Description Lorens Kockum 2003-04-04 09:46:35 UTC
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):

How reproducible:

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.
Segmentation fault

Expected Results:  passwd should have output an error. I see no appropriate
error messages in the binary.

Additional info:

The affected user cannot login, at least not using vsFTPd. No special error
message in the logs.

Comment 1 Tomas Mraz 2005-03-25 11:54:33 UTC
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,
please reopen.

Comment 2 Lorens Kockum 2005-03-25 14:43:12 UTC
I confirm that I cannot reproduce on FC3.

Note You need to log in before you can comment on or make changes to this bug.