Jump to content

Recommended Posts

I have the below basic PHP login script which I am using on my main website for the customers to log in ..Please let me know the potential threats in this script and any kind of loophole,which you feel ..any kind of suggestion will be highly appreciable ..

Here is the script --

http://pastebin.com/TtbBmKvJ

Link to comment
https://forums.phpfreaks.com/topic/269959-secure-login-script/
Share on other sites

Besides minor things like not checking that the individual fields were submitted (I mean submitted, not filled in) and doing a SELECT * when all you need is their ID, name, and password,

 

You're giving a different error message for bad emails and bad passwords. That reveals to a malicious user that an account exists and lets them focus their efforts on finding a password. You should use the same "bad email and/or password" message in both cases.

Link to comment
https://forums.phpfreaks.com/topic/269959-secure-login-script/#findComment-1388054
Share on other sites

@requinix ..

Now I am displaying same error message ""bad email and/or password" message in both cases , but i wanted to check if my script is vulnerable for sql injection or not as I have read somewhere that I should not allow negative numbers to enter.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/269959-secure-login-script/#findComment-1388603
Share on other sites

Now I am displaying same error message ""bad email and/or password" message in both cases , but i wanted to check if my script is vulnerable for sql injection or not as I have read somewhere that I should not allow negative numbers to enter.

 

1. If you are going to use the same error message (which I absolutely agree with) you can greatly simplify the script. Instead of searching for a match on email and then extracting the password to compare, just do a query to find a match on email and the hashed password. That will cut out a lot of logic in your script. However, if you wanted to implement a locking feature (say for entering the wrong password three times in a row) then you would want to do a check only on the username (email address).

 

2. I don't see any problem in using a negative number for either the email or password. In fact, I can't think of any scenario where using a negative number as a search value in a query would be a security concern.

Link to comment
https://forums.phpfreaks.com/topic/269959-secure-login-script/#findComment-1388738
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.