How I solve MD5 Games 1 – Hack Dat Kiwi 2017

Let’s  see how the challenge code looks like.

<?php

$md5=$_GET[‘md5’];

if($md5==md5($md5)){

echo “The correct value is ….”;

}else{

echo “Wrong”;

}

I didn’t remember the original code but it’s very similar to this.

$md5==md5($md5)  How is this posible? Thats the point. If you read read this Article you can see ,

$md5=’0ebc12423′; // start with 0e

if ($md5==’0e3454′){

return true;

}

The answer is true.

The reason is computer identified the strings starting with “0e” as a scientific notation.

So let’s turn to the challenge.

As we can see we have to find a string which started with “0e” and also its md5 value starts  with 0e.

I have made a simple php script to brute-force this value.

<?php
for ($x = 0; $x <= 10000000000000000; $x++) {

$val=’0e’.$x;

if($val==md5($val)){
print “congratz the code is:”.$val;
exit();
}}

?>

After running this code I got the value within few minutes.

Screenshot from 2017-10-13 10-09-48 Finally I entered this value on the form and I was able to get the flag.

Special Thanks to @kiwilord who gave me some hints during this CTF camp.

Thank You!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s