Showing posts with label MSP430. Show all posts
Showing posts with label MSP430. Show all posts

Sunday, November 11, 2018

Micro Corruption IV: Cusco


Let's look at the main function. It has only one instruction that calls the 'login' function.


So lets look at the login function.


The 'test_password_valid' function that is being called is of interest to us. However, after observing the function, nothing stands as important.


Now, let's check the unlock_door function that starts at 4446.


We input the password as 16 characters (32 As in hex) with the value 0x4644 as below.



We are successful in solving this level.

Monday, October 1, 2018

Micro Corruption III: Hanoi


Hanoi is the third level on Micro Corruption. So, let's take a look at the main function:

The main function, unlike before, is very short and has only two instructions. Next we check the login function that is being called.

Here it says "Remember: passwords are between 8 and 16 characters." Now, lets input a 16 character password and see what happens.


The password we have entered starts at 2400 and ends right before 2410. If we look at the login function again, there is a compare instruction:

So, now we input the password of 16 characters and the value 0xe7 together.


Thirty two A's and e7 have been input as we are entering the password in hex encoded format. Then we are welcomed with the message that the door has been unlocked solving this level.

Saturday, September 15, 2018

Micro Corruption II: Sydney

In this post we solve the second level of Micro Corruption, an embedded security CTF. First lets check the main function:


We take a look at the check_password function that is being called in the main function:



  1. The first line of the check_password function compares 0x5a48 to the password the user enters. If the values don't match, the jump takes us to #44ac. 
  2. When the values match, there is another comparison of 0x7166 to 0x2 in r15. Similarly, if the values match we are taken to the next step else we jump to #44ac which clears r14 and then r15 is set to 0. 
  3. The third comparison of 0x3664 and 0x4 in r15 is also similar to previous comparisons. 
  4. After the fourth comparison of 0x256c with 0x6 in r15, if the comparison matches, then value 1 is moved to r15 from r14. 
  5. If the comparisons don't match then the value 0 is moved from r14 to r15. And we finally return to the main function.

This final value written to r15 is very important as it is used to test in the main function and if it is 0, the access is not granted. If the value is 1 or not 0, then access is granted, solving this level. So, the password must be 0x5a48, 0x7166, 0x3664 and 0x256c concatenated together? We could decode the hex value or directly input the hex value by using the check box.

But there is a final very interesting twist in the puzzle.


When we enter the password as (5a48 + 7166 + 3664 + 256c), we are not given access. So, we must consider the endianness and enter the password in little endian format (485a + 6671 + 6436 + 6c25).


And we are greeted with the message that the door is unlocked and we have solved this level.







Saturday, June 30, 2018

Micro Corruption I: New Orleans

I recently found a link to Micro Corruption which has challenges written in the MSP430 Architecture and I got hooked. So this is the first challenge after the tutorial. We need to enter a password to unlock the door and this level is fairly easy.


In the main function, the value of r15 is being tested. The main function calls several other functions. First let's check the contents of create_password function.


We can see that there are 8 characters but the last character is 0x0, so it must be 7 characters long. But if you look at the first line of the code we can see the instruction:


So lets check what is in the given location (0x2400) by viewing the Live Memory Dump section after entering the wrong password.



There are 7 characters 8H([F3). So, let's  enter these characters as the password and see what happens.



Then what do we know, the door has been unlocked solving this challenge.