Jump to content

Recommended Posts

I have this little script that another web designer set up and I am looking over it on a friend of mine's web site.  From what little I know about hacking (none, to be honest), I am pretty sure this is an insecure way of logging in. What I would like to know is how insecure and easy it is to crack.

 

login.php:

if(isset($_POST['Submit'])){	

$username = "admin"; //Set username here
$password = "admin"; // Set Password here

$username1 = $_POST['username'];
$password1= $_POST['password'];

if($username==$username1 && $password==$password1){

session_start();

session_register('loggedin');

header( "Location: admin.php" );
}else{
echo "<p align='center'><font color='red'>Wrong Username/Password !!</font></p>";
}
}
?>

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/122817-insecure-login/
Share on other sites

impossible to crack

 

agreed, but...

 

The ability to break this is the same as if they could read the file's content unreadered by getting into you FTP account for example.

 

the but,

 

If registered globals is enabled on your server I could set

$username to be "" via GET and crack it.  

 

So be observant of that

 

 

What method do u suggest a person could use to hack it?

Link to comment
https://forums.phpfreaks.com/topic/122817-insecure-login/#findComment-634248
Share on other sites

It's impossible to crack since you hard coded the username and pass into the script. On the other hand it's a very impractical script. Very static, you can't add new admins through a sort of admin pannel, no dynamic pass change etc. Security wise it's great though.

Link to comment
https://forums.phpfreaks.com/topic/122817-insecure-login/#findComment-634545
Share on other sites

Brute force can be ruled out for the most part... in the most ideal situations over WAN HTTP you're only gonna get in 25-50 requests a second. Assuming only alphanumeric values are allowed, on an 8 character password you have ( 26 + 26 + 10 ) ^ 8. Over 200 Trillion combinations.

 

I'd say the most likely way this script is going to be compromised is if the PHP rendering engine fails and displays the source - This can be avoided by simply defining $username and $password in a PHP file below your web root and including it. Either that or you have a weak password and someone manages to dictionary attack.

 

In summary, it's a very basic and simple system and because of that it does it very well, with little room for holes. An attacker is more than likely going to find a weakness elsewhere.

Link to comment
https://forums.phpfreaks.com/topic/122817-insecure-login/#findComment-634600
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.