Closed code423n4 closed 2 years ago
https://github.com/code-423n4/2022-04-badger-citadel/blob/main/src/StakedCitadel.sol#L816
r is the user's part of the contract balance, but is supposed to be the user's part of the total funds, including the strategy funds.
r
therefore the check at line 816 will always return false because the user's part of the contract balance is smaller than the contract balance.
the user doesn't get their part of the strategy funds.
The user loses funds if they withdraw when there are funds in the strategy.
chnage r to be (total funds) * _shares / totalSupply();
I believe balance in our contract was improperly changed. Wdyt @dapp-whisperer
balance
Dup #74
Lines of code
https://github.com/code-423n4/2022-04-badger-citadel/blob/main/src/StakedCitadel.sol#L816
Vulnerability details
r
is the user's part of the contract balance, but is supposed to be the user's part of the total funds, including the strategy funds.therefore the check at line 816 will always return false because the user's part of the contract balance is smaller than the contract balance.
the user doesn't get their part of the strategy funds.
Impact
The user loses funds if they withdraw when there are funds in the strategy.
Recommended Mitigation Steps
chnage
r
to be (total funds) * _shares / totalSupply();