Every operator is unexpectedly DOS'ed from staking to a DSS and possible leveraging for at least 9 days #19
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
grade-a
insufficient quality report
This report is not of sufficient quality
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
🤖_20_group
AI based duplicate group recommendation
Lines of code
https://github.com/code-423n4/2024-07-karak/blob/53eb78ebda718d752023db4faff4ab1567327db4/src/Core.sol#L146-L153
https://github.com/code-423n4/2024-07-karak/blob/d19a4de35bcaf31ccec8bccd36e2d26594d05aad/src/entities/Operator.sol#L111-L133
https://github.com/code-423n4/2024-07-karak/blob/d19a4de35bcaf31ccec8bccd36e2d26594d05aad/src/entities/Operator.sol#L89-L101
https://github.com/code-423n4/2024-07-karak/blob/53eb78ebda718d752023db4faff4ab1567327db4/src/Vault.sol#L78-L119
https://github.com/code-423n4/2024-07-karak/blob/d19a4de35bcaf31ccec8bccd36e2d26594d05aad/src/entities/VaultLib.sol#L24-L38
Vulnerability details
Impact
The following
Core.finalizeUpdateVaultStakeInDSS
function calls theOperator.validateAndUpdateVaultStakeInDSS
function. Because theOperator.validateAndUpdateVaultStakeInDSS
function calls theOperator.validateQueuedStakeUpdate
function, which reverts ifqueuedStakeUpdate.startTimestamp + Constants.MIN_STAKE_UPDATE_DELAY > block.timestamp
is true, the operator is subject to theMIN_STAKE_UPDATE_DELAY
for both the DSS allocation and DSS unallocation. Yet, according to https://github.com/code-423n4/2024-07-karak?tab=readme-ov-file#operators,The Operator is subject to a ``MIN_STAKE_UPDATE_DELAY`` of 9 days to prevent front-running a slashing event
only forDSS Unallocation
; thus, the operator should be allowed to allocate its funds to the DSS without waiting for theMIN_STAKE_UPDATE_DELAY
. As a result, every operator is unexpectedly DOS'ed from staking to a DSS and possible leveraging for at least 9 days.https://github.com/code-423n4/2024-07-karak/blob/53eb78ebda718d752023db4faff4ab1567327db4/src/Core.sol#L146-L153
https://github.com/code-423n4/2024-07-karak/blob/d19a4de35bcaf31ccec8bccd36e2d26594d05aad/src/entities/Operator.sol#L111-L133
https://github.com/code-423n4/2024-07-karak/blob/d19a4de35bcaf31ccec8bccd36e2d26594d05aad/src/entities/Operator.sol#L89-L101
Moreover, as a comparison, the deposits into a vault are not subject to the
MIN_WITHDRAW_DELAY
of 9 days as shown by theVault
contract'sdeposit
andmint
functions, and only the withdrawals from a vault are subject to suchMIN_WITHDRAW_DELAY
based on theVaultLib.validateQueuedWithdrawal
function but each operator must always wait for theMIN_STAKE_UPDATE_DELAY
of 9 days no matter it allocates its funds to or unallocates its funds from a DSS.https://github.com/code-423n4/2024-07-karak/blob/53eb78ebda718d752023db4faff4ab1567327db4/src/Vault.sol#L78-L119
https://github.com/code-423n4/2024-07-karak/blob/d19a4de35bcaf31ccec8bccd36e2d26594d05aad/src/entities/VaultLib.sol#L24-L38
Proof of Concept
The following steps can occur for the described scenario.
Core.requestUpdateVaultStakeInDSS
function for multiple times for staking one of its vaults to multiple DSSes.Core.requestUpdateVaultStakeInDSS
transactions are executed, the operator starts to call theCore.finalizeUpdateVaultStakeInDSS
function for finalizing its DSS allocation requests so it can perform leveraging soon.Core.requestUpdateVaultStakeInDSS
transaction reverts because theMIN_STAKE_UPDATE_DELAY
of 9 days is not passed yet even though the operator's DSS allocation should not be subject to suchMIN_STAKE_UPDATE_DELAY
.Core.finalizeUpdateVaultStakeInDSS
function again.Tools Used
Manual Review
Recommended Mitigation Steps
The
Core.finalizeUpdateVaultStakeInDSS
function can be updated to allow the operator's DSS allocation request to be finalized without waiting for theMIN_STAKE_UPDATE_DELAY
.Assessed type
Other
The text was updated successfully, but these errors were encountered: