Staking.restakeGGP should not be allowed when contract is paused #236
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-673
satisfactory
satisfies C4 submission criteria; eligible for awards
Lines of code
https://github.com/code-423n4/2022-12-gogopool/blob/main/contracts/contract/Staking.sol#L328-L332
https://github.com/code-423n4/2022-12-gogopool/blob/main/contracts/contract/ClaimNodeOp.sol#L106
Vulnerability details
Impact
Staking.restakeGGP
should not be allowed when contract is paused. Even that it's only callable byClaimNodeOp
, it's still can be directly called by user throughClaimNodeOp.claimAndRestake
.Proof of Concept
When Staking contract is paused, then staking and withdrawing of GGP is disallowed. So both
stakeGGP
andwithdrawGGP
functions havewhenNotPaused
modifier.Also there is another possibility to stake GGP using
Staking.restakeGGP
function. It's only callable byClaimNodeOp
. And this function doesn't havewhenNotPaused
modifier.https://github.com/code-423n4/2022-12-gogopool/blob/main/contracts/contract/Staking.sol#L328-L332
restakeGGP
can be called only byClaimNodeOp
. It is called insideClaimNodeOp.claimAndRestake
function.https://github.com/code-423n4/2022-12-gogopool/blob/main/contracts/contract/ClaimNodeOp.sol#L89-L114
As you can see this function can be called by anyone who has ggp rewards.
So using
ClaimNodeOp.claimAndRestake
user can dismiss restriction for staking ggp when Staking contract is paused.Tools Used
VsCode
Recommended Mitigation Steps
Add
whenNotPaused
modifier toStaking.restakeGGP
function.The text was updated successfully, but these errors were encountered: