Shelter claimed mapping is set with _to address and not msg.sender
The Shelter contract's withdraw function tracks claimed withdrawals using the recipient address (_to) instead of the caller (msg.sender), allowing any user with a small share to repeatedly withdraw and drain all funds.
Submitted by 0xliumin, also found by cmichel, leastwood, and pauliax
Any user can withdraw all the funds from the shelter. This is done by calling withdraw repeatedly until all funds are drained. You only need to have a small share.
Even if the claimed mapping was checked, there would still be a vulnerability. This is because the claimed mapping is updated with the _to address, not the msg.sender address.
Recommended Mitigation Steps
Remediation is to change the _to to msg.sender.
Shelter.sol#L55
Alex the Entreprenerd (judge) increased severity to High and commented:
Am marking this as a unique finding as this one shows another issue with the Shelter withdraw function.
Because this also allows for draining of all rewards, am raising to High Severity.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The claimed mapping is updated with the _to address instead of msg.sender, so the same caller can withdraw repeatedly by varying the recipient.
Impact
Any user with a small share could drain all funds from the shelter.
What the attacker needed
A small share in the shelter
The fix
The fix is to change the _to to msg.sender when updating the claimed mapping.
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.
A smart contract lets people withdraw funds, but it keeps a record of who has already withdrawn using the address that receives the funds, not the address that asked for them. An attacker can ask for funds to be sent to a different address each time, so the record never shows they already withdrew, and they can keep taking money until the contract is empty.
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.