Open code423n4 opened 1 year ago
Looks off, the modifiers will revert on pause, not return 0
Id say Low: (e.g. assets are not at risk: state handling, function incorrect as to spec, issues with comments). Excludes Gas optimizations, which are submitted and judged separately.
Good catch, I think we should override those for consistency at least but there's no way to exploit to lose assets. Agreed that QA makes sense.
By definition, the finding is Informational in Nature.
Because of the relevancy, I'm awarding it QA - Low
L
I had a change of heart on this issue, because this pertains to a standard that is being implemented
For that reason am going to award Medium Severity, because the function breaks the standard, and historically we have awarded similar findings (e..g broken ERC20, broken ERC721 standard), with Medium
The Warden has shown an inconsistency between the ERC-4626 Spec and the implementation done by the sponsor, while technically this is an informational finding, the fact that a standard was broken warrants a higher severity, leading me to believe that Medium is a more appropriate Severity
Am making this decision because the Sponsor is following the standard, and the implementation of these functions is not consistent with it
GalloDaSballo marked the issue as primary issue
GalloDaSballo marked the issue as selected for report
Lines of code
https://github.com/code-423n4/2022-12-gogopool/blob/aec9928d8bdce8a5a4efe45f54c39d4fc7313731/contracts/contract/tokens/upgradeable/ERC4626Upgradeable.sol#L156-L162
Vulnerability details
Impact
The
TokenggAVAX
contract (https://github.com/code-423n4/2022-12-gogopool/blob/aec9928d8bdce8a5a4efe45f54c39d4fc7313731/contracts/contract/tokens/TokenggAVAX.sol#L24) can be paused.The
whenTokenNotPaused
modifier is applied to the following functions (https://github.com/code-423n4/2022-12-gogopool/blob/aec9928d8bdce8a5a4efe45f54c39d4fc7313731/contracts/contract/tokens/TokenggAVAX.sol#L225-L239):previewDeposit
,previewMint
,previewWithdraw
andpreviewRedeem
Thereby any calls to functions that deposit or withdraw funds revert.
There are two functions (
maxWithdraw
andmaxRedeem
) that calculate the max amount that can be withdrawn or redeemed respectively.Both functions return
0
if theTokenggAVAX
contract is paused.The issue is that
TokenggAVAX
does not override themaxDeposit
andmaxMint
functions (https://github.com/code-423n4/2022-12-gogopool/blob/aec9928d8bdce8a5a4efe45f54c39d4fc7313731/contracts/contract/tokens/upgradeable/ERC4626Upgradeable.sol#L156-L162) in theERC4626Upgradable
contract like it does formaxWithdraw
andmaxRedeem
.Thereby these two functions return a value that cannot actually be deposited or minted.
This can cause any components that rely on any of these functions to return a correct value to malfunction.
So
maxDeposit
andmaxMint
should return the value0
whenTokenggAVAX
is paused.Proof of Concept
TokenggAVAX
contract is paused by callingOcyticus.pauseEverything
(https://github.com/code-423n4/2022-12-gogopool/blob/aec9928d8bdce8a5a4efe45f54c39d4fc7313731/contracts/contract/Ocyticus.sol#L37-L43)TokenggAVAX.maxDeposit
returnstype(uint256).max
(https://github.com/code-423n4/2022-12-gogopool/blob/aec9928d8bdce8a5a4efe45f54c39d4fc7313731/contracts/contract/tokens/upgradeable/ERC4626Upgradeable.sol#L157)deposit
cannot be called with this value because it is paused (previewDeposit
reverts because of thewhenTokenNotPaused
modifier) (https://github.com/code-423n4/2022-12-gogopool/blob/aec9928d8bdce8a5a4efe45f54c39d4fc7313731/contracts/contract/tokens/upgradeable/ERC4626Upgradeable.sol#L44)Tools Used
VSCode
Recommended Mitigation Steps
The
maxDeposit
andmaxMint
functions should be overridden byTokenggAVAX
just likemaxWithdraw
andmaxRedeem
are overridden and return0
when the contract is paused (https://github.com/code-423n4/2022-12-gogopool/blob/aec9928d8bdce8a5a4efe45f54c39d4fc7313731/contracts/contract/tokens/TokenggAVAX.sol#L206-L223).So add these two functions to the
TokenggAVAX
contract: