in reply to Accessing Authenticated User's Password From CGI

> The problem being, there is no $ENV{'PASSWORD'}

Think about that for a minute. If there were, how secure would your network be? Not very.
  • Comment on Re: Accessing Authenticated User's Password From CGI

Replies are listed 'Best First'.
Re: Re: Accessing Authenticated User's Password From CGI
by grantm (Parson) on Feb 11, 2003 at 00:07 UTC

    Unbelievable as it may seem, IIS3.0 on Windows NT4.0 actually does provide the password in $ENV{REMOTE_PASSWORD}. I assume this design decision was in some way related to the fact that in IIS, the username/password supplied via basic authentication must be a valid OS signon and getting an NT security token generally requires a plaintext password. I'm not sure if this 'feature' has been removed in more recent versions of IIS.

Re: Re: Accessing Authenticated User's Password From CGI
by enoch (Chaplain) on Feb 10, 2003 at 23:17 UTC
    I was thinking something more like a variable accessible just from Perl. Something no different than using a PerlAccessHandler with mod_perl a la:
    sub authen_handler { my $r = shift; # get user's authentication credentials my ($res, $password) = $r->get_basic_auth_pw; return $res if $res != OK; my $user = $r->connection->user; # authenticate through DBI my $reason = authen_dbi($r, $user, $sent_pw); if ($reason) { $r->note_basic_auth_failure; $r->log_reason($reason, $r->uri); return AUTH_REQUIRED; } return OK; }
    I am not sure I understand how setting an environment variable would make a network insecure even if the variable is a user's password. If the password is sent over SSL and only accessible from the Perl CGI that accessed it, what insecurities would result?

    enoch
      If I have made any mistakes or erroneous assumptions here please tell me! :)

      To be fair the context of your intitial request hinted more at your wanting to look at the network credentials of the authenticated user. At least thats how I saw that.

      However, regardless of first impression, you should look at this from a different angle. Consider yourself as the user of your application/network.

      You want the confidence that once authenticated, your password is not used or transmitted again unless specifically actioned by yourself. Your password is direct access to your identity so you want the finest control over it you can have.

      The environment you refer to comes from the server. The server doesn't magic this up but receives these variables from the context of where and how it is running. For it to create the password environement variable for your program it must have first received that information in some form.

      Now this would have to come with every single request from the client regardless of whether you are using mod perl or not. That would mean that the clients password would be transmitted over the network each time it did something.

      Now you should clearly see why that is dangerous.

      If you are wanting to stick with network security as your methodology (which is what you originally implied) then you have to trust to the security of that network.

      However, you have a separate context of the user implicity providing their authentication details. In that instance then you have already been given the advice you need on how to implement this. You must bear in mind, though, that this will ultimately be a different set of data to that of the network authentication data (though some users will be naughty and use the same usernames/passwords).

      HTH

      SP