Rewards compounded in AaveStrategy are unredeemable
The AaveStrategy contract's compound function claims AAVE rewards but does not redeem them from the staking contract, so the rewards remain staked and cannot be accessed. An attacker cannot directly exploit this, but the protocol loses the compounded rewards.
Ack Follow with kaden and rvierdiiev
Originally disclosed on Code4rena
Submitted by Ack, also found by kaden and rvierdiiev
The AaveStrategy contract is designed to:
- Receive depositor’s ERC20 tokens from yieldBox
- Deposit those tokens into an AAVE lending pool
- Allow anyone to call
compound(), which: a. Claims AAVE rewards from theincentivesControllerb. Claims staking rewards from thestakingRewardToken(stkAAVE) c. Redeeming staking rewards is only possible within a certain cooldown window that is set by AAVE governance. The function resets the cooldown if either 12 days have passed since the cooldown was last initiated, or if the strategy has a stakedRewardToken balance d. Swaps any receivedrewardToken($AAVE) forwrappedNativee. Deposits thewrappedNativereceived in the swap into the lending pool
There are several issues with this flow, but this vulnerability report is specific to redeeming staked rewards. The incentives controller specified in the mainnet.env file is at address 0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5 (proxy). Its claimRewards function stakes tokens directly:
function _claimRewards(
...
) internal returns (uint256) {
...
uint256 accruedRewards = _claimRewards(user, userState);
...
STAKE_TOKEN.stake(to, amountToClaim); //@audit claimed rewards are staked immediately
...
}
The only way to retrieve tokens once staked is via a call to stakingRewardToken#redeem(), which is not present in the AaveStrategy contract. As a result, any rewards accumulated via the incentiveController would not be claimable.
Impact
High - Loss of funds
Proof of concept
This is unfortunately difficult to PoC as the AAVE incentive/staking rewards do not accumulate properly in the fork tests, and the mocks do not exhibit the same behavior.
Recommended Mitigation Steps
Include a call to redeem in compound().
0xRektora (Tapioca) confirmed via duplicate issue 243
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
Impact
The rewards accumulated via the incentive controller are not claimable, leading to a loss of funds for the protocol.
What the attacker needed
None
The fix
The compound function should include a call to redeem the staked rewards.
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.
When the strategy earns rewards, those rewards are automatically locked in a staking contract. To get them back, you must call a special function to redeem them. The strategy never calls that function, so the rewards stay stuck forever.
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.