griefing attack to block withdraws
The vault contract sets a last-deposit timestamp on every deposit, and the wait modifier prevents withdrawals for a delay period after that timestamp. An attacker can repeatedly deposit tiny amounts to keep resetting the timestamp, thereby blocking the NFT owner from ever withdrawing their funds.
Submitted by gpersoon
Impact
Every time you deposit some assets in the vault (via deposit() of MochiVault.sol) then “lastDeposit[_id]” is set to block.timestamp. The modifier wait() checks this value and makes sure you cannot withdraw for ”delay()” blocks. The default value for delay() is 3 minutes.
Knowing this delay you can do a griefing attack: On chains with low gas fees: every 3 minutes deposit a tiny amount for a specific NFT-id (which has a large amount of assets). On chains with high gas fees: monitor the mempool for a withdraw() transaction and frontrun it with a deposit()
This way the owner of the NFT-id can never withdraw the funds.
Proof of Concept
Recommended Mitigation Steps
Create a mechanism where you only block the withdraw of recently deposited funds
Will update deposit function to allow only NFT owner to deposit
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 deposit function allows anyone to deposit for any NFT-id, and each deposit resets the withdrawal delay for that NFT-id, so an attacker can keep the delay active indefinitely.
Impact
The owner of the NFT-id can never withdraw the funds, as the delay is continuously reset by the attacker's deposits.
What the attacker needed
Access to the deposit function; knowledge of an NFT-id with assets; low gas fees or mempool access
The fix
The deposit function should be updated to allow only the NFT owner to deposit, as confirmed by the project.
How it was found
- Identify an NFT-id with a large amount of assets in the vault.
- On low-gas chains, deposit a tiny amount for that NFT-id every 3 minutes.
- On high-gas chains, monitor the mempool for a withdraw transaction and frontrun it with a deposit.
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 vault lets you deposit and withdraw assets. To stop people from quickly depositing and withdrawing, it makes you wait a few minutes after each deposit before you can withdraw. But anyone can deposit a tiny amount to someone else's vault, which resets that waiting timer. By doing this repeatedly, an attacker can keep the timer from ever finishing, so the real owner can never withdraw.
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.