Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

secure log in

Status
Not open for further replies.

lizzi

Technical User
Feb 12, 2004
45
0
0
SE
Hi
Is this a secure way to check a user log in?

SQL = "SELECT * FROM [users] WHERE [user] = '" & trimVars("user") & "' AND [view] = TRUE;"
set mySQL = Conn.Execute(SQL)
on error resume next

IF mySQL("password") = trimVars("password") THEN
session("ID") = mySQL("ID")
session("userID") = mySQL("ID")
session("name") = mySQL("firstname") & " " & mySQL("lastname")
session("email") = mySQL("email")

...

END IF

Thanks
Lizzi
 
You don't show what the trimVars() function does, so it's hard to say. You're potentially still vulnerable to SQL injection if trimVars doesn't do some form of replacing single quotes with two single quotes, though the database would simply return all of the users in the table and your comparison would be with which ever one the database returned first, so they'd need to have guessed that password.

You're potentially open to some ASP injection in the password comparison, but I don't know much about ASP injection so I can't say.

What does trimVars() do?
 
As long as your getting rid of the aprostrophie (i.e. ' ) then it should be okay.

It looks secure to me, this is the kinf of code I would use but i would be intrested to see if anyone says anything else.

Matthew Wilde
matthew@ukwebsite.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top