Transfer to treasury can register as succeeded when failing in _calcRewardIntegral
The reward calculation function does not check the return value of a token transfer to the treasury, so if the transfer fails silently the contract still updates accounting as if it succeeded. This can cause accounting discrepancies that may be exploited if the reward token does not revert on failed transfers.
Submitted by 0xw4rd3n
If the transfer of the reward token fails to the treasury (due to insufficient funds for example), the function _calcRewardIntegral will still update accounting and cause devastating accounting discrepancies in the contract.
Proof of Concept
Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.
Recommended Mitigation Steps
require(IERC20(reward.token).transfer(treasury, d_reward / 5), "ERROR_MESSAGE");
Alex the Entreprenerd (judge) decreased severity to Medium and commented:
All in all this report is the classic “No safeApprove”. But with an actual idea of a POC. Ultimately the risk is contingent on the specific reward.token being a nonRevertingOnError.
For that reason, I believe Medium Severity to be more appropriate.
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
Likely the contract calls the token's transfer function without verifying its boolean return value, so a failed transfer is not detected.
Impact
If the reward token does not revert on failed transfers, the contract's accounting can become inconsistent, potentially allowing an attacker to exploit the discrepancy; the judge noted the risk depends on the token's behaviour.
What the attacker needed
Reward token does not revert on failure
The fix
The transfer should be wrapped in a require statement that checks its return value, so a failed transfer reverts the transaction.
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.
Some tokens report failure by returning false instead of stopping the program with an error. If the code ignores that false value, it may think a payment went through when it did not, leading to wrong balances. This report points out that the staking contract does not check the result of a transfer to the treasury.
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.