Closed c4-bot-5 closed 10 months ago
141345 marked the issue as insufficient quality report
0xean marked the issue as duplicate of #65
0xean marked the issue as satisfactory
0xean changed the severity to 3 (High Risk)
0xean changed the severity to 2 (Med Risk)
Lines of code
https://github.com/re-nft/smart-contracts/blob/3ddd32455a849c3c6dc3c3aad7a33a6c9b44c291/src/modules/PaymentEscrow.sol#L100-L119
Vulnerability details
Impact
The
PaymentEscrow
contract serves as an escrow for rental payments while rentals are active and handles their transfer when they are stopped.PAY
orders can be stopped by the lender at any time, in which case the payment is split pro rata among the lender and the renter, and by anybody once the rental has expired, in which case the payment goes in full to the renter.However, if an ERC-777 token is used as payment in a
PAY
order and the renter is a contract address, the renter can extend the duration of the rental until they receive the rental in full by reverting on thetokensReceived()
hook until the full duration is over. This will cause the call totransfer()
in the_safeTransfer()
function to revert and prevent the lender from stopping the rental: https://github.com/re-nft/smart-contracts/blob/3ddd32455a849c3c6dc3c3aad7a33a6c9b44c291/src/modules/PaymentEscrow.sol#L100-L119The renter can be a contract as, per the sponsor:
And anyway:
Furthermore, the renter could potentially extort the lender for larger amounts, as they can hold the NFTs hostage for as long as they want at no cost.
Proof of Concept
tokensReceived()
hook, extending the duration of the rental.Tools Used
Manual review
Recommended Mitigation Steps
One possible mitigation would be to implement a mechanism to allow the renter to recuperate their items once a
PAY
rental has ended even if the transfer to the renter fails. Alternatively, an allowance could be set and execution resumed if a transfer fails, so that the recipient can pull the transfer themselves.Assessed type
ERC20