Very secure website

source code were provided

<?php
    if (isset($_GET['username']) and isset($_GET['password'])) {
        if (hash("tiger128,4", $_GET['username']) != "51c3f5f5d8a8830bc5d8b7ebcb5717df") {
            echo "Invalid username";
        }
        else if (hash("tiger128,4", $_GET['password']) == "0e132798983807237937411964085731") {
            $flag = fopen("flag.txt", "r") or die("Cannot open file");
            echo fread($flag, filesize("flag.txt"));
            fclose($flag);
        }
        else {
            echo "Try harder";
        }
    }
    else {
        echo "Invalid parameters";
    }
?>

I can tell this is testing us on the PHP Loose Comparison

PHP String comparison vulnerabilities

Essentially, in this case. the password is being compared to 0e132798983807237937411964085731, in the BEST PROGRAMMING LANGUAGE PHP, the hash will simply be treated as a float.

which means. 0e132798983807237937411964085731 == 0e111 will yield True . So let's try to generate a hash using tiger128,4 hash function that was a built-in hash function in PHP. I was trying to see if I can use a python script for it, since I am not very familiar with PHP scripting lol. PS: I can read it just fine.....

But I quickly came up with a slow, but working php script.

<?php
$x = 1;

while(true) {
  $test=hash('tiger128,4',strval($x));
  if(substr($test, 0,2) ==="0e" and is_numeric(substr($test,2))){
        echo $x;
        echo "\\n";
}
 $x++;
}
?>

/* it might take longer than 5mins */

afterward, we need to manually test our x with the echo hash('tiger128,4',strval($x)); and making sure our final hash are in format of 0e[1-9]+ Ex.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/6de3d351-a65b-48ac-b88d-2b49b678153e/Untitled.png

Will not work. Eventually, we got something that will fits our need.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/57166fd8-3122-4d6e-a428-a370d5de8a88/Untitled.png

We already solved the hardest part. So let's also 'crack' the username hash. 51c3f5f5d8a8830bc5d8b7ebcb5717df

Hash tiger128,4: 51c3f5f5d8a8830bc5d8b7ebcb5717df

A quick rainbow table lookup will do the trick!

So we got our creds.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/48fa1874-7d92-4833-9bed-ce82534b3aee/Untitled.png

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/20a68e2e-b76b-49fd-9d15-1e9ebe964991/Untitled.png