AuraVault::claim
reward calculation does not deduct fees from reward amount, causing DoS or extra rewards lost
#401
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
H-01
primary issue
Highest quality submission among a set of duplicates
🤖_primary
AI based primary recommendation
🤖_120_group
AI based duplicate group recommendation
satisfactory
satisfies C4 submission criteria; eligible for awards
selected for report
This submission will be included/highlighted in the audit report
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-07-loopfi/blob/main/src/vendor/AuraVault.sol#L275-L310
Vulnerability details
Impact
AuraVault::claim
allows users to claim rewards corresponding to the amount ofWETH
they are depositing in the same call.Prior to sending rewards to
msg.sender
, a percentage of the rewards is sent to thevault locker rewards
. However, the percentage of the rewards sent to thevault locker rewards
is not deducted from the amount that is sent to the caller. The entirereward amount
is sent tomsg.sender
.This is problematic, as it creates two possible scenarios:
Therefore, the impact ranges from
stolen funds
toDenial of Service
.Proof of Concept
As users interact with the
AuraVault
contract, the contract will accumulate rewards through interaction with an external rewards contract, which acts as an ERC-4626 vault.Users can deposit, withdraw, redeem, and claim rewards:
AuraVault.sol#L275-L310
Firstly, rewards are claimed from the
Aura reward pool
, proceeded by a call to_previewReward()
to calculate the amount ofWETH
the caller must deposit to receive the amount of rewards they have specified.The issue is with the transferring of rewards. We can see the
vault locker rewards
receives a percentage of the rewards, calculated by(amounts[0] * _config.lockerIncentive) / INCENTIVE_BASIS)
.However, the entire amount of rewards is still sent to the caller, without accounting for the percentage that was just sent to the
vault locker rewards
. Therefore, this call is sending extra rewards to the caller.As mentioned, this leads to two scenarios:
Consider the following scenario:
WETH
and claimBAL
andAURA
rewards via a call toAuraVault::claim
._config.lockerIncentive
is set to 1000 andINCENTIVE_BASIS
is set to 10000, effectively setting the fee portion to 10%.amounts[0] = 100e18 BAL
andamount[1] = 100e18 AURA
.IPool(rewardPool).getReward();
is called, setting the rewards held in theAuraVault
contract to100e18 BAL
and100e18 AURA
.IERC20(BAL).safeTransfer(_config.lockerRewards, (amounts[0] * _config.lockerIncentive) / INCENTIVE_BASIS);
call sends100e18 * 1000 / 10000 = 10e18
BAL
tokens to_config.lockerRewards
, which is thevault locker rewards
.AuraVault
contract now holds90e18 BAL
and100e18 AURA
.IERC20(BAL).safeTransfer(msg.sender, amounts[0]);
attempts to send100e18 BAL
tomsg.sender
, however10e18
was already sent tolocker rewards
, so this call will DoS due to insufficient funds.The call will revert in the case described above, and Alice would have to specify a lower amount of rewards (i.e, 50e18 BAL and AURA), but we can see that the contract will still send more rewards than intended, effectively stealing rewards from others.
Tools Used
Manual review, foundry
Recommended Mitigation Steps
Ensure the amount sent to the locker is deducted from the amount sent to the caller:
Assessed type
Error
The text was updated successfully, but these errors were encountered: