Who Wants to Be a Millionaire? Join My LOTT and Win JACKPOTTTT!!!
Remote: 128.199.190.23:8001
In Firefox view the source of the web page: view-source:http://128.199.190.23:8001/ and look at the comment at the end:
So instead of requesting http://128.199.190.23:8001/ with GET now try http://128.199.190.23:8001/?is_debug=1.
So now we can see the full PHP code:
So looking at the code it seems that the first step is to send a number like 67 86 93 92 41 76, the server serialize it and base64 encode it and then send it back to us, finally we submit this base64 string and the server decode the base64 , unserialize it and compare the number with the jackpot number.
If we decode the base64 string, the serialized object looks like that:
Unserialized the object looks like that:
Reading through the code the object is described as:
But the server sets that object's jackpot variable to a string with 6 random numbers.
Unfortunately the comparison is done by using === identity check instead of == equality check so we can't use PHP magic tricks to do type juggling.
We can't either set the jackpot value with an object like:
because the random jackpot value is set after so it override the given value.
So what we need is to set the enter value as a symlink of jackpot value.
Reading PHP Serialization Structure we can see there is an unknow and not well documented feature: Reference. So intead of using a key:value like s:17 meaning we store a string with length of 17 char we can use R:x that mean we want a reference of index x.
So let's built a serialized object with enter value as a reference of jackpot:
When the jackpot variable is then set to the string with the random numbers it'll also effectively set out enter variable to the same string.
Finally we just need to encode the object:
The flag was MeePwnCTF{__OMG!!!__Y0u_Are_Milli0naire_N0ww!!___}.
Notes and test code nandayo ran locally to test this.