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
- 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;
}
- Observe there is no
whenNotPausedmodifier 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;
}
It makes sense though considering it’s a private vault so only the owner can deposit.
SantiagoGregory (Astaria) confirmed
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
- Look at the deposit function in Vault.sol.
- Notice it has no whenNotPaused modifier, unlike the public vault.
- 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.