Submitted by p4st13r4
Any user can pay the debt for any borrower in Vault.sol, by using repayDebt(). This function allows anyone to repay any amount of borrowed value, up-to and including the totalDebt value; it works by setting the debts[_target] to zero, and decreasing totalDebt by the given amount, up to zero. However, all debts of the other borrowers are left untouched.
If a malicious (but generous) user were to repay the debt for all the borrowers, markets functionality regarding borrowing would be DOSed: the vault would try to decrease the debt of the market, successfully, but would fail to decrease totalDebt as it would result in an underflow
https://github.com/code-423n4/2022-01-insure/blob/main/contracts/Vault.sol#L257
Make repayDebt() accept an amount up-to and including the value of the debt for the given borrower
oishun1112 (Insure) confirmed:
