Incentive Creator's Tokens Permanently Locked in Zero-Activity Epochs
The DebitaIncentives contract lacks a mechanism to recover incentive tokens deposited for a future epoch if no lending or borrowing activity occurs during that epoch. As a result, incentive creators permanently lose their tokens, which remain locked in the contract.
0x37 Follow with BengalCatBalu, KaplanLabs and 6 others
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2024-10-debita-judging/issues/616
The protocol has acknowledged this issue.
Found by
0x37, BengalCatBalu, KaplanLabs, dimulski, h4rs0n, jo13, newspacexyz, t.aksoy, xiaoming90
Summary
The lack of token recovery mechanism in DebitaIncentives.sol will cause permanent loss of incentive tokens for incentive creators as tokens remain locked in the contract during epochs with zero lending/borrowing activity.
Root Cause
In DebitaIncentives.sol, the incentivizePair function transfers tokens to the contract without any recovery mechanism:
// transfer the tokens
IERC20(incentivizeToken).transferFrom(
msg.sender,
address(this),
amount
);
// add the amount to the total amount of incentives
if (lendIncentivize[i]) {
lentIncentivesPerTokenPerEpoch[principle][
hashVariables(incentivizeToken, epoch)
] += amount;
} else {
borrowedIncentivesPerTokenPerEpoch[principle][
hashVariables(incentivizeToken, epoch)
] += amount;
}
This means that incentive creators can only deposit incentives for epochs that haven't started yet, and the incentives are locked in the contract until the epoch ends. Once tokens are transferred, they become permanently locked if no activity occurs in that epoch. This is a serious design flaw since market conditions are unpredictable and zero-activity epochs are likely to occur.
Internal pre-conditions
- Incentive creator needs to call
incentivizePair()to deposit incentive tokens for a future epoch totalUsedTokenPerEpoch[principle][epoch]needs to be exactly 0- No users perform any lending or borrowing actions during the specified epoch
External pre-conditions
- Market conditions lead to zero lending/borrowing activity during the incentivized epoch
Attack Path
- Incentive creator calls
incentivizePair()to set up incentives for a future epoch, transferring tokens to the contract - The epoch passes with no lending or borrowing activity
- No users can claim the incentives as there are no qualifying actions (
lentAmountPerUserPerEpochandborrowAmountPerEpochremain 0) - The tokens remain permanently locked in the contract as there is no withdrawal or recovery mechanism
Impact
The incentive creators suffer a complete loss of their deposited tokens for that epoch. The tokens become permanently locked in the contract with no mechanism for recovery or redistribution to future epochs. This could lead to significant financial losses.
PoC
No response
Mitigation
Add a recovery mechanism that allows incentive creators to withdraw unclaimed tokens after an epoch ends. This should only be possible if the epoch had zero activity.
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 incentivizePair function transfers tokens into the contract without any mechanism to recover them if the epoch ends with zero activity.
Impact
Incentive creators suffer a complete loss of their deposited tokens for that epoch, which could lead to significant financial losses.
What the attacker needed
Incentive creator deposits tokens for future epoch; No lending or borrowing activity in that epoch
The fix
A recovery mechanism should be added to allow incentive creators to withdraw unclaimed tokens after an epoch ends, but only if the epoch had zero activity.
How it was found
- Incentive creator calls incentivizePair() to deposit tokens for a future epoch.
- The epoch passes with no lending or borrowing activity.
- No users can claim the incentives because there are no qualifying actions.
- The tokens remain permanently locked in the contract.
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.
In this smart contract, people can add tokens as rewards to encourage others to lend or borrow. But if nobody does any lending or borrowing during the reward period, the tokens get stuck forever because there is no way to take them back. This means the person who added the rewards loses their tokens.
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.