There is no way for the `admin` to sweep `rewards` lost due to precision
When reward tokens are streamed, integer division when computing the reward rate leaves small amounts of tokens stranded in the contract. Because no sweep function exists, those leftover tokens can never be recovered by the admin.
0xShoonya Follow with BADROBINX, ExtraCaterpillar and 9 others
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2025-08-usg-tangent-judging/issues/432
This issue has been acknowledged by the team but won't be fixed at this time.
Found by
0xShoonya, BADROBINX, ExtraCaterpillar, Obsidian, Pianist, VictorUbi, ami, joicygiore, silver_eth, v1c7, wickie, yaioxy
Summary
When Rewards are being distributed, Precision will take place, and when it does, those tokens will be stuck in that contract with no way of being recovered, since there is no function to get them back
Root Cause
The contract has no function to recover tokens lost due to precision.
Attack Path
VsTAN::processRewardsis called by the owner and adding 10000USG- Resulting in
165 343 915 343 915rewardRate. - As this will go on for 7 days, which means per Second'
16 534 391 534 391 534is given. - Let's say there was only
1e18supply and no update rewards have not been called for 7 days for simplicity, which calculates this
(((_lastTimeRewardApplicable(rewardData[_rewardToken].periodFinish) - rewardData[_rewardToken].lastUpdateTime) * rewardData[_rewardToken].rewardRate * 1e18) /
totalSupplyVsTan)
((((block.timestamp) - ((block.timestamp - 7 days))) * 16534391534391534) * 1e18 /
1e18)
- Answer: 9999999999999999763200.. Loss = 236 800
- Now this precision value gets bigger when it comes to low decimal tokens like USDC, which would cause
rewardRateto be16 534. - The loss for 6 decimal token is = 236 800.. which in 5 cycles is more than $1.. Also happens in
AccumulatorReward - With
RewardAccumulatorholding all rewards and updating of rewards, precision will happen, but those tokens won't be able to get recovered
Code
<details> <summary>Click to Show</summary>if (block.timestamp >= rData.periodFinish) {
rData.rewardRate = rewardAmountStreamed / REWARDS_DURATION;
} else {
rData.rewardRate = (rewardAmountStreamed + (rData.periodFinish - block.timestamp) * rData.rewardRate) / REWARDS_DURATION;
}
if (timestamp >= rData.periodFinish) {
rewardData[rewardToken].rewardRate = amount / ONE_WEEK;
} else {
uint256 leftover = (rData.periodFinish - timestamp) * rData.rewardRate;
rewardData[rewardToken].rewardRate = (amount + leftover) / ONE_WEEK;
}
Impact
The funds lost to precision cannot be recovered
Recommendation
Add a function that would be able to sweep Reward Tokens stuck in a contract
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
Small amounts of reward tokens are permanently stranded in the contract, and the loss grows with low-decimal tokens and repeated cycles.
What the attacker needed
Owner distributes rewards; reward amount not divisible evenly
The fix
A sweep function should be added so the admin can recover reward tokens left in the contract.
How it was found
- The owner calls the reward processing function and adds a reward amount.
- The contract divides the amount by the reward duration to get a per-second reward rate.
- The division truncates, so the total streamed is slightly less than the amount added.
- The difference stays in the contract with no function to withdraw it.
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 often splits a pot of tokens across many seconds by dividing the total by the duration. Whole-number maths throws away the remainder, so a tiny amount of tokens stays in the contract. Here nothing lets the owner withdraw that leftover, so it is 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.