Admin will not be able to only pause deposits in the `Vault` due to incorrect check leading to DoSed withdrawals
0x73696d616f Follow with 404Notfound, 4gontuk and 15 others
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2024-08-cork-protocol-judging/issues/182
Found by
0x73696d616f, 404Notfound, 4gontuk, Abhan1041, KupiaSec, Pro_King, Smacaud, Trooper, durov, hunter_w3b, korok, mladenov, octeezy, ravikiran.web3, tinnohofficial, tmotfl, ydlee, yovchev_yoan
Summary
The modifier LVDepositNotPaused in Vault::depositLv() checks states[id].vault.config.isWithdrawalPaused instead of states[id].vault.config.isDepositPaused, which means deposits will only be paused if withdrawals are paused, DoSing withdrawals.
Root Cause
In ModuleState:109, it checks states[id].vault.config.isWithdrawalPaused when it should check states[id].vault.config.isDepositPaused.
Internal pre-conditions
- Admin pauses deposits.
External pre-conditions
None.
Attack Path
- Admin sets deposits paused, but deposits are not actually paused due to the incorrect modifier.
- Admin either leaves deposits unpaused or pauses both deposits and withdrawals, DoSing withdrawals.
Impact
Admin is not able to pause deposits alone which would lead to loss of funds as this is an emergency mechanism. If the admin wants to pause deposits, withdrawals would also have to be paused, DoSing withdrawals.
PoC
ModuleState::LVDepositNotPaused() is incorrect:
modifier LVDepositNotPaused(Id id) {
if (states[id].vault.config.isWithdrawalPaused) { //@audit isDepositPaused
revert LVDepositPaused();
}
_;
}
Mitigation
ModuleState::LVDepositNotPaused() should be:
modifier LVDepositNotPaused(Id id) {
if (states[id].vault.config.isDepositPaused) {
revert LVDepositPaused();
}
_;
}
Discussion
ziankork
will fix
sherlock-admin2
The protocol team fixed this issue in the following PRs/commits: https://github.com/Cork-Technology/Depeg-swap/pull/78
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A medium-severity business logic bug in Cork Protocol. Sherlock made it public on 26 September 2024. Found in the 506 audit contest (finding M-2), also found by 17 other wardens.
About Business logic
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
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.