KeyGen Challenge
KeyGen Challenge
Lab Objectives
- No patching
- Create a KeyGen
- Upload a solution + tutorial
Starting
Run the program:
Step 2: Open x64gdb for Analysis
- Right Click → Search For → All Modules → String References
- Go to the
namestring - Observe the breakpoint:
- The instruction
cmp eax, dword ptr ss:[ebp-30]is present. - Examine the
eaxregister while the program runs. 
- This reveals the program’s behavior.
- View the
eaxregister: 
- The input series is stored in the
EAXregister.
- To understand the program, examine the instruction
dword ptr ss:[ebp-30]:
- At memory address
00401442, a function call is present. Open Ghidra to decompile this function and understand the key generation logic:
Step 6: Open Ghidra and Locate the CALL Instruction
The key generation logic is now understood:
lenstores the length of the user input.local_34takes the input length and computes:len(user_input) + 0xcaU ^ 0x3d8d40f
Step 7: Create a Python KeyGen
1
2
3
user_input = input("enter a name : ")
GenKey = len(user_input) + 0xca ^ 0x3d8d40f
print(f"KeyGen is : {GenKey}")
Step 8: Finished
Return to the write-ups for more challenges.
This post is licensed under CC BY 4.0 by the author.





