Tokens Can Be Stolen By Frontrunning VestedRewardPool.vest() and VestedRewardPool.lock()
The vest() and lock() functions in VestedRewardPool.sol do not use safeTransferFrom(), allowing an attacker to frontrun a call and steal the recipient's vested tokens.
Submitted by leastwood
Impact
The VestedRewardPool.sol contract is a public facing contract aimed at vesting tokens for a minimum of 90 days before allowing the recipient to withdraw their mochi. The vest() function does not utilise safeTransferFrom() to ensure that vested tokens are correctly allocated to the recipient. As a result, it is possible to frontrun a call to vest() and effectively steal a recipient’s vested tokens. The same issue applies to the lock() function.
Proof of Concept
Tools Used
Manual code review Discussions with the Mochi team
Recommended Mitigation Steps
Ensure that users understand that this function should not be interacted directly as this could result in lost mochi tokens. Additionally, it might be worthwhile creating a single externally facing function which calls safeTransferFrom(), vest() and lock() in a single transaction.
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 vest() and lock() functions do not use safeTransferFrom() to ensure tokens are transferred from the correct sender, allowing frontrunning.
What the attacker needed
Attacker can frontrun transactions; victim calls vest() or lock() directly
The fix
Users should not interact directly with these functions; instead, a single externally facing function should call safeTransferFrom(), vest(), and lock() in one 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.
When you call vest(), you first approve the contract to take your tokens, then call vest(). An attacker can see your approval and quickly call vest() themselves, causing your tokens to be assigned to them instead of you. This happens because the contract does not check that the tokens come from you.
What is Race condition?
Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.