Submitted by ladboy233, also found by unforgiven, bin2chen, 8olidity, and __141345__
https://github.com/with-backed/papr/blob/9528f2711ff0c1522076b9f93fba13f88d5bd5e6/src/PaprController.sol#L365
https://github.com/with-backed/papr/blob/9528f2711ff0c1522076b9f93fba13f88d5bd5e6/src/PaprController.sol#L138
Disabled collateral can still be used to mint debt.
There is an access control function in PaprController.sol:
According to IPaprController, if the collateral is disabled, set to false, the user should not be allowed to mint debt using the collateral:
However, the code only checks if the collateral is allowed when adding collateral:
But does not have the same check when minting debt, then user can use disabled collateral to mint debt:
As shown in the coded POC, we can add the following test to increaseDebt.t.sol:
https://github.com/with-backed/papr/blob/9528f2711ff0c1522076b9f93fba13f88d5bd5e6/test/paprController/IncreaseDebt.t.sol#L32
We disable the collateral but still are able to mint debt by calling increaseDebt.
We run the test:
The test passes, but the test should revert.
We recommend the project add checks to make sure when the collateral is disabled, the collateral should not be used to mint debt.
wilsoncusack (Backed) confirmed and commented:
