Smart Contracts
The smart contract had a reentrancy vulnerability that allowed an attacker to repeatedly withdraw funds beyond their deposit. An attacker could drain more Ether than they initially deposited.
Sakshi Kulshreshtha a.k.a FallenSky Follow
Published on infosecwriteups.com
This task had a lot of theory given about a smart contract vulnerability before we actually go hands-on with the practical application of the basic vulnerability.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the contract sent Ether to the caller before updating its internal balance, allowing reentrant calls to withdraw repeatedly.
What the attacker needed
Access to Remix IDE; the provided contract files; a deployed vulnerable contract
How it was found
- Open Remix IDE and load the provided contract files.
- Compile both files using the Solidity compiler.
- Deploy the etherstore contract and deposit 1 Ether.
- Copy the deployed etherstore address.
- Deploy the attack contract using that address.
- Call the attack function with a value of 1, repeatedly, to withdraw more than deposited.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A smart contract is a program on a blockchain that holds and moves money automatically. This one had a flaw: when someone asked for their money back, the contract sent it before updating its records, so the person could ask again and again before the first request finished. That let them take more money than they put in.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.