The withdrawFrom function in FETH.sol did not check that the recipient address was not the zero address. If a user passed the zero address, the withdrawn funds would be sent there and lost.
Yes, this is a good recommendation which may prevent users losing their funds due to user error. We have made the following change as recommended:
} else if (to == address(0)) {
revert FETH_Cannot_Withdraw_To_Address_Zero();
} else if (to == address(this)) {
revert FETH_Cannot_Withdraw_To_FETH();
}
The original report as published on Code4rena, by cmichel. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Generating the AI write-up for this report.
This usually takes about a minute. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
How it worked
Root cause
Likely the function lacked a check to ensure the recipient address was not the zero address.
Impact
Funds could be permanently lost if a user mistakenly set the recipient to the zero address.
What the attacker needed
User calls withdrawFrom with zero address
The fix
The contract was fixed by adding a check that reverts if the recipient is the zero address.
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 report has not been written yet. The Original tab links to the source.
Generating the AI write-up for this report.
This usually takes about a minute. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
A smart contract function that lets you withdraw funds to an address did not check that the address was valid. If you accidentally used the zero address, which is a special address that nobody controls, the money would be gone forever. The fix is to reject that address.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.