In claimRewards
, normal users can claim their rewards as long as they have enough veRAACToken.
However, this function doesn't have any access control, so anyone can call it. It's possible for malicious users can continuously monitor the contract state to see if the rewards are stealable.
Before diving into the attack path, let's take a look at the preconditions.
FeeCollector can gain RAACToken in two ways:
A user calls collectFees
and transfer their RAACToken to the FeeCollector contract.
When a user transfer RAACToken, they pay a tax to the FeeCollector Contract.
In order to claim the rewards, a user must have enough veRAACToken (aka voting power).
The problem is that a malicious user can simply wait for other users to call the collectFees
and for the protocol team to call distributedCollectedFees
once a week, then steal the rewards.
Here's the attack path:
The malicious user lock their RAACToken to mint veRAACToken.
Instead calling collectFees
function themselves, the malicious user waits for other users to call it.
The malicious user continuously monitors the contract, once the protocol team calls calls the distributedCollectedFees
, the malicious user will automatically call the claimRewards
to steal the rewards.
If there are a lot malicious users keep monitoring the contract all the time, once they got a chance, they will automatically call the claimRewards
, so that the normal users can't claim rewards because the contract doesn't have enough RAACToken since it's drained by malicious user.
When most of the users notice this problem, they will simply just stop calling collectFees
and will never transfer RAACToken, which it's bad for the entire protocol.
Add to the test/unit/core/collectors/FeeCollector.test.js
in the Fee Collection and Distribution
context.
Console output:
Manual Review
Consider adding access control or reasonable minimal claim interval to claimRewards
.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.