Sitemap
Press enter or click to view image in full size

RR7’s Secret key — Answer (crackmes.one)

--

RR7’s Secret Key — Reverse Engineering Write-Up

Introduction

First, I examined the functionality of the program. The application contains an “Enter your number” input that is assigned a specific value.

Press enter or click to view image in full size

If the entered value is correct, the program proceeds to the next stage.

To understand how the program works and perform reverse engineering, I used Ghidra, a widely used reverse engineering tool.

Analysing the “Enter Your Number” Input

After importing and analysing the code.exe executable in Ghidra, I navigated through the Program Trees section and searched for the "Enter your number" string to determine what value was associated with it.

Eventually, I found the corresponding string in the .rdata section:

s_Enter_Your_Number
Press enter or click to view image in full size
Press enter or click to view image in full size

By double-clicking on the string, Ghidra showed me the location and the code where it was referenced.

After examining the code, I noticed that the “Enter your number” input was associated with the local_c variable. This value was then compared against a hexadecimal value.

The relevant value was:

0x21

Converting it from hexadecimal to decimal:

0x21 = 33
Press enter or click to view image in full size
Press enter or click to view image in full size

Therefore, the first required value is:

33

At this point, we can proceed to the next stage of the challenge.

Press enter or click to view image in full size

Analysing the Secret Key

Next, I encountered the following input:

Enter The Secret Key

By examining the corresponding code, I noticed that this input was associated with the local_10 variable.

The value stored in this variable was ultimately compared against:

0x66

Converting the value from hexadecimal to decimal:

0x66 = 102

When the correct value is provided, the program displays the following message:

Congratulations, you have completed the challenge!

Therefore, the second required value is:

Get Ilkin Huseynzada’s stories in your inbox

Join Medium for free to get updates from this writer.

102

Analysing the First Check

The first validation is performed according to the following instructions:

1400014df  8b 45 fc       MOV EAX,dword ptr [RBP + local_c]
1400014e2 83 f8 21 CMP EAX,0x21
1400014e5 75 39 JNZ LAB_140001520
Press enter or click to view image in full size

Let’s take a closer look at what happens here.

First, the value stored in the local_c variable is loaded into the EAX register:

MOV EAX,dword ptr [RBP + local_c]

Then, the value in EAX is compared against 0x21:

CMP EAX,0x21

As previously identified:

0x21 = 33

The JNZ instruction then checks whether the comparison resulted in a mismatch. If the values are not equal, execution is redirected to:

LAB_140001520

This confirms that the program expects the first input to be:

33

Analysing the Second Check

The next part of the code contains the following instructions:

1400014f6  48 8d 45 f8    LEA RAX=>local_10,[RBP + -0x8]
1400014fa 48 8d 0d LEA _Argc,[DAT_140004015] = 25h %
14 2b 00 00
140001501 48 89 c2 MOV _Argv,RAX
Press enter or click to view image in full size

This section references the local_10 variable, which is associated with the second input, "Enter The Secret Key".

The expected value identified during the analysis is:

0x66

Converting it to decimal:

0x66 = 102

Therefore, the second required input is:

102

Reaching the Success Message

Finally, the program reaches the following message:

Congratulations, you have completed the challenge!

The relevant instructions are:

140001511  48 8d 05       LEA RAX,
[s_Congratulations,_you_have_comple_140004]
= "Congratulations, you have com
18 2b 00 00
140001518  48 89 c1       MOV _Argc=>s_Congratulations,_you_have_comple_1400
= "Congratulations, you have com"
Press enter or click to view image in full size

After analysing the program’s control flow and the values used during the validation process, the required inputs to complete the challenge are identified as:

Enter your number: 33
Enter The Secret Key: 102

The challenge is successfully completed when both values are entered correctly.

Conclusion

This challenge was a simple but useful introduction to reverse engineering using Ghidra. By analysing strings, variables, hexadecimal values, and assembly instructions, it was possible to understand the program’s validation logic and identify the correct inputs required to complete the challenge.

The key values identified during the analysis were:

  • First input: 33 (0x21)
  • Secret key: 102 (0x66)

This demonstrates how reverse engineering tools such as Ghidra can be used to analyse compiled executables and understand their internal logic.

--

--