Backed Protocol contest - hake's results

Protocol for peer to peer NFT-Backed Loans.

General Information

Platform: Code4rena

Start Date: 05/04/2022

Pot Size: $30,000 USDC

Total HM: 10

Participants: 47

Period: 3 days

Judge: gzeon

Total Solo HM: 4

Id: 106

League: ETH

Backed Protocol

Findings Distribution

Researcher Performance

Rank: 5/47

Findings: 3

Award: $1,132.96

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

Findings Information

🌟 Selected for report: rayn

Also found by: hake

Labels

bug
duplicate
2 (Med Risk)
disagree with severity
sponsor acknowledged

Awards

829.5088 USDC - $829.51

External Links

Lines of code

NFTLoandFacilitator.lend; L205

Vulnerability details

Impact

A lender using an upgradeable smart contract could stop other lenders from buying him out, essentially causing a DoS.

Proof of Concept

Lender uses an upgradeable smart contract that front runs competing lenders and upgrades itself to remove its fallback/receive function everytime another lender tries to buy him out. Causing a DoS when the lend function reaches L205 Then, before he is about to be repayed he front runs repayAndCloseLoan and upgrades itself again to be able to receive the rewards.

Tools Used

Ensure lenders can only be EOAs.

#0 - wilsoncusack

2022-04-08T01:02:38Z

Proposed resolution does not fix because even if original lender is an EOA they can transfer the ticket to a smart contract. Won't fix. Only so much we can do with malicious tokens

#1 - gzeoneth

2022-04-15T13:27:27Z

Duplicate #89

#2 - wilsoncusack

2022-04-18T22:55:31Z

Hey sorry @gzeoneth just looking closer at this one: I would argue not a duplicate of ERC777? Borrower could be using an normal ERC777 and be attacked in #89. This requires borrower opting into using malicious ERC20

#3 - wilsoncusack

2022-04-18T23:06:41Z

I would have marked this as invalid

#4 - wilsoncusack

2022-04-18T23:09:03Z

actually: I think I am mistaken in my reading here. It is correctly marked as a duplicate of #89

Findings Information

🌟 Selected for report: WatchPug

Also found by: Dravee, berndartmueller, hake, jah, minhquanym

Labels

bug
duplicate
2 (Med Risk)
disagree with severity

Awards

181.4136 USDC - $181.41

External Links

Lines of code

closeLoan; L116-216

Vulnerability details

Impact

ERC721 used as collateral could possibly never return to borrower.

Proof of Concept

No zero address check for sendCollateralTo might lead to sending ERC721 used as collateral to inexistent address. Use of transferFrom instead of safeTransferFrom doesn't check if ERC721 has been properly received.

Allowing users to send their tokens to oblivion (even if by mistake) can cause major reputation damage, given such tokens might be extremely valuable.

Tools Used

Implement zero address check and/or use safeTransferFrom instead of transferFrom.

#0 - wilsoncusack

2022-04-07T23:44:29Z

ERC721 standard states that transferFrom Throws if _to is the zero address, so 0 address is checked.

This has been brought up in several tickets and I mentioned that we feel users passing custom params here should know what they are doing and are not going to have the gas overhead of safeTransferFrom. Mentioned elsewhere the even uniswap uses _mint rather than _safeMint https://github.com/Uniswap/v3-periphery/blob/main/contracts/NonfungiblePositionManager.sol#L156

#1 - gzeoneth

2022-04-15T13:34:49Z

Duplicate of #83

Awards

122.0352 USDC - $122.04

Labels

bug
QA (Quality Assurance)
sponsor acknowledged

External Links

LOW

Low#1: withdrawOriginationFees could be better implemented.

withdrawOriginationFees; L295-300 Balance in the contract might differ from balance generated by loan origination fees for whatever reason. Maybe implementing origination fee balance accounting could improve accuracy of this function. Furthermore, a zero address check should be implemented for to to make sure the origination fees are not burned.

Low#2: Use _safeMint instead of _mint.

NFTLoanTicket.mint; L33-35 Recommend implementing _safeMint instead of _mint to ensure tokens have been properly received.

NON-CRITICAL

Non-crit#1: No zero address check for setLendTicketContract and setBorrowTicketContract

setLendTicketContract setBorrowTicketContract

Zero address checks should be implemented in these functions to avoid having to relaunch NFTLoandFacilitator in case one of them is set to 0 by mistake.

Non-crit#2: Opnionated change to updateRequiredImprovementRate

updateRequiredImprovementRate; L314-326

RequiredImprovementRate could be set by borrower. Small percentages can still make a big difference if big figures are in play. Borrower could appreciate more flexibility in this area.

Merely an opinion.

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