code-423n4 / 2021-04-marginswap-findings

1 stars 0 forks source link

Rewards cannot be withdrawn #26

Open code423n4 opened 3 years ago

code423n4 commented 3 years ago

Email address

mail@cmichel.io

Handle

@cmichelio

Eth address

0x6823636c2462cfdcD8d33fE53fBCD0EdbE2752ad

Vulnerability details

The rewards for a recipient in IncentiveDistribution.sol are stored in the storage mapping indexed by recipient accruedReward[recipient] and the recipient is the actual margin trader account, see updateAccruedReward.

These rewards are supposed to be withdrawn through the withdrawReward function but msg.sender is used here instead of a recipient (withdrawer) parameter. However, msg.sender is enforced to be the incentive reporter and can therefore not be the margin trader.

Impact

Nobody can withdraw the rewards.

Recommended mitigation steps

Remove the isIncentiveReporter(msg.sender) check from withdrawReward function.