The Art of Reversing is an easy reversing challenge on Hack The Box. The description is “This is a program that generates Product Keys for a specific Software Brand.
The input is the client User Name and the Number of Days that the software will remain active on the client.
The output is the product key that client will use to activate the software package.
We just have the following product key ‘cathhtkeepaln-wymddd’
Could you find the corresponding Username say A and the number of activation days say B given as input?
The flag you need to enter must follow this format: HTB{AB}.” Let’s run the “file” command and see what we got.

We got another .Net assembly so let’s run it on our Windows machine and see what happens.

Here we have a simple product key creator. Let’s put in some information and see what we get back.

Let’s start with the username portion. The first thing that I notice is the username seems to be the same characters, but put in a different order. The length of the username we need to find is 13 characters long so let’s put in 13 characters and see what the order is.

Looks like our assumption was correct. Now that we know that, it is very simple to get back to the original. Going one character at a time, we know whatever is in the third position in the username gets put into the first position in the product key. We test this by putting ‘c’ in the third slot. In the product key section we see ‘c’ is at the beginning so we know our method works.

Now we just need to do this for the rest of the letters. There is also a fun little message in the username.

Step one is now complete. Unfortunately for us, the next step will not be quite so easy. Looking at the second part of the product key there is no easily identifiable pattern we can reverse, so let’s look into the code. Since it is a .Net file we are going to open it up in dnSpy.

I open up the file and am taken to the Main function. There is not much here so it is easy to find where to go next.

I clicked on the Form1 function and scrolled down until I found this. It looks like this is where the Activation Days are turned into letters. Let’s test this.

This is not the output I expected. It seems the number is not turned directly into the letter in the if statement, but the one after it. This makes sense as many of the letters in the product key are not in this if statement. Using this info we can once again work backwards and find the right number to solve this problem.

We know we need a ‘w’ in the key and ‘w’ is the letter after ‘v’ so let’s throw a 5 in there.

Doing this, we also find out the positions are reversed when going from number to letter. Now we have the first part, let’s do the same for the next sequence of letters.

The next letters we need are ‘y’ and ‘m’. Looking through the if statement we find two letters that are before them so we add 10 and 50 together to get 60 and let’s test it. I also lower the number from 1005 to 65 to save time.

Now we have the first three letters. We continue this process for the last number and we are done.

This challenge was less reverse engineering code and more of a thinking challenge to me, but it was still very fun. Thanks for reading and happy reversing!

Leave a comment