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

1 stars 1 forks source link

H-02 MitigationConfirmed #14

Open c4-bot-5 opened 4 months ago

c4-bot-5 commented 4 months ago

Lines of code

Vulnerability details

C4 Issue

H-02: Risk of reentrancy onERC721Received function to manipulate collateral token configs shares

Issue Details

The onERC721Received function of V3Vault.sol is invoked whenever a new position is created or an existing one is transformed. In the case of AutoRange.sol transformer, the current user position is replaced with a new one, transferring back the old one to its owner. Since the the old position NFT was transferred in the same transaction, it opened the door for re-entrancy exploits

Mitigation

PR-8 successfully mitigates the original issue by implementing the pull over push pattern when returning position NFTs to their owners:

Due to the changes, reentrancy is no longer possible when replacing positions.

Comment

Small QA detail I noticed is that during refactoring a check got duplicated two times in the audit branch https://github.com/revert-finance/lend/blob/dcfa79924c0e0ba009b21697e5d42d938ad9e5e3/src/V3Vault.sol#L1052-L1058

Consider removing the duplicate

Conclusion

Mitigation Confirmed

c4-judge commented 4 months ago

jhsagd76 marked the issue as satisfactory