code-423n4 / 2024-04-revert-mitigation-findings

1 stars 1 forks source link

M-16 MitigationConfirmed #92

Open c4-bot-7 opened 7 months ago

c4-bot-7 commented 7 months ago

Lines of code

Vulnerability details

C4 issue

M-16: Repayments and liquidations can be forced to revert by an attacker that repays miniscule amount of shares

Comments

Both V3Vault.repay() and V3Vault.liquidate() have a safety check that will cause a revert when a caller repays too much (specifically when the repayment exceeds the loan debt owed). A malicious user can frontrun any liquidate/repay call by repaying the loan by 1 share. This in turn leads to the repay() and liquidate() functions reverting.

Mitigation

PR #14, #30

To mitigate this, the Vault included the following major changes:

Minor changes include:

In summary, both the repay and liquidation functionality now support variable repayments that handle cases where too much is repaid/liquidated. This involves adding checks to see if too much was repaid. If too much was repaid, the Vault adjusts the payment owed to match the max owed. This guarantees that repayers can't frontrun liquidator/repay calls.

Conclusion

LGTM

c4-judge commented 7 months ago

jhsagd76 marked the issue as satisfactory