quitPeriod is effectively always just 1 day
The vault's quit period, meant to give users time to exit before fee or adapter changes, can be shortened by the owner after a change is proposed. An owner can propose a change, wait one day, reduce the quit period to one day, and then apply the change immediately, denying users the expected waiting time.
immeas Follow with eccentricexit, ayeslick and 4 others
Originally disclosed on Code4rena
Submitted by immeas, also found by eccentricexit, ayeslick, 0xBeirao, Nyx, chaduke, and fyvgsk
The quitPeriod is supposed to give users time to rage quit if there are changes they don’t agree with. The quit period is limited to be within 1 day and a week and can only be changed by owner:
File: Vault.sol
629: function setQuitPeriod(uint256 _quitPeriod) external onlyOwner {
630: if (_quitPeriod < 1 days || _quitPeriod > 7 days)
631: revert InvalidQuitPeriod();
632:
633: quitPeriod = _quitPeriod;
634:
635: emit QuitPeriodSet(quitPeriod);
636: }
However the change can be done instantly. An owner can propose a change, users will expect to wait three days for it to be applied, and after one day change the quitPeriod to 1 day and apply the changes.
Impact
Changes to fees and adapters can happen faster than users expect not giving them time enough to react.
Proof of Concept
Small PoC in Vault.t.sol:
function test__set_fees_after_1_day() public {
vault.proposeFees(
VaultFees({
deposit: 1e17,
withdrawal: 1e17,
management: 1e17,
performance: 1e17
})
);
// users expect to have three days
console.log("quit period",vault.quitPeriod());
// jump 1 day
vm.warp(block.timestamp + 1 days);
// owner changes quit period
vault.setQuitPeriod(1 days);
// and does the changes
vault.changeFees();
}
Tools Used
VS Code, Forge
Recommended Mitigation Steps
Either lock quitPeriod changes for the old quitPeriod.
Or apply the duration when the change is proposed:
diff --git a/src/vault/Vault.sol b/src/vault/Vault.sol
index 7a8f941..bccc561 100644
--- a/src/vault/Vault.sol
+++ b/src/vault/Vault.sol
@@ -531,14 +531,14 @@ contract Vault is
) revert InvalidVaultFees();
proposedFees = newFees;
- proposedFeeTime = block.timestamp;
+ proposedFeeTime = block.timestamp + quitPeriod;
emit NewFeesProposed(newFees, block.timestamp);
}
/// @notice Change fees to the previously proposed fees after the quit period has passed.
function changeFees() external {
- if (block.timestamp < proposedFeeTime + quitPeriod)
+ if (block.timestamp < proposedFeeTime)
revert NotPassedQuitPeriod(quitPeriod);
emit ChangedFees(fees, proposedFees);
Same applies for changeAdapter.
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 quit period used to delay a proposed change is read at execution time rather than being fixed when the change is proposed, so the owner can reduce it before the change takes effect.
Impact
Fee and adapter changes can happen faster than users expect, giving them less time to react and exit.
What the attacker needed
Owner privileges; a proposed fee or adapter change
The fix
The quit period should be locked when a change is proposed, or the deadline should be computed at proposal time so later changes to the quit period do not shorten it.
How it was found
- The owner proposes new fees.
- The owner waits one day.
- The owner sets the quit period to one day.
- The owner calls changeFees to apply the new fees.
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 lets users deposit money, and the owner can change fees. To be fair, changes are announced in advance so users can leave if they disagree. But the owner can shorten that warning period after announcing a change, so users get much less notice than they thought.
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.