Open c4-submissions opened 1 year ago
bytes032 marked the issue as insufficient quality report
Over inflated
Missed the important surplus, somewhat valid as QA
GalloDaSballo (sponsor) acknowledged
GalloDaSballo marked the issue as disagree with severity
I think we wil remove the safety check and add a way to reset allowances
The impact sounds insufficient to make me keep med.
jhsagd76 changed the severity to QA (Quality Assurance)
jhsagd76 marked the issue as grade-a
jhsagd76 marked the issue as selected for report
jhsagd76 marked the issue as not selected for report
Lines of code
https://github.com/code-423n4/2023-10-badger/blob/f2f2e2cf9965a1020661d179af46cb49e993cb7e/packages/contracts/contracts/LeverageMacroBase.sol#L452 https://github.com/code-423n4/2023-10-badger/blob/f2f2e2cf9965a1020661d179af46cb49e993cb7e/packages/contracts/contracts/LeverageMacroBase.sol#L291-L310 https://github.com/code-423n4/2023-10-badger/blob/f2f2e2cf9965a1020661d179af46cb49e993cb7e/packages/contracts/contracts/LeverageMacroBase.sol#L398-L431 https://github.com/code-423n4/2023-10-badger/blob/f2f2e2cf9965a1020661d179af46cb49e993cb7e/packages/contracts/contracts/BorrowerOperations.sol#L963-L981 https://github.com/code-423n4/2023-10-badger/blob/f2f2e2cf9965a1020661d179af46cb49e993cb7e/packages/contracts/contracts/BorrowerOperations.sol#L553-L594
Vulnerability details
Impact
Borrower authorization and then opencdp cannot be completed in one transaction
Proof of Concept
In the _handleOperation method, the authorization required before executing _openCdpCallback, _closeCdpCallback, and _adjustCdpCallback will be completed in _doSwaps. The specific code is as follows:
Since access to borrowerOperations is restricted in _ensureNotSystem, the code is as follows:
This will result in the inability to access the borrowerOperations.permitPositionManagerApproval method for authorization, and the borrowerOperations.closeCdp and borrowerOperations.adjustCdpWithColl methods called in _closeCdpCallback and _adjustCdpCallback can be delegated to others to call. The code is as follows:
For example, I have a CDP and now I want to entrust SC Wallet to close my CDP. Since I cannot call permitPositionManagerApproval for authorization, I cannot complete this operation in a transaction.
Tools Used
VSCode
Recommended Mitigation Steps
In the _ensureNotSystem method, remove restrictions on borrowerOperations access.
In fact, I think that the restrictions in _ensureNotSystem can be removed. This is a wallet. Any developer can develop a similar wallet according to his own wishes. The restrictions here have little significance for security.
Assessed type
Access Control