KangarooVault.initiateDeposit , KangarooVault.processDepositQueue , KangarooVault.initiateWithdrawal , and KangarooVault.processWithdrawalQueue functions do not use whenNotPaused modifier
Submitted by rbserver, also found by DadeKuma, CRYP70, sakshamguruji, and Diana
As shown by the code below, although PauseModifier is imported, the KangarooVault contract does not use the whenNotPaused modifier in any of its functions. More specifically, the KangarooVault.initiateDeposit, KangarooVault.processDepositQueue, KangarooVault.initiateWithdrawal, and KangarooVault.processWithdrawalQueue functions do not use the whenNotPaused modifier.
import {PauseModifier} from "./utils/PauseModifier.sol";
contract KangarooVault is Auth, ReentrancyGuard, PauseModifier {
function initiateDeposit(address user, uint256 amount) external nonReentrant {
function processDepositQueue(uint256 idCount) external nonReentrant {
function initiateWithdrawal(address user, uint256 tokens) external nonReentrant {
function processWithdrawalQueue(uint256 idCount) external nonReentrant {
This is unlike the LiquidityPool contract; comparing to the KangarooVault.initiateDeposit, KangarooVault.processDepositQueue, KangarooVault.initiateWithdrawal, and KangarooVault.processWithdrawalQueue functions, the LiquidityPool.deposit, LiquidityPool.queueDeposit, LiquidityPool.processDeposits, LiquidityPool.withdraw, LiquidityPool.queueWithdraw, and LiquidityPool.processWithdraws functions have the similar functionalities but they all use the whenNotPaused modifier. As a result, when an emergency, such as a hack, occurs, the protocol can pause the LiquidityPool.withdraw, LiquidityPool.queueWithdraw, and LiquidityPool.processWithdraws functions to prevent or reduce damages, such as preventing users and the protocol from losing funds, but cannot do that for the KangarooVault.initiateDeposit, KangarooVault.processDepositQueue, KangarooVault.initiateWithdrawal, and KangarooVault.processWithdrawalQueue functions.
function deposit(uint256 amount, address user) external override nonReentrant whenNotPaused("POOL_DEPOSIT") {
function queueDeposit(uint256 amount, address user)
external
override
nonReentrant
whenNotPaused("POOL_QUEUE_DEPOSIT")
{
function processDeposits(uint256 count) external override nonReentrant whenNotPaused("POOL_PROCESS_DEPOSITS") {
function withdraw(uint256 tokens, address user) external override nonReentrant whenNotPaused("POOL_WITHDRAW") {
function queueWithdraw(uint256 tokens, address user)
external
override
nonReentrant
whenNotPaused("POOL_QUEUE_WITHDRAW")
{
function processWithdraws(uint256 count) external override nonReentrant whenNotPaused("POOL_PROCESS_WITHDRAWS") {
Proof of Concept
The following steps can occur for the described scenario.
- An emergency, such as a hack, occurs in which further withdrawals can cause users and the protocol to lose funds.
- The protocol team is able to pause the
LiquidityPool.withdraw,LiquidityPool.queueWithdraw, andLiquidityPool.processWithdrawsfunctions. - However, the protocol team is unable to pause the
KangarooVault.initiateWithdrawalandKangarooVault.processWithdrawalQueuefunctions. - As a result, funds can be lost from the
KangarooVault.
Tools Used
VSCode
Recommended Mitigation Steps
The KangarooVault.initiateDeposit, KangarooVault.processDepositQueue, KangarooVault.initiateWithdrawal, and KangarooVault.processWithdrawalQueue functions can be updated to use the whenNotPaused modifier.
rivalq (Polynomial) disagreed with severity
rivalq (Polynomial) disagreed with severity
Not such an easy one to grade. Historically, missing
whenNotPausedmodifiers are considered as a medium risk issue:
- https://github.com/code-423n4/2022-06-connext-findings/issues/175
- https://github.com/code-423n4/2022-09-y2k-finance-findings/issues/38
The only time they are considered as Low severity findings are when they’re actually put on too many functions and should be removed:
- https://code4rena.com/reports/2022-02-jpyc#l-04-fiattokenv1—v2-remove-whennotpaused-modifier-from-cancelauthorization-and-decreaseallowance-functions
- https://code4rena.com/reports/2023-01-drips#l-04-collecting-funds-should-be-usable-while-the-dripshub-contract-is-paused
Therefore I believe that Medium Severity is the right risk level, at least for this type of issue on code4rena and for the time being
mubaris (Polynomial) confirmed and commented:
Medium severity seems fair.
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 Polynomial Protocol contest. Code4rena made it public on 1 August 2023. Found in the 2023-03-polynomial audit contest (finding M-03), also found by 4 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.