Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Re: Login security bug?

Quote Reply
Re: Login security bug? In reply to
Nevermind.....I think I've got it fixed. Here's the solution if anyone else still has this problem:

Find this section in auth.pl (sub auth_check_password), and add the items in red

In Reply To:
# User is trying to login, check username/password and return info.
elsif ($in{'login'}) {
my $userid_q = $DBH->quote($in{'userid'});
$query = qq!
SELECT password, per_view, per_add, per_del, per_mod, per_admin FROM $db_table_user
WHERE username = $userid_q
!;
$sth = $DBH->prepare ($query) or &cgierr("Unable to query database. Reason: " . $DBH->errstr . ". Query: $query");
$sth->execute or &cgierr("Unable to query database. Reason: " . $sth->errstr . ". Query: $query");

if ($sth->rows) {

($orig_password, @perms) = $sth->fetchrow_array;
$orig_password =~ s/^\s*(\S*)\s*$/$1/;
$crypt_pass = crypt ($in{'pw'}, $orig_password);

# Create session id and insert it into session table.
if ($orig_password eq $crypt_pass) {
srand;
my $rand = int(rand(100000));
$session_id = "$in{'userid'}.$rand";
my $session_id_q = $DBH->quote ($session_id);

my $time = time();
$query = qq!
INSERT INTO $db_table_session (session_id, create_time)
VALUES ($session_id_q, $time)
!;
$DBH->do($query) or &cgierr("Unable to insert session id. Reason: " . $DBH->errstr . ". Query: $query");
}

}
else {
return "invalid username/password";
}

Melanie
http://www.somemoorecats.com/
http://www.okhima.org/
Subject Author Views Date
Thread Login security bug? cnuser 3628 May 29, 2000, 6:15 AM
Post Re: Login security bug?
Stealth 3507 May 29, 2000, 5:56 PM
Thread Re: Login security bug?
Alex 3496 Jun 2, 2000, 5:26 PM
Thread Re: Login security bug?
cnuser 3487 Jun 2, 2000, 8:20 PM
Thread Re: Login security bug?
ogrady 3455 Jun 28, 2000, 2:58 PM
Thread Re: Login security bug?
msmoore 3396 Jan 7, 2001, 8:51 AM
Post Re: Login security bug?
msmoore 3383 Jan 7, 2001, 9:35 AM