PHP Challenge 2015

A little security challenge for PHP developers and security professionals


Every once in a while various web security people release XSS competitions to challenge each other. This kind of challenges do not seem to exist for other web security topics. But why leave all the fun to the XSS crowds? Therefore we came up with a PHP challenge that requires advanced PHP security knowledge to be solved correctly.

Do you believe to have what it takes to solve this challenge?

This Challenge is over and you can find the solution over at /blog/15-08-03-php_challenge_2015_solution.html. But you should first try to solve it without our help.


 * PHP Challenge 2015
 * Why leave all the fun to the XSS crowd?
 * Do you know PHP?
 * And are you up to date with all its latest peculiarities?
 * Are you sure?
 * If you believe you do then solve this challenge and create an
 * input that will make the following code believe you are the ADMIN.
 * Becoming any other user is not good enough, but a first step.
 * Attention this code is installed on a Mac OS X 10.9 system
 * that is running PHP 5.4.30 !!!
 * TIPS: OS X is mentioned because OS X never runs latest PHP
 *       Challenge will not work with latest PHP
 *       Also challenge will only work on 64bit systems
 *       To solve challenge you need to combine what a normal
 *       attacker would do when he sees this code with knowledge
 *       about latest known PHP quirks
 *       And you cannot bruteforce the admin password directly.
 *       To give you an idea - first half is:
 *          orewgfpeowöfgphewoöfeiuwgöpuerhjwfiuvuger
 * If you know the answer please submit it to

$users = array(
        "0:9b5c3d2b64b8f74e56edec71462bd97a" ,

$valid_user = false;

$input = $_COOKIE['user'];
$input[1] = md5($input[1]);

foreach ($users as $user)
        $user = explode(":", $user);
        if ($input === $user) {
                $uid = $input[0] + 0;
                $valid_user = true;

if (!$valid_user) {
        die("not a valid user\n");

if ($uid == 0) {

        echo "Hello Admin How can I serve you today?\n";
        echo "SECRETS ....\n";

} else {
        echo "Welcome back user\n";

Training Advertisement

If this challenge was of interest to you please check out our upcoming web security training.

Stefan Esser