Open code423n4 opened 2 years ago
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
Per discussion with @leekt - adding sponsor confirmed
label.
Lines of code
https://github.com/code-423n4/2022-02-concur/blob/72b5216bfeaa7c52983060ebfc56e72e0aa8e3b0/contracts/Shelter.sol#L55
Vulnerability details
Impact
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 theclaimed
mapping is updated with the_to
address, not themsg.sender
address.Remediation is to change the
_to
tomsg.sender
. https://github.com/code-423n4/2022-02-concur/blob/72b5216bfeaa7c52983060ebfc56e72e0aa8e3b0/contracts/Shelter.sol#L55