Open code423n4 opened 1 year ago
Coded POC is well documented -> Primary
GalloDaSballo marked the issue as primary issue
This is a known issue that we don't intend to fix. The issue is most likely to present itself at the very start of the ggAVAX and not during typical operation. There's a bit more explanation here: https://github.com/fei-protocol/ERC4626/issues/24
I don't believe redeeming max available is an appropriate solution because the spec for redeem reads
MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc).
The Warden has shown a scenario in which maxRedeem
can revert
While this can be attributed to rounding errors, it ultimately is possible for certain depositors to lose marginal amounts of their rewards or principal.
Because of the reduced impact, I agree with Medium Severity
This is a hedge case that has been argued to have happened very rarely, and for this reason, I maintain that the severity is Medium, but can agree with a nofix, as the worst case will require the Sponsor to offer a small amount of additional token, to allow the last withdrawer to maxRedeem
GalloDaSballo marked the issue as selected for report
Lines of code
https://github.com/code-423n4/2022-12-gogopool/blob/aec9928d8bdce8a5a4efe45f54c39d4fc7313731/contracts/contract/tokens/TokenggAVAX.sol#L191 https://github.com/code-423n4/2022-12-gogopool/blob/aec9928d8bdce8a5a4efe45f54c39d4fc7313731/contracts/contract/tokens/TokenggAVAX.sol#L88
Vulnerability details
Impact
The
totalReleasedAssets
variable is updated on the syncRewards() function if someone calls the function beforerewardsCycleEnd
the redeemAVAX() will be reverted because thetotalReleasedAssets
may not include all the rewards.The ggAvax holder can not redeem his funds until the
rewardsCycleEnd
Proof of Concept
I did the next test:
Output:
Tools used
Foundry/VsCode
Recommended Mitigation Steps
Consider redeem the max available amount for the shares owner instead of revert. The
maxRedeem()
function amount is not the same as thepreviewRedeem()
amount.