Rewards cannot be withdrawn
Rewards are credited to a margin trader's account but the withdrawal function checks the caller against the incentive reporter role, so the trader can never withdraw. As a result, nobody can withdraw the accrued rewards.
Marginswap
Originally disclosed on Code4rena
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.
Nobody can withdraw the rewards.
Recommend removing the isIncentiveReporter(msg.sender) check from withdrawReward function.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The withdrawal function uses the caller's address instead of a recipient parameter and also requires the caller to be the incentive reporter, which the actual reward owner cannot be.
Impact
Accrued rewards cannot be withdrawn by anyone, so they are permanently locked.
What the attacker needed
None
The fix
The `isIncentiveReporter(msg.sender)` check should be removed from `withdrawReward` so the reward owner can withdraw.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A smart contract keeps a record of rewards owed to each trader. The function meant to pay out those rewards only lets a special 'incentive reporter' call it, but the rewards belong to the trader, not the reporter. So the money is stuck.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.