Drainage of the LEND token reserves through repeated claims of the same rewards
The claimLend() function transferred accrued LEND rewards to users but never reset the stored accrued balance, so the same rewards could be claimed repeatedly. An attacker could drain the protocol's LEND token reserves and prevent other users from claiming their rewards.
0x23r0 Follow with 0xAlix2, 0xMakSecur and 42 others
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2025-05-lend-audit-contest-judging/issues/148
Found by
0x23r0, 0xAlix2, 0xMakSecur, 0xNForcer, 0xgh0st, 37H3RN17Y2, Allen_George08, Audinarey, Brene, Drynooo, Etherking, HeckerTrieuTien, Kirkeelee, Kvar, Lamsya, MRXSNOWDEN, PNS, SafetyBytes, Sneks, Tigerfrake, Z3R0, algiz, benjamin_0923, bigbear1229, dmdg321, dreamcoder, durov, future, ggg_ttt_hhh, h2134, hgrano, jokr, mahdifa, momentum, newspacexyz, patitonar, t.aksoy, velev, wickie, xiaoming90, yaioxy, ydlee, zacwilliamson, zraxx, zxriptor
Summary
The claimLend() function in CoreRouter allows perpetual granting of LEND tokens because lendStorage.lendAccrued is never reset after successful grants, enabling users to claim the same rewards multiple times.
Root Cause
In the claimLend() function, the protocol calls grantLendInternal() to transfer LEND tokens to users but fails to reset the accrued balance afterwards:
for (uint256 j = 0; j < holders.length;) {
uint256 accrued = lendStorage.lendAccrued(holders[j]);
if (accrued > 0) {
grantLendInternal(holders[j], accrued);
}
unchecked {
++j;
}
}
The grantLendInternal() function successfully transfers tokens but returns the remaining amount (0 if successful), which is ignored. This means lendStorage.lendAccrued[holders[j]] retains its value and can be claimed again.
In contrast, Compound's correct implementation resets the accrued balance after granting:
lendAccrued[holders[j]] = grantLendInternal(holders[j], lendAccrued[holders[j]]);
Internal Pre-conditions
None
External Pre-conditions
None
Attack Path
- User supplies tokens to the protocol and accrues LEND rewards
- User calls
claimLend()to receive their accrued LEND tokens - The function transfers the tokens but doesn't reset
lendStorage.lendAccrued[user] - User can immediately call
claimLend()again to receive the same rewards - The process can be repeated until the protocol's LEND balance is drained
Impact
Complete drainage of the protocol's LEND token reserves through repeated claims of the same rewards. Users can exploit this to receive unlimited LEND tokens, far exceeding their legitimate rewards, which can lead to protocol insolvency and prevent other users from claiming their rightful rewards.
PoC
No response
Mitigation
Update the claimLend() function to reset the accrued balance after successful grants properly:
for (uint256 j = 0; j < holders.length;) {
uint256 accrued = lendStorage.lendAccrued(holders[j]);
if (accrued > 0) {
uint256 remaining = grantLendInternal(holders[j], accrued);
lendStorage.updateLendAccrued(holders[j], remaining);
}
unchecked {
++j;
}
}
This requires adding an updateLendAccrued() function to LendStorage to allow authorized contracts to update accrued balances.
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 claim loop ignores the return value of grantLendInternal() and never writes the remaining (zero) balance back to lendStorage.lendAccrued, unlike Compound's implementation which assigns the result back.
Impact
The protocol's LEND token reserves could be completely drained through repeated claims, potentially causing insolvency and preventing other users from claiming their rightful rewards.
What the attacker needed
A user position accruing LEND rewards; ability to call claimLend() repeatedly
The fix
The claim loop should capture the remaining amount returned by grantLendInternal() and write it back to the user's accrued balance via a new authorised update function in LendStorage.
How it was found
- A user supplies tokens to the protocol and accrues LEND rewards
- The user calls claimLend() to receive the accrued LEND tokens
- The function transfers the tokens but does not reset the stored accrued balance
- The user calls claimLend() again to receive the same rewards
- The process is repeated until the protocol's LEND balance is drained
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 how many reward tokens each user has earned. When a user asks for those rewards, the contract pays them out but forgets to set the record back to zero, so the user can ask again and be paid the same amount over and over. This empties the pool of reward tokens that other users were supposed to receive.
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.