Open code423n4 opened 2 years ago
@dapp-whisperer wdyt?
I think this is valid and was fixed in https://github.com/Citadel-DAO/citadel-contracts/pull/44
I'm downgrading this to Medium as there are no funds directly at risk, but a malfunction and leak of value. The user will have to wait for a longer than expected time to claim their vested funds.
Lines of code
https://github.com/code-423n4/2022-04-badger-citadel/blob/18f8c392b6fc303fe95602eba6303725023e53da/src/StakedCitadelVester.sol#L143 https://github.com/code-423n4/2022-04-badger-citadel/blob/18f8c392b6fc303fe95602eba6303725023e53da/src/StakedCitadelVester.sol#L109
Vulnerability details
Impact
When
vest
is called by xCTDL vault, the previous amount will re-lock according to the new vesting timeline. While this is as described in L127,claimableBalance
might revert due to underflow ifvesting[recipient].claimedAmounts
> 0 because the user will need to vest theclaimedAmounts
again which should not be an expected behavior as it is already vested.Proof of Concept
https://github.com/code-423n4/2022-04-badger-citadel/blob/18f8c392b6fc303fe95602eba6303725023e53da/src/StakedCitadelVester.sol#L143
https://github.com/code-423n4/2022-04-badger-citadel/blob/18f8c392b6fc303fe95602eba6303725023e53da/src/StakedCitadelVester.sol#L109
Recommended Mitigation Steps
Reset claimedAmounts on new vest