WhenNotPaused modifier in the CDPVault can be bypassed by users #204
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
M-15
primary issue
Highest quality submission among a set of duplicates
🤖_02_group
AI based duplicate group recommendation
satisfactory
satisfies C4 submission criteria; eligible for awards
selected for report
This submission will be included/highlighted in the audit report
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-07-loopfi/blob/57871f64bdea450c1f04c9a53dc1a78223719164/src/CDPVault.sol#L223-L233
https://github.com/code-423n4/2024-07-loopfi/blob/main/src/CDPVault.sol#L239-L249
Vulnerability details
Impact
Users can still execute deposit and withdraw functions when the CDPVault.sol is paused as against the design expectation by just calling the
modifyCollateralAndDebt(...)
function with the necessary parameters.Proof of Concept
By design it is expected that when the CDPVault.sol contract is paused by the Dao, the deposits and withdrawals cannot be made due to the
whenNotPaused
modifier on thedeposit
andwithdraw
functions. However, the pause mechanism can be bypassed by users to deposit or withdaraw on the CDPVault contract by directly calling themodifyCollateralAndDebt(...)
function since it is public since it is the same function that is called by thedeposit
andwithdraw
functions.Both the desposit and withdraw functions of the CDPVault.sol only make simple calculations before calling the public
modifyCollateralAndDebt(...)
function. This allows any user to directly call themodifyCollateralAndDebt(...)
function when the CDPVault.sol contract is paused.Tools Used
Manual Review
Recommended Mitigation Steps
Consider implementing either of the two solutions:
modifyCollateralAndDebt(...)
internal
instead ofpublic
OR
whenNotPaused
modifier to themodifyCollateralAndDebt(...)
functionAssessed type
Other
The text was updated successfully, but these errors were encountered: