Skip to content
Business logic Audit finding Beginner

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

  1. Admin pauses deposits.

External pre-conditions

None.

Attack Path

  1. Admin sets deposits paused, but deposits are not actually paused due to the incorrect modifier.
  2. 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:

Solidity
modifier LVDepositNotPaused(Id id) {
    if (states[id].vault.config.isWithdrawalPaused) { //@audit isDepositPaused
        revert LVDepositPaused();
    }
    _;
}

Mitigation

ModuleState::LVDepositNotPaused() should be:

Solidity
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

The original report as published on Sherlock, by 0x73696d616f. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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.

More by 0x73696d616f

View all

172 more disclosed reports, best first.

More from Cork Protocol

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.