Ghazy Corp
Welcome to my corp. /mail is just to simulating mail service it shouldn’t be vulnerable to something that will help you solving this challenge
{
$data=safe_data($_POST);
$placeholders = implode(', ', array_fill(0, count($data), '?')); //like here
$sql = "INSERT INTO users (" . implode(', ', array_keys($data)) . ") VALUES (" . $placeholders . ")"; //like here
$stmt = $conn->prepare($sql);
if ($stmt)
{
$types = str_repeat('s', count($data));
$stmt->bind_param($types, ...array_values($data)); if($target_user['confirmed']===1) //this functionality is available only for confirmed users
{
$level=(int)$target_user['level'];
generate_reset_tokens($email,$level);
send_forget_password_mail($email);
echo "<script>window.location.href='reset_password.php';</script>";
}Exploit
User register
Forget password functionality
Read token and break mt_rand




Exploit wrong_reset_token.php and login as admin

Read the flag
Sending payload and recovering flag


Last updated