Backed Protocol contest - csanuragjain'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: 10/47

Findings: 4

Award: $518.64

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

Findings Information

🌟 Selected for report: cmichel

Also found by: AuditsAreUS, IllIllI, Ruhum, csanuragjain, danb, joshie, t11s, tintin

Labels

bug
duplicate
3 (High Risk)
disagree with severity
sponsor disputed

Awards

293.89 USDC - $293.89

External Links

Lines of code

https://github.com/code-423n4/2022-04-backed/blob/main/contracts/NFTLoanFacilitator.sol#L129

Vulnerability details

Impact

In case of collateral price fluctuation, lender can create a situation where borrower would be unable to repay the loan and lender could get hold of collateral

Proof of Concept

  1. User creates a loan request for duration 1 day and minimum amount as 0.1 million usdt and puts his collateral NFT
  2. Lender lends the amount with the same conditions to this user
  3. Due to favorable news, the collateral NFT price hikes too much say now becomes 0.5 million USDT
  4. Lender wants borrower to be unable to repay loan so that he could get hold of borrower collateral
  5. Lender immediately funds additional 0.2 million usdt to borrower under same loan id.
  6. The facilitatorTake fees is deducted on additional amount 0.2 million. Assuming the fees comes to be X so the amount transferred to borrower would be 0.2-X million
  7. Borrower panics as he never needed this much amount and want to simply close the loan but he cannot close as he is short of amount X and duration of 1 day is not enough to get X amount
  8. As a result, borrower is unable to repay on time and lender uses the opportunity to grab borrower collateral giving him a plain benefit of 0.5-0.1-0.2 million = 0.2 million

Always have a max lending amount. Also it would be great to have a feature where borrower can accept/reject lending offers

#0 - wilsoncusack

2022-04-05T16:28:46Z

Not an issue, is just how the protocol works. They are suggesting a feature change that we have a max amount

#1 - gzeoneth

2022-04-15T11:27:25Z

Duplicate of #24

Findings Information

🌟 Selected for report: 0xDjango

Also found by: Dravee, IllIllI, Ruhum, cccz, csanuragjain, robee

Labels

bug
duplicate
2 (Med Risk)
sponsor acknowledged

Awards

139.9476 USDC - $139.95

External Links

Lines of code

https://github.com/code-423n4/2022-04-backed/blob/main/contracts/NFTLoanFacilitator.sol#L230

Vulnerability details

Impact

Since some tokens take transfer fees on performing transfer operations and current contract implementation is not considering same, lender funds could be lost

Proof of Concept

  1. Attacker creates a loan request for token XYZ taking 10% transfer fees
  2. Lender lends amount X of token XYZ to Attacker
  3. After some duration Attacker repay and close the loan but Lender will only receive X-10%+interest which is lesser

Obtain the actual amount which is transferred to/from the contract

#0 - wilsoncusack

2022-04-05T16:29:21Z

Won't fix. Perils of using one of these tokens. Lender should know risks. Borrower also affected as they will received less than loanAmount - origination_fee

#1 - wilsoncusack

2022-04-06T18:18:21Z

duplicate to fee on transfer tokens

#2 - wilsoncusack

2022-04-06T20:01:45Z

#33

#3 - gzeoneth

2022-04-15T13:18:30Z

Awards

51.8678 USDC - $51.87

Labels

bug
QA (Quality Assurance)
sponsor acknowledged
sponsor disputed

External Links

  1. NFTLoanFacilitator.sol#L116 -> closeLoan function -> Attacker can create 10000+ loans with fake colleteral which will spam the system. Loan closing and opening from same wallet address should be allowed after certain duration of to prevent spamming. Even Admin cannot remove these fake loans from system, new function should be introduced to allow same

  2. NFTLoanFacilitator.sol#L296 -> withdrawOriginationFees function -> Attacker creates loan using malicious loanAssetContractAddress token, Attacker himself lend the token which deducts the OriginationFees. Admin later tries withdrawing fees using withdrawOriginationFees which cause malicious code to execute

  3. NFTLoanFacilitator.sol#L129 -> lend function -> Lender could set a very high duration (say 100 years) by mistake. His lended funds and interest will get stuck till 100 years are passed. Recommendation is to set a max duration for loan tenure

  4. No functionality for loanAssetContractAddress migration. In case any security issue is found in loanAssetContractAddress and token is moved to new address, there is no way for admin to update the same in NFTLoanFacilitator contract. This will block borrower from closing the loan

#0 - wilsoncusack

2022-04-05T16:31:03Z

  1. Not an issue, won't fix
  2. Would need more detail.
  3. is how it works
  4. yup, non-upgradable

Awards

32.9299 USDC - $32.93

Labels

bug
G (Gas Optimization)
sponsor acknowledged

External Links

LendTicket.sol#L27 -> _transfer function -> Add check from!=to

#0 - wilsoncusack

2022-04-05T16:28:15Z

won't do, don't want to change implementation and risk bugs

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