code-423n4 / 2023-08-dopex-findings

3 stars 3 forks source link

`updateFundingPaymentPointer()` and `updateFunding()` in `PerpetualAtlanticVault.sol` can be called even when contract is paused #705

Open code423n4 opened 1 year ago

code423n4 commented 1 year ago

Lines of code

https://github.com/code-423n4/2023-08-dopex/blob/eb4d4a201b3a75dd4bddc74a34e9c42c71d0d12f/contracts/perp-vault/PerpetualAtlanticVault.sol#L462-L496 https://github.com/code-423n4/2023-08-dopex/blob/eb4d4a201b3a75dd4bddc74a34e9c42c71d0d12f/contracts/perp-vault/PerpetualAtlanticVault.sol#L502-L524

Vulnerability details

Impact

updateFundingPaymentPointer() and updateFunding() can be called even when the contract is in a paused state. Paused state suggests that there shoudn't be any actions nor changes on the current, paused contract. However, both updateFundingPaymentPointer() and updateFunding() changes the state of the contract.

Proof of Concept

updateFundingPaymentPointer() and updateFunding() functions do not implement _whenNotPaused(). Lack of _whenNotPaused() means that these functions can be called even when the contract is being paused.

Import the contract into Remix IDE. Deploy PerpetualAtlanticVault.sol. Now run pause() to pause the contract. While contract is paused, it's still possible to call updateFundingPaymentPointer() and updateFunding().

Tools Used

Manual code review and Remix IDE.

Recommended Mitigation Steps

Add _whenNotPaused() to above functions.

Assessed type

Other

c4-pre-sort commented 1 year ago

bytes032 marked the issue as sufficient quality report

c4-pre-sort commented 1 year ago

bytes032 marked the issue as high quality report

c4-pre-sort commented 1 year ago

bytes032 marked the issue as primary issue

c4-sponsor commented 11 months ago

witherblock (sponsor) confirmed

GalloDaSballo commented 11 months ago

This is the opposite discussion to being paused frozen and losing yield

c4-judge commented 11 months ago

GalloDaSballo changed the severity to QA (Quality Assurance)