Debt DAO contest - ayeslick's results

A cryptonative credit marketplace for fully anon and trustless loans to DAOs.

General Information

Platform: Code4rena

Start Date: 03/11/2022

Pot Size: $115,500 USDC

Total HM: 17

Participants: 120

Period: 7 days

Judge: LSDan

Total Solo HM: 1

Id: 174

League: ETH

Debt DAO

Findings Distribution

Researcher Performance

Rank: 14/120

Findings: 4

Award: $1,938.11

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

Findings Information

🌟 Selected for report: cryptphi

Also found by: Ch_301, PaludoX0, adriro, ayeslick, perseverancesuccess

Labels

bug
3 (High Risk)
satisfactory
edited-by-warden
duplicate-69

Awards

1468.9791 USDC - $1,468.98

External Links

Lines of code

https://github.com/debtdao/Line-of-Credit/blob/audit/code4rena-2022-11-03/contracts/modules/credit/LineOfCredit.sol#L143

Vulnerability details

Impact

One way for this to work, a borrower becomes his own lender and borrows from himself before he borrows from another lender. This makes him the first lender so he has to be repaid before the other lenders. The whileBorrowing modifier allows a given function to run when only when count != 0 || credits[ids[0]].principal != 0. A borrower is able to take out a loan from himself and then repay it, satisfying this requirement, credits[ids[0]].principal == 0, in the whileBorrowing modifier.

A borrower can prevent an arbiter from calling declareInsolvent by becoming his own lender before borrowing from other lenders. Then the borrower repays himself but doesn't call the close function. The borrower doesn't repay the other lenders. The arbiter tries to call declareInsolvent but will be unable to since the whileBorrowing modifier will revert the transaction. It reverts the transaction because credits[ids[0]].principal == 0 since the borrower is the first lender.

Proof of Concept

borrower becomes his own lender by calling the addCredit function and passing in an address he controls as a lender. borrower borrows from himself first then the other lenders. borrower repays himself but doesn't call the close function. borrower doesn't repay the other lenders Arbiter gets involved and calls the declareInsolvent function but the function will revert due to the whileBorrowing modifier.

When the first lender is made whole the loan for that lender should automatically close.

#0 - c4-judge

2022-11-17T10:50:24Z

dmvt marked the issue as primary issue

#1 - c4-judge

2022-11-17T21:49:13Z

dmvt marked the issue as duplicate of #69

#2 - c4-judge

2022-12-06T17:19:14Z

dmvt marked the issue as satisfactory

Awards

4.0405 USDC - $4.04

Labels

bug
2 (Med Risk)
partial-50
duplicate-39

External Links

Lines of code

https://github.com/debtdao/Line-of-Credit/blob/audit/code4rena-2022-11-03/contracts/utils/LineLib.sol#L71

Vulnerability details

Impact

If a lender or borrower sends in more ETH than the amount they specified, that ETH is not refunded to them.

Proof of Concept

Borrower calls the depositAndRepay function Borrower specifies 1 ETH in the amount but sends 1.5 ETH The 1 ETH is used to repay his loan while 0.5 ETH isn't accounted for

require(amount == msg.value) for ETH transfers

#0 - c4-judge

2022-11-17T11:50:37Z

dmvt marked the issue as duplicate of #25

#1 - c4-judge

2022-12-06T16:27:45Z

dmvt marked the issue as partial-50

#2 - C4-Staff

2022-12-20T06:44:54Z

liveactionllama marked the issue as duplicate of #39

Findings Information

Awards

24.4049 USDC - $24.40

Labels

bug
2 (Med Risk)
partial-50
duplicate-367

External Links

Lines of code

https://github.com/debtdao/Line-of-Credit/blob/audit/code4rena-2022-11-03/contracts/utils/LineLib.sol#L69

Vulnerability details

Impact

If a lender and borrower agree to use a fee-on-transfer token, the recorded in the contract will be different than the amount received.

Proof of Concept

lender transfers tokens via the addCredit function. lender specifies 1000 Tokens The contract receives 950 tokens but records 1000 tokens received

Check the balance of the contract before and after a transfer using the difference.

#0 - c4-judge

2022-11-17T11:11:13Z

dmvt marked the issue as duplicate of #26

#1 - c4-judge

2022-12-06T16:47:03Z

dmvt marked the issue as partial-50

#2 - C4-Staff

2022-12-20T06:01:34Z

liveactionllama marked the issue as duplicate of #367

Findings Information

🌟 Selected for report: berndartmueller

Also found by: 0xdeadbeef0x, Jeiwan, R2, ayeslick, minhquanym

Labels

bug
2 (Med Risk)
satisfactory
duplicate-467

Awards

440.6937 USDC - $440.69

External Links

Lines of code

https://github.com/debtdao/Line-of-Credit/blob/audit/code4rena-2022-11-03/contracts/modules/credit/LineOfCredit.sol#L488

Vulnerability details

Impact

If a lender rejects the ETH transfer when a borrower calls the close function, the borrower will be unable to close their loan with that lender which could lead to liquidation. It also prevents other lenders who provided loans after the lender from being repaid since repayments are on a FIFO basis.

Proof of Concept

borrower borrows from malicious lender borrower borrows from other lenders borrower repays malicious lender borrower calls close function ETH is sent to the malicious lenders` contract which rejects the ETH causing the transaction to revert

If an ETH transfer fails wrap it to WETH then send it to the lender.

#0 - c4-judge

2022-11-17T11:10:46Z

dmvt marked the issue as duplicate of #85

#1 - c4-judge

2022-12-06T17:35:22Z

dmvt marked the issue as satisfactory

#2 - C4-Staff

2022-12-20T05:44:12Z

liveactionllama marked the issue as duplicate of #467

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