Skip to content
Access control Audit finding Intermediate

Anyone who uses same adapter has the ability to pause it

The vault controller allowed any vault creator to pause a shared adapter, which affected all vaults using that adapter. An attacker could create a vault with the same adapter and pause it repeatedly, preventing deposits and yield earning for other vaults.

rvierdiiev Follow with bin2chen

Originally disclosed on Code4rena

Submitted by rvierdiiev, also found by bin2chen

https://github.com/code-423n4/2023-01-popcorn/blob/main/src/vault/VaultController.sol#L605-L615

https://github.com/code-423n4/2023-01-popcorn/blob/main/src/vault/adapter/abstracts/AdapterBase.sol#L575

Impact

Anyone who uses same adapter has the ability to pause it. As result you have the ability to pause any vault by creating your vault with the same adapter.

When a user creates vault, he has the ability to deploy new adapter or reuse already created adapter.

VaultController gives ability to pause adapter.

https://github.com/code-423n4/2023-01-popcorn/blob/main/src/vault/VaultController.sol#L605-L615

  function pauseAdapters(address[] calldata vaults) external {
    uint8 len = uint8(vaults.length);
    for (uint256 i = 0; i < len; i++) {
      _verifyCreatorOrOwner(vaults[i]);
      (bool success, bytes memory returnData) = adminProxy.execute(
        IVault(vaults[i]).adapter(),
        abi.encodeWithSelector(IPausable.pause.selector)
      );
      if (!success) revert UnderlyingError(returnData);
    }
  }

As you can see _verifyCreatorOrOwner is used to determine if msg.sender can pause adapter.

https://github.com/code-423n4/2023-01-popcorn/blob/main/src/vault/VaultController.sol#L667-L670

  function _verifyCreatorOrOwner(address vault) internal returns (VaultMetadata memory metadata) {
    metadata = vaultRegistry.getVault(vault);
    if (msg.sender != metadata.creator || msg.sender != owner) revert NotSubmitterNorOwner(msg.sender);
  }

So in case if you are creator of vault that uses adaptor that you want to pause, then you are able to pause it.

This is how it can be used in order to stop the vault.

  1. Someone created vault that uses adapterA.
  2. Attacker creates own vault and sets adapterA as well.
  3. Now attacker is able to pause adapterA and as result it’s not possible to deposit anymore. Also vault is not earning fees now, as pausing withdraws all from strategy.
  4. And it can pause it as many times as he wants (in case if someone else will try to unpause it).

So this attack allows to stop all vaults that use same adapter from earning yields.

Tools Used

VS Code

Recommended Mitigation Steps

I think that it’s better to create a clone of adapter for the vault, so each vault has separate adapter.

RedVeil (Popcorn) acknowledged, but disagreed with severity


The original report as published on Code4rena, by rvierdiiev. 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 pause function checked only that the caller was the creator or owner of the vault being passed in, not that the caller had any right over the shared adapter itself.

Impact

All vaults sharing the adapter could be stopped from earning yield, and the attacker could pause it repeatedly even if someone tried to unpause it.

What the attacker needed

Attacker can create a vault; target vault uses a shared adapter

The fix

The report recommends giving each vault its own clone of the adapter so that pausing one vault does not affect others.

How it was found

  1. Someone created vault that uses adapterA.
  2. Attacker creates own vault and sets adapterA as well.
  3. Now attacker is able to pause adapterA and as result it’s not possible to deposit anymore.

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 and invests money. An adapter is a helper contract that connects a vault to an investment strategy. The bug meant that anyone who made their own vault using the same adapter could press a 'pause' button that stopped the adapter for everyone, blocking deposits and stopping earnings.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by rvierdiiev

View all

72 more disclosed reports, best first.

More from Popcorn contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.