You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GovernanceStakerOnBehalf enables to carry actions on deposits on behalf of another user. These actions can be carried by using off-chain signatures, and nonces are implemented in order to avoid signature replay, which is a standard protection.
However for the endpoint claimRewardOnBehalf, it is not clear if the signature provided is one of the claimer of the deposit or owner of the deposit (both are accepted).
The signature for the claimer of the deposit is tested first, but it uses the nonce even if the signature is invalid for the claimer: GovernanceStakerOnBehalf.sol#L259:
function _useNonce(addressowner) internalvirtualreturns (uint256) {
// For each account, the nonce has an initial value of 0, can only be incremented by one, and cannot be// decremented or reset. This guarantees that the nonce never overflows.unchecked {
// It is important to do x++ and not ++x here.return _nonces[owner]++;
}
}
Scenario
A depositor Bob can bump any nonce for any address Alice by:
In one transaction:
1/ Setting Alice as a claimer for a deposit Bob owns
2/ Call claimRewardsOnBehalfOf with Bob signature
3/ Reset claimer to Bob controlled address.
Impact
Any action done on GovernanceStakerOnBehalf can be DOSed by a malicious actor bumping the nonce on behalf of the victim user
Recommendation
Only use the nonce when the signature has been confirmed as valid. Here instead of _useNonce, the function nonces() can be used to get the nonce:
We believe the severity of this issue should be lowered to low/info because any action can be triggered without an on behalf call. Also, a defender can somewhat mitigate this issue. An attacker must have claimable rewards greater than the fee amount, and in order to attack an address the attacker must allow the defender to claim their fees. In order to stop the ddos the defender could claim the attackers fees thus preventing the attacker from successfully calling claimRewardOnBehalf.
Description
GovernanceStakerOnBehalf
enables to carry actions on deposits on behalf of another user. These actions can be carried by using off-chain signatures, and nonces are implemented in order to avoid signature replay, which is a standard protection.However for the endpoint
claimRewardOnBehalf
, it is not clear if the signature provided is one of the claimer of the deposit or owner of the deposit (both are accepted).The signature for the claimer of the deposit is tested first, but it uses the nonce even if the signature is invalid for the claimer:
GovernanceStakerOnBehalf.sol#L259:
Nonces.sol#L28-L35:
Scenario
A depositor Bob can bump any nonce for any address Alice by:
In one transaction:
1/ Setting Alice as a claimer for a deposit Bob owns
2/ Call
claimRewardsOnBehalfOf
with Bob signature3/ Reset claimer to Bob controlled address.
Impact
Any action done on
GovernanceStakerOnBehalf
can be DOSed by a malicious actor bumping the nonce on behalf of the victim userRecommendation
Only use the nonce when the signature has been confirmed as valid. Here instead of
_useNonce
, the functionnonces()
can be used to get the nonce:GovernanceStakerOnBehalf.sol#L259:
And then the nonce should be used once the signature has been validated
The text was updated successfully, but these errors were encountered: