ReferralFeePoolV0.sol#claimRewardAsMochi() Array out of bound exception
The claimRewardAsMochi function creates a fixed-size array of length two but then writes to a third index, which throws an out-of-bounds exception and reverts the transaction. As a result, referral fees can never be claimed and stay stuck in the contract.
Submitted by WatchPug, also found by pauliax
function claimRewardAsMochi() external {
IUSDM usdm = engine.usdm();
address[] memory path = new address[](2);
path[0] = address(usdm);
path[1] = uniswapRouter.WETH();
path[2] = address(engine.mochi());
usdm.approve(address(uniswapRouter), reward[msg.sender]);
// we are going to ingore the slippages here
uniswapRouter.swapExactTokensForTokens(
reward[msg.sender],
1,
path,
address(this),
type(uint256).max
);
In ReferralFeePoolV0.sol#claimRewardAsMochi(), path is defined as an array of length 2 while it should be length 3.
As a result, at L33, an out-of-bound exception will be thrown and revert the transaction.
Impact
claimRewardAsMochi() will not work as expected so that all the referral fees cannot be claimed but stuck in the 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
Root cause
The array was declared with length two but the code assigns three entries, so the third write is out of bounds.
Impact
The claim function always reverts, so all referral fees cannot be claimed and remain stuck in the contract.
What the attacker needed
None
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 function builds a short list with room for only two items, then tries to put a third item into it. The programming language stops this and cancels the whole action, so users can never collect the referral rewards they earned and the money stays locked in the contract.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.