Challenge
Your goal is to subscribe as a VIP.
Target: http://142.93.103.129:3000
This challenge is an Storage Allocation Description in smart contracts
Vulnerability
1 |
|
Structs in Solidity default to storage.
-> Subscriber s;
is a storage pointer, declared in a function with no address assigned.
-> This function will overwrite the storage address 0, and 1.
1 |
|
- subscription -> registration_open
- subscriber -> owner
Exploit
I wrote the function call down to a python code.
1 |
|
After setting up everything :
1 |
|
- subscriber -> owner
- subscription -> registration_open
This call, will make your wallet become owner, and close the registration.
But we are owner now, just open it by calling enableRegistration()
.
1 |
|
That’s all.
feel free to subscribe as VIP, then get the flag.
1 |
|