57786 sc high malicious users can frontrun staking distributerewards to claim majority of rewards
Submitted on Oct 28th 2025 at 21:15:40 UTC by @Josh4324 for Audit Comp | Belong
Report ID: #57786
Report Type: Smart Contract
Report severity: High
Target: https://github.com/immunefi-team/audit-comp-belong/blob/main/contracts/v2/periphery/Staking.sol
Impacts:
Theft of unclaimed yield
Description
Brief / Intro
The Staking contract's distributeRewards function is vulnerable to a frontrunning attack. A malicious user with access to large deposits can monitor the mempool for pending reward distributions, frontrun by depositing a substantial amount of LONG tokens to mint shares at the pre-reward rate, and then capture a disproportionate share of the rewards upon distribution.
This dilutes rewards for existing stakers and allows the attacker to profit by withdrawing post-rebase. The issue arises from the lack of protections against sudden share inflation before rewards.
Vulnerability Details
The vulnerable function:
function distributeRewards(uint256 amount) external onlyOwner {
if (amount == 0) revert ZeroReward();
LONG.safeTransferFrom(msg.sender, address(this), amount);
emit RewardsDistributed(amount);
}distributeRewards(uint256 amount) adds rewards by transferring LONG into the vault, increasing totalAssets() without minting new shares, which rebases the asset-per-share rate upward for existing holders.
There is no protection against frontrunning: an attacker can deposit a large amount just before the reward tx confirms, minting shares at the lower pre-reward rate, and then benefit from the rebase on their inflated share count. Upon withdrawal, the attacker realizes gains proportional to their temporary dominance in total shares, effectively stealing from legitimate stakers.
Attack Vector
Conditions for Exploitation
Pending
distributeRewardstx visible in mempool.Attacker has access to large LONG liquidity (e.g., flash loans).
Attacker may have to wait minStakePeriod if required, but profit can still exceed delay.
Impact Details
Attackers can steal expected yield from long-term stakers by capturing a disproportionate share of each distribution through frontrunning deposits.
References
https://github.com/immunefi-team/audit-comp-belong/blob/main/contracts/v2/periphery/Staking.sol#L156
Proof of Concept
Run the provided test in test/v2/platform/file.test.ts. Example test (Hardhat):
To run:
yarn test test/v2/platform/file.test.ts
Was this helpful?