AbraNFT contest - ilan's results

A peer to peer lending platform, using NFTs as collateral.

General Information

Platform: Code4rena

Start Date: 27/04/2022

Pot Size: $50,000 MIM

Total HM: 6

Participants: 59

Period: 5 days

Judge: 0xean

Id: 113

League: ETH

Abracadabra Money

Findings Distribution

Researcher Performance

Rank: 41/59

Findings: 1

Award: $72.64

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

https://github.com/code-423n4/2022-04-abranft/blob/5cd4edc3298c05748e952f8a8c93e42f930a78c2/contracts/NFTPair.sol#L266 https://github.com/code-423n4/2022-04-abranft/blob/5cd4edc3298c05748e952f8a8c93e42f930a78c2/contracts/NFTPairWithOracle.sol#L295

Vulnerability details

Impact

using ERC721.transferFrom is not safe as the recipient can not be a valid ERC721 receiver contract, hence the token can be lost. safeTransferFrom should be used instead.

Proof of Concept

NFTPair.removeCollateral line 266

NFTPairWithOracle.removeCollateral line 295

collateral.transferFrom(address(this), to, tokenId) can be called with an invalid to adress.

Tools Used

Manual Inspection with VSCode.

Recommended Mitigation Steps

Use safeTransferFrom instead of transferFrom. safeTransferFrom will check that to is a valid ERC721 receive

#0 - cryptolyndon

2022-05-05T23:52:49Z

Duplicate of #20

#1 - 0xean

2022-05-21T14:24:48Z

see #20 - downgrading to QA

#2 - JeeberC4

2022-05-23T19:10:28Z

Preserving original title: Use of unsafe ERC721.transferFrom rather than safeTransferFrom

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