Bug 95 - sudo leaves PAM password echo on for much too long
sudo leaves PAM password echo on for much too long
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Sudo
1.6.6
All All
: high security
Assigned To: Todd C. Miller
http://people.FreeBSD.org/~roam/auth_...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2002-12-13 08:23 MST by Peter Pentchev
Modified: 2002-12-13 13:34 MST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Pentchev 2002-12-13 08:23:46 MST
Some PAM modules allow authentication using passwords or passphrases that
are displayed as they are entered; prime examples are the S/Key and OPIE
authentication modules.  Sudo's PAM convesation function sets a global flag
for leaving echo on, and then never resets it, so after a PAM module requests
a password with echo on, and for some reason the authentication fails or is
insufficient, all subsequent passwords and passphrases will be echoed back,
which is undesirable in cases like pam_unix, pam_krb5, or actually almost all
other PAM modules.

This can be easily demonstrated using a PAM configuration similar to
the following:

[roam@straylight:p2 ~]$ fgrep sudo /etc/pam.conf
sudo    auth    sufficient      pam_opie.so                     no_fake_prompts
sudo    auth    sufficient      pam_krb5.so
sudo    auth    required        pam_unix.so                     try_first_pass
[roam@straylight:p2 ~]$

At a sudo attempt, the OPIE module will ask for a password.  Pressing Enter
at this point leads to a new OPIE password prompt with echo turned on.
Entering an invalid OPIE passphrase will fall through to the Kerberos and
possibly the Unix authentication, but echoing will still be on, so the Kerberos
and/or Unix passwords will be visible to any bystanders.

A trivial patch at http://people.FreeBSD.org/~roam/auth_pam.c.patch attempts
to address this problem in a somewhat simplistic way - turning off the global
flag after each prompt.  A "real" solution might require reworking the switch
statement a few lines above that.
Comment 1 Todd C. Miller 2002-12-13 09:34:53 MST
Thanks, a similar fix will show up in sudo 1.6.7.