reNFT - 0xc695's results

Collateral-free, permissionless, and highly customizable EVM NFT rentals.

General Information

Platform: Code4rena

Start Date: 08/01/2024

Pot Size: $83,600 USDC

Total HM: 23

Participants: 116

Period: 10 days

Judge: 0xean

Total Solo HM: 1

Id: 317

League: ETH

reNFT

Findings Distribution

Researcher Performance

Rank: 77/116

Findings: 2

Award: $25.02

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

Awards

22.2973 USDC - $22.30

Labels

bug
2 (Med Risk)
downgraded by judge
satisfactory
duplicate-65

External Links

Lines of code

https://github.com/re-nft/smart-contracts/blob/3ddd32455a849c3c6dc3c3aad7a33a6c9b44c291/src/policies/Stop.sol#L265-L306

Vulnerability details

Impact

onERC721Received could fail if the lender is a contract. We could end up with a situation where the lender would not get the NFT back and the borrower would not get the payment.

Proof of Concept

When finishing a PAY order, an order for which the lender is paying the borrower. The stopRent(...) function is in charge of transferring the NFT to the lender and the paiement to the borrower. Its logic is the folllowing:

  • Transfer the NFT back to the lender
  • Settle the payment to the borrower and lender (if there is any)

If the NFT transfer was to fail, we would not be able to process the due payments.

The transfer of the NFT is done through the _transferERC721_(...) of the Reclaimer contract. It uses the safeTransferFrom function of the ERC721 standard. This function will check if the receiver is a contract and call the onERC721Received function on it. If the receiver contract does not implement this function, the transfer will fail and the payments will not be settled.

Recommendation

  • We could avoid this issue by using the normal transfer function of the ERC721 standard. This function does not check if the receiver is a contract and does not call the onERC721Received function.
  • Make sure that the lender is not a smart contract when creating the rental order.

Assessed type

ERC721

#0 - c4-pre-sort

2024-01-21T18:02:26Z

141345 marked the issue as duplicate of #65

#1 - c4-judge

2024-01-28T19:23:10Z

0xean marked the issue as satisfactory

#2 - c4-judge

2024-01-28T20:51:59Z

0xean changed the severity to 3 (High Risk)

#3 - c4-judge

2024-01-30T14:21:44Z

0xean changed the severity to 2 (Med Risk)

Awards

2.7205 USDC - $2.72

Labels

bug
2 (Med Risk)
downgraded by judge
satisfactory
duplicate-64

External Links

Lines of code

https://github.com/re-nft/smart-contracts/blob/3ddd32455a849c3c6dc3c3aad7a33a6c9b44c291/src/policies/Stop.sol#L265-L306

Vulnerability details

Impact

This is a big issue as it would not let the lender get back the NFT.

Proof of Concept

When finishing a PAY order, an order for which the lender is paying the borrower. The stopRent(...) function is in charge of transferring the NFT to the lender and the paiement to the borrower. Its logic is the folllowing:

  • Transfer the NFT back to the lender
  • Settle the payment to the borrower and lender

For some famous tokens like USDT or USDC, the borrower could be a blacklisted address. In the context of a PAY order the borrower is the one receiving the payment. In order to settle the paiement at the end (or during) a PAY order, the protocol is using the safeTransfer(...) function of the ERC20 standard. This function will check that the payment did not fail and will revert if it did. EVM blockchains being atomic, if the payment fails, the NFT transfer will also fail and the NFT will not be transferred back to the lender.

It would be stuck in the borrower Safe.

Tools Used

Manual review

Recommendation

  • use the normal transfer function of the ERC20 standard

Assessed type

ERC20

#0 - c4-pre-sort

2024-01-21T17:36:02Z

141345 marked the issue as duplicate of #64

#1 - c4-judge

2024-01-28T20:49:24Z

0xean changed the severity to 2 (Med Risk)

#2 - c4-judge

2024-01-28T21:00:47Z

0xean marked the issue as satisfactory

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter