Skip to content

Code4rena

Mochi contest

Every publicly disclosed report for Mochi contest and what kind of bugs they were.

disclosed reports
28
most reported class
Business logic
bug classes found
5
first disclosure
2021
Find Mochi contest on bugbounty.fyi Current scope, rewards and status, if it runs a public program.

Disclosed reports

Newest first. Only what Mochi contest chose to make public.

DoS

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.

Mochi contest

High
Business logic

Anyone can extend withdraw wait period by depositing zero collateral

The deposit function in MochiVault.sol allows anyone to deposit zero collateral into any position, which resets the last deposit timestamp and extends the withdrawal wait period. An attacker could repeatedly call this with zero amount to indefinitely lock all users out of withdrawing their collateral.

Mochi contest

High
Business logic

treasury is vulnerable to sandwich attack

A permissionless function in the treasury allowed anyone to trigger a large CRV purchase, which an attacker could sandwich with a flash loan to profit at the treasury's expense. The attacker could potentially steal all funds in the treasury.

Mochi contest

High
Business logic

Changing NFT contract in the MochiEngine would break the protocol

The MochiEngine contract allows the operator to change the NFT contract address, which would cause all vaults to point to a different NFT contract and break the protocol, making users unable to access their positions.

Mochi contest

High
Smart contracts

feePool is vulnerable to sandwich attack.

The fee pool contract has a permissionless function that distributes funds without slippage control, allowing an attacker to sandwich the distribution with a flash loan to steal the funds.

Mochi contest

High
Business logic

liquidation factor < collateral factor for Sigma type

The liquidation factor for Sigma-type assets was set lower than the collateral factor, so a user could borrow up to 45% of their collateral but be immediately liquidated because the liquidation threshold was only 40%. This could cause users to lose funds right after taking a maximum loan.

Mochi contest

Medium
Business logic

A malicious user can potentially escape liquidation by creating a dust amount position and trigger the liquidation by themself

A liquidated position can be reused for depositing and borrowing, but if a liquidation auction is already ongoing, triggering a new liquidation fails until the old auction is settled. An attacker can create a tiny position, trigger its liquidation, and then borrow a larger amount, hoping liquidators ignore the dust auction and thus fail to liquidate the real loan.

Mochi contest

Medium
Smart contracts

Unchecked ERC20 transfer calls

The DutchAuctionLiquidator contract calls ERC20 transfer without checking the return value, so a token that returns false on failure would be treated as a successful transfer. This could allow a failed transfer to be considered valid, and with USDT the transfer would always revert.

Mochi contest

Medium
Audit finding

Chainlink’s latestRoundData might return stale or incorrect results

The ChainlinkAdapter contract calls Chainlink's latestRoundData() without checking whether the returned price is stale or invalid. If Chainlink fails to start a new round or reach consensus, the contract may continue using outdated or incorrect price data.

Mochi contest

Medium
Business logic

Changing engine.nft contract breaks vaults

Governance can change the engine.nft address used by vaults, and when minting a new vault the returned ID can overwrite an existing debt position and set its status to Idle. This allows overwriting existing collateralized debt positions.

Mochi contest

Medium
Business logic

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.

Mochi contest

Medium
Smart contracts

Improper Validation Of create2 Return Value

The BeaconProxyDeployer.deploy() function checks the address returned by create2 against zero, but create2 never returns zero even on failure, so a failed deployment goes undetected. An attacker could cause a failed proxy deployment to be treated as successful, potentially leaving assets without a working vault.

Mochi contest

Medium
Business logic

MochiTreasuryV0.sol Is Unusable In Its Current State

The MochiTreasuryV0 contract attempts to lock tokens in Curve's VotingEscrow contract, but VotingEscrow does not allow contracts to call its lock functions. As a result, any attempt to lock tokens from the treasury contract will fail.

Mochi contest

Medium
Smart contracts

Liquidation will never work with non-zero discounts

The liquidation function in MochiVault.sol subtracts the passed-in debt amount from the position's stored debt, but the stored debt is discounted while the passed-in amount is not, causing an underflow. As a result, any discount profile that applies a non-zero discount will make all liquidations revert, preventing collateral from being liquidated.

Mochi contest

High
DoS

UniswapV2/SushiwapLPAdapter update the wrong token

The update function in the UniswapV2/Sushiswap LP adapter incorrectly calls the router's update with the LP token itself instead of the underlying token, causing infinite recursion and gas exhaustion. An attacker could trigger this function to cause a denial of service.

Mochi contest

Medium
Business logic

Debt accrual is path-dependant and inaccurate

The total debt in the vault is updated by subtracting only the calling user's discounted debt, making the total debt path-dependent on which user triggers the accrual. An attacker could exploit this to cause the total debt to be lower or higher than it should be, potentially leading to incorrect interest calculations and financial discrepancies.

Mochi contest

Medium
Business logic

registerAsset() can overwrite _assetClass value

The registerAsset() function in MochiProfileV0.sol allows anyone to reset the asset class of an already registered asset to AssetClass.Sigma, provided sufficient liquidity. This changes several risk parameters and could lead to unintended liquidations.

Mochi contest

High
Business logic

debts calculation is not accurate

The global debt variable is increased by the borrowed amount excluding the fee, but decreased by the amount including the fee, making the debt tracking inaccurate. This causes all calculations that rely on this variable to be slightly off.

Mochi contest

High
Business logic

Referrer can drain ReferralFeePoolV0

The claimRewardAsMochi function did not reduce the user's reward balance after a claim, allowing a referrer to repeatedly claim the same reward and drain the fee pool.

Mochi contest

High
Business logic

treasuryShare is Overwritten in FeePoolV0._shareMochi()

The FeePoolV0 contract overwrites treasuryShare when distributeMochi() is called, allowing veCRV holders to repeatedly distribute mochi tokens and eventually receive all tokens intended for the treasury.

Mochi contest

High
Business logic

regerralFeePool is vulnerable to MEV searcher

The claimRewardAsMochi function in ReferralFeePoolV0 swaps and transfers assets without any slippage limit, so the amount received is not protected. An attacker could sandwich the transaction and take value from the user's reward claim.

Mochi contest

Medium
Business logic

Vault fails to track debt correctly that leads to bad debt

The vault contract records a borrower's debt including a 0.5 percent fee but adds only the raw borrowed amount to the contract's total debt counter. This makes the contract's debt figure lower than the sum of user debts, so a repayment can drive the counter to zero and later liquidations revert, leaving bad debt.

Mochi contest

High
Business logic

UniswapV2TokenAdapter does not support Sushiswap-only assets

The UniswapV2TokenAdapter's supports function only checks UniswapV2 liquidity and returns false if it is below the minimum, without checking Sushiswap liquidity. An attacker could create a UniswapV2 pool with no liquidity for a Sushiswap-only asset, causing the adapter to reject it even though Sushiswap has sufficient liquidity.

Mochi contest

Medium
Business logic

borrow function will borrow max cf when trying to borrow > cf

The borrow function in MochiVault does not revert when a user tries to borrow more than the maximum collateral factor allows; instead it borrows up to the maximum. This could lead a user to borrow at a dangerous collateral level and receive less than requested.

Mochi contest

Medium
Access control

anyone can create a vault by directly calling the factory

The vault factory contract lacked permission control, allowing anyone to deploy a vault. This could cause the government's attempt to register the asset to revert, and the protocol would still recognise the unauthorised vault as valid.

Mochi contest

Medium