Crackme is a set of well-designed challenges for reverse engineering, created by my tutor Jazz:
https://github.com/jtalowell/crackme
My whole solving process was enjoyable, all problems are challenging but achievable, shout out to Jazz.
This binary requires authentication with a password
There are two tasks:
i) Find input that results in the program printing 'Password correct!'.
ii) Modify the binary such that any input results in the program printing
'Password correct!'.
i) This one is pretty straight forward, we can see the password is in plain text, we can read directly from the disassembler, which is âasecurepasswordâ
and let's try to type the password in the program:
ii) Just simply forbid the branch, since the branch leads to the âpassword incorrectâ
Now, letâs save it and run
This binary requires authentication with a password.
There are two tasks:
i) Find input that results in the program printing 'Password correct!'.
ii) Modify the binary such that any input results in the program printing
'Password correct!'.
i) We can see the program is actually receiving a string and convert it into long, and then compare it with the number 0x539, so itâs obvious now the password is the decimal form of 0x539, which is 1337
Now, letâs type in the password
ii) Modification is similar to the previous challenge, simply set a never branch at jne 0x11e9
This binary requires authentication with a password.
There are two tasks:
i) Find input that results in the program printing 'Password correct!'.
ii) Modify the binary such that any input results in the program printing
'Password correct!'.
i) This time, instead of reading from stdin, the program reads the input from the argument, if thereâs no argument, the program prints âPassword incorrectâ directly, otherwise it converts the first he argument to long, and then compare it to number 0x1dc7, so the password here is the decimal form of 0x1dc7, which is 7623
Now, letâs type in the password in the argument
ii) Modification is similar as well, simply never branch at jne 0x119c
This binary requires authentication with a password.
There are two tasks:
i) Find input that results in the program printing 'Password correct!'.
ii) Modify the binary such that any input results in the program printing
'Password correct!'.
i) Basically, the program checks the environment variable âFLAGâ and compares it to the number â0x1ab9â, which in decimal is 6841, and 6841 is the password
But this time, we need to set the environment variable FLAG to 6841, we can use export to set it, like this
ii) Simply set never branch at je 0x11af and jne 0x11c4
This binary requires authentication with a valid license.
There are two tasks:
i) Find input that results in the program printing 'License valid!'.
ii) Modify the binary such that any input results in the program printing
'License valid!'.
i) Letâs first take a look at the main function, in main, the program simply calls the function validate_license, and if the function returns 0, the license is invalid, otherwise, the license is valid.
Now, letâs jump to the function validate_license to see what happened there:
The function read the file âlicense.txtâ and compare the content in the file to the number 0x192f, which is the password, its decimal form is 6447.
And now letâs create the file and put the password in it
ii) Modification from my point of view is just changing the mov eax, 0x0 to mov eax 0x1
So that even no license file created, the function will still return 1, which will let the program print valid license.
This binary simulates some non-malicious behaviour of the WannaCry virus.
There are two tasks:
i) Find out how to disable the malware without modifying the binary. You are
not required to actually disable it.
ii) Modify the binary such that the malware is disabled.
(Confirmed from the author, no actual malware is activated, please feel safe xD)
i) First, take a look at the main function, it checks if the kill switch is alive or not to determine the state of the malware
Now, letâs take a look at the is_killswitch_alive function
We can see a domain name in plain text, letâs open it in the browser
Which returns an url, and the url doesnât exist
Though I canât read the whole binary code, I can guess that it might checks if the url from the plaintext domain exists, if it exists, close the malware.
The way to solve this is to either map the non-existing url to the local host, and run a local server to handle the request or simply buy the domain.Â
ii) Letâs analyse the function
we can find the return variable is var_9, so what we need to do is just to change this variable to 1, so that the kill switch is alive
Now, letâs run the save the program
This binary requires authentication with an authentication code.
There are two tasks:
i) Find input that results in the program printing 'Access granted!'.
ii) Modify the binary such that any input results in the program printing
'Access granted!'.
i) We can see the software is actually taking the number from the argument and use it as a seed to generate a random number, and compare the number generated to a specific number. Hence we the only way to get access from the program is to guess the random seeds used to generated the specific number, this can only be solved by brute force
The is not hard to brute force, as I just tried a few numbers by hand and get it right, without even writing any supportive program
ii)Â Modification is simple, just set a never branch at jne 0x11d0
This binary requires authentication with an access code.
There are two tasks:
i) Exploit a bug that results in the program printing 'Access granted!'.
ii) Modify the binary such that any input results in 'Access granted!'.
i) The program firstly checks if the length of the input string is 7, as 7 is compared to the return value of strlen, which includes the null terminator, so actually, only 6 characters can be entered. Then, as usual, the program converts the string to long
Now, we come to the main part, the loop, of the program. The loop initialize a temporary variable (say i) to 1, and it will do some operations until i reaches the number we entered, in other words, the number we entered is the number of times the operations will be performed. But no matter what how many times the operations has been performed, the flag (which will determine the output of the program) will always be set to 1, which will lead the program to output âaccess deniedâ (as the program performs the XOR operation on flag and 1), which means in order to let it print âaccess grantedâ, we have to find a way to skip the loop.Â
Letâs take a look at the loop condition again carefully
We can see, the loop condition only holds when i <= number we entered, therefore, we only need to enter a number that is already smaller than i at the beginning, which is any 5 digits negative number (as â-â holds one position)
ii) Modification is very easy now, as we now only need to let the loop always set the flag to 0
so that any 6 digit number will be granted the access
so that no matter what you entered will always give out an âaccess grantedâ