Eldorion
Personal Rating: Easy
This blockchain challenge was quite fun and illustrated the risks of relying on (inaccurate) block timestamps for verification. This is the contract we are presented with:
As with most blockchain challenges, we have an rpc port to interact with the contract and a control port where we can fetch our private key, target contract address etc. So I started with fetching these details:
Inspecting the contract, this is how it seems to work:
There is a boss with 300 health that has to be defeated to win the challenge. Each hit can make a maximum of 100 damage, but if the timestamp increased when striking again, the health will be set to 300 again by the EternalResilience modifier. This command worked to make 100 damage:
As expected, consecutive hits do not work to reduce Eldorion's health by 300 due to the modifier.
If there is a time gap (block.timestamp > lastAttackTimestamp), the health is reset at the start of each function call of attack().
By researching I found out that block.timestamp is accurate to about the second, but should not be trusted for millisecond precision. The attack vector seems to be that you have to send 3 attack requests within the smallest amount of time possible, so that the timestamp does not change during the three hits.
I wrote a script to execute three consecutive attacks, followed by the isDefeated function. The script checks for the flag afterwards. After a few attempts, it worked.
HTB{w0w_tr1pl3_hit_c0mbo_ggs_y0u_defe4ted_Eld0r10n}
Last updated