PassCode Walkthrough
Challenge Statement#
Solution#
Heading over to the site, we can view the contract’s source code.
The contract’s logic is straightforward, it only unlocks if you provide the correct number via the unlock function.
The flag is stored in the secret variable and is only revealed by the getFlag function once unlock_flag is set to true.
The unlock function takes an input and compares it to the stored variable code. If they match, it sets unlock_flag to true.
We can try to read code from the contract’s storage.
Now, we can send a transaction to call unlock
Now, we can call the getFlag() function to reveal the flag.
Adapted from harishkannan05/THM-HackfinityBattle-Writeup under MIT.