Skip to content
Business logic Audit finding Beginner

Pause checks are missing on deposit for Private Vault

The private vault's deposit function lacks the pause and shutdown checks that the public vault enforces, so deposits can still be made after the vault is shut down. An attacker who is on the allowlist could deposit funds into a vault that should no longer accept them.

Anurag Jain Follow with 0xbepresent

Originally disclosed on Code4rena

Submitted by csanuragjain, also found by 0xbepresent

It is possible to make a deposit even when _loadVISlot().isShutdown is true. This check is done in whenNotPaused modifier and is already done for Public Vault but is missing for Private Vault, allowing unexpected deposits.

Proof of Concept

  1. Observe the deposit function at https://github.com/code-423n4/2023-01-astaria/blob/main/src/Vault.sol#L59
    function deposit(uint256 amount, address receiver)
        public
        virtual
        returns (uint256)
      {
        VIData storage s = _loadVISlot();
        require(s.allowList[msg.sender] && receiver == owner());
        ERC20(asset()).safeTransferFrom(msg.sender, address(this), amount);
        return amount;
      }
  1. Observe there is no whenNotPaused modifier in deposit which confirm that shutdown has not been called yet
    modifier whenNotPaused() {
        if (ROUTER().paused()) {
          revert InvalidRequest(InvalidRequestReason.PAUSED);
        }

        if (_loadVISlot().isShutdown) {
          revert InvalidRequest(InvalidRequestReason.SHUTDOWN);
        }
        _;
      }

Recommended Mitigation Steps

Revise the deposit function as below:

function deposit(uint256 amount, address receiver)
    public
    virtual
    whenNotPaused
    returns (uint256)
  {
    VIData storage s = _loadVISlot();
    require(s.allowList[msg.sender] && receiver == owner());
    ERC20(asset()).safeTransferFrom(msg.sender, address(this), amount);
    return amount;
  }

Picodes (judge) commented:

It makes sense though considering it’s a private vault so only the owner can deposit.

SantiagoGregory (Astaria) confirmed


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

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 private vault's deposit function is missing the whenNotPaused modifier that checks the router pause flag and the vault's isShutdown flag.

Impact

Deposits could still be accepted after shutdown, though the judge noted the private vault only allows the owner to deposit, limiting who is affected.

What the attacker needed

Caller is on the vault allowlist; receiver is the vault owner; vault is shut down or router paused

The fix

The deposit function should be fixed by adding the whenNotPaused modifier so it reverts when the router is paused or the vault is shut down.

How it was found

  1. Look at the deposit function in Vault.sol.
  2. Notice it has no whenNotPaused modifier, unlike the public vault.
  3. Call deposit while the vault is shut down; the transfer succeeds.

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 is a smart contract that holds money. The team added a 'paused' or 'shut down' switch to stop deposits in an emergency. The private vault's deposit function forgot to check that switch, so money could still go in after shutdown.

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 Anurag Jain

View all

63 more disclosed reports, best first.

More from Astaria contest

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.