Idoriot Revenge

Description

by tirefire

The idiot who made it, made it so bad that the first version was super easy. It was changed to fix it.

Attachments: http://idoriot-revenge.chal.imaginaryctf.orgarrow-up-right

Solution

Same as [Idoriot](

), we register and get source code.

// Check user_id
if (isset($_GET['user_id'])) {
    $user_id = (int) $_GET['user_id'];
    // Check if the user is admin
    if ($user_id == "php" && preg_match("/".$admin['username']."/", $_SESSION['username'])) {
        // Read the flag from flag.txt
        $flag = file_get_contents('/flag.txt');
        echo "<h1>Flag</h1>";
        echo "<p>$flag</p>";
    }
}
  1. We just need to create a user where admin word is inside.

  2. $user_id == "php" user_id is int and int == str becomes int == (int) str. This is because php type jugglingarrow-up-right (== is not safe for exact comparision, === should be used). In this case (int) str becomes 0, so we need user_id to be 0.

Let's do it with cUrl:

circle-check

Last updated