Open code423n4 opened 1 year ago
Will wait for sponsor feedback before deciding on severity.
trust1995 marked the issue as satisfactory
State mismanagement causes writing off of a bad debt while there's still a collateral NFT being auctioned. As a result, the proceedings of the auction are not used to repay the bad debt and are sent directly to the debtor.
Agree with @Jeiwan. The isLastCollateral check should also check whether there is another auction ongoing, https://github.com/with-backed/papr/blob/9528f2711ff0c1522076b9f93fba13f88d5bd5e6/src/PaprController.sol#L525-L527
wilsoncusack marked the issue as sponsor confirmed
trust1995 marked the issue as primary issue
trust1995 marked the issue as selected for report
Lines of code
https://github.com/with-backed/papr/blob/9528f2711ff0c1522076b9f93fba13f88d5bd5e6/src/PaprController.sol#L264-L294
Vulnerability details
Impact
The proceeds from the collateral auctions will not be used to fill the debt shortfall, but be transferred directly to the borrower.
Proof of Concept
Assume N is an allowed NFT, B is a borrower, the vault V is
_vaultInfo[B][N]
:neededToSaveVault
is 0 anddebtCached
is 0:The tokens being transferred to the borrower in step 8 should be used to fill the shortfall of the vault. Test code for PoC:
Test output:
Tools Used
VS Code
Recommended Mitigation Steps
The debt shortfall should be recorded and accumulated when the debt is burnt directly. Fill the shortfall first in later liquidation.
Implementation code: