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

1 stars 1 forks source link

M-15 MitigationConfirmed #48

Open c4-bot-6 opened 4 months ago

c4-bot-6 commented 4 months ago

Lines of code

Vulnerability details

C4 Issue

M-15: Users' newly created positions can be prematurely closed and removed from the vault...

Issue Details

V3Vault.sol exposed a vulnerability where newly created positions without any debt, could be prematurely closed and removed from the vault by front-running their first borrow() call with a repay() call.

Since repay() transfers back the positions to their owners after full debt repayment, it was very easy for anyone to close any position immediately after it was created because debt is 0, which means no funds will be repaid and the position still gets transferred out of the vault

Mitigation

PR-8 successfully mitigates the original issue by introducing the following 2 changes:

Conclusion

Mitigation Confirmed

c4-judge commented 4 months ago

jhsagd76 marked the issue as satisfactory