Skip to content
Business logic Audit finding Intermediate

MoneyBrinter contract does not consider farm's pausing status

The MoneyBrinter contract does not check whether the Kodiak farm is paused before staking or withdrawing, so when the farm pauses withdrawals, deposits into MoneyBrinter revert and maxDeposit returns an incorrect value. This makes the vault non-compliant with ERC-4626 and can temporarily lock funds.

trtrth Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

#42033 [SC-Insight] MoneyBrinter contract does not consider farm's pausing status

Submitted on Mar 20th 2025 at 07:26:30 UTC by @trtrth for Audit Comp | Yeet

Description

Brief/Intro

The contract MoneyBrinter does not consider Kodiak farm's pausing status for staking and withdrawals. This can cause MoneyBrinter to be incompliant with ERC-4626

Vulnerability Details

Both function depositFor() and withdrawTo() from Beradrome farm plugin contract handle withdraw locked all from Kodiak farm and continue to stake all into the farm. Here depositFor() is called by MoneyBrinter::deposit() and MoneyBrinter::mint(). The function withdrawTo()is called byMoneyBrinter::withdraw()andMoneyBrinter::redeem(). So all the core functions of MoneyBrinter` contract go through the steps Farm::withdrawLockedAll() -> Farm::stakeLocked().

Solidity
    function depositFor(address account, uint256 amount) 
        public 
        override 
    {
        super.depositFor(account, amount);
        ICommunalFarm(farm).withdrawLockedAll();
        uint256 balance = IERC20(getUnderlyingAddress()).balanceOf(address(this));
        IERC20(getUnderlyingAddress()).safeApprove(farm, 0);
        IERC20(getUnderlyingAddress()).safeApprove(farm, balance);
        ICommunalFarm(farm).stakeLocked(balance, 0);
    }

    function withdrawTo(address account, uint256 amount) 
        public 
        override 
    {
        ICommunalFarm(farm).withdrawLockedAll(); 
        super.withdrawTo(account, amount);
        uint256 balance = IERC20(getUnderlyingAddress()).balanceOf(address(this));
        IERC20(getUnderlyingAddress()).safeApprove(farm, 0);
        IERC20(getUnderlyingAddress()).safeApprove(farm, balance);
        ICommunalFarm(farm).stakeLocked(balance, 0);
    }

On the other side, the farm contract has pausing feature for the staking and withdrawals. So in case only one of these two is paused, then the core functions of MoneyBrinter contract does not work and all funds can be temporarily locked in farm contract

Solidity
    function toggleStaking() external onlyOwner {
        stakingPaused = !stakingPaused;
    }

    function toggleWithdrawals() external onlyOwner {
        withdrawalsPaused = !withdrawalsPaused;
    }

Impact Details

  • ERC-4626 incompliant
  • Contract's core functions can be unable to operate

References

Farm contract: https://bartio.beratrail.io/token/0xbdEE3F788a5efDdA1FcFe6bfe7DbbDa5690179e6/contract/code

Beradrome plugin contract: https://bartio.beratrail.io/token/0x80D7759Fa55f6a1F661D5FCBB3bC5164Dc63eb4D/contract/code

Proof of Concept

Proof of Concept

  • Modify the test test_Valid_Deposit_Into_Beradrome in test file test/vault/Vault_IntegrationTest_ZeroFee.t.sol
Solidity
    function test_Valid_Deposit_Into_Beradrome() public {
        uint256 maxYeet = 80 * token;
        uint256 maxWBera = 1 * token;

        fundYeet(alice, maxYeet);
        fundWbera(alice, maxWBera);

        (, bytes memory ret) = kodiakFarm.staticcall(abi.encodeWithSignature("owner()"));
        address owner = abi.decode(ret, (address));

        // pause withdrawals
        vm.prank(owner);
        kodiakFarm.call(abi.encodeWithSignature("toggleWithdrawals()"));
        
        (, , uint256 islandsMinted) =
            depositIntoYeetIsland(alice, maxYeet, maxWBera);


        uint maxDeposit = IERC4626(moneyBrinter).maxDeposit(alice);
        console.log('max deposit: %s', maxDeposit);

        vm.startPrank(alice);
        IERC20(yeetIsland).approve(moneyBrinter, islandsMinted);

        vm.expectRevert('Withdrawals paused');
        IERC4626(moneyBrinter).deposit(islandsMinted, alice);
    }
  • Run the test by command forge t --mt test_Valid_Deposit_Into_Beradrome -vv and the console shows
Bash
Ran 1 test for test/vault/Vault_IntegrationTest_ZeroFee.t.sol:Vault_IntegrationTest_ZeroFee
[PASS] test_Valid_Deposit_Into_Beradrome() (gas: 810185)
Logs:
  max deposit: 115792089237316195423570985008687907853269984665640564039457584007913129639935

It means that the maxDeposit() returns wrong value, and it is also impossible to deposit into the vault even when Kodiak farm only pauses withdrawals

The original report as published on Immunefi, by trtrth. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

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 MoneyBrinter contract calls the farm's withdrawLockedAll and stakeLocked functions without checking the farm's stakingPaused or withdrawalsPaused flags, so a paused farm causes reverts.

Impact

When the farm pauses only withdrawals, deposits into MoneyBrinter revert and maxDeposit returns a wrong value, so the vault is ERC-4626 non-compliant and funds can be temporarily locked.

What the attacker needed

Farm owner pauses withdrawals; user attempts deposit

How it was found

  1. Pause withdrawals on the Kodiak farm by calling toggleWithdrawals as the owner.
  2. Attempt to deposit into the MoneyBrinter vault.
  3. Observe that the deposit reverts with 'Withdrawals paused'.
  4. Check that maxDeposit returns an incorrect maximum value.

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 contract lets people put in and take out tokens. It relies on another contract, a farm, to hold those tokens. If the farm pauses only withdrawals, the vault still tries to move tokens in a way that fails, so users cannot deposit even though the vault should allow it.

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.

More by trtrth

View all

7 more disclosed reports, best first.

More from Yeet

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.