Debt DAO contest - datapunk'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: 110/120

Findings: 2

Award: $40.83

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

Labels

bug
2 (Med Risk)
partial-25
duplicate-355

Awards

35.4853 USDC - $35.49

External Links

Lines of code

https://github.com/debtdao/Line-of-Credit/blob/6987988fe39901cad9a8e5ebb2c6aa719590873d/contracts/utils/LineLib.sol#L59

Vulnerability details

Impact

receiveTokenOrETH() receives funds. However, there is code path within the function that does not require Ether. Ether passed to the function, when the non-Ether code path is taken, is locked in the contract forever, and the sender gets nothing extra in return for it.

Proof of Concept

If ETH is provided for a ERC20 credit line, it would not be accounted for, thus lost forever to the user. msg.value shouldn’t be provided here:

if(token != Denominations.ETH) { // ERC20 @audit add require(msg.value==0); IERC20(token).safeTransferFrom(sender, address(this), amount); }

Tools Used

VSCode

Add a require(0 == msg.value) for the above three conditions.

#0 - c4-judge

2022-11-17T15:47:26Z

dmvt marked the issue as duplicate of #25

#1 - c4-judge

2022-11-17T19:30:40Z

dmvt marked the issue as partial-25

#2 - c4-judge

2022-12-06T15:13:10Z

dmvt marked the issue as not a duplicate

#3 - c4-judge

2022-12-06T15:13:18Z

dmvt marked the issue as duplicate of #89

#4 - c4-judge

2022-12-06T17:42:25Z

dmvt marked the issue as partial-25

#5 - C4-Staff

2022-12-20T06:05:46Z

liveactionllama marked the issue as duplicate of #355

Awards

5.3388 USDC - $5.34

Labels

bug
2 (Med Risk)
satisfactory
duplicate-369

External Links

Lines of code

https://github.com/debtdao/Line-of-Credit/blob/6987988fe39901cad9a8e5ebb2c6aa719590873d/contracts/utils/LineLib.sol#L48

Vulnerability details

impact

The use of payable.transfer() is heavily frowned upon because it can lead to the locking of funds. The transfer() call requires that the recipient has a payable callback, only provides 2300 gas for its operation. This means the following cases can cause the transfer to fail:

The contract does not have a payable callback The contract’s payable callback spends more than 2300 gas (which is only enough to emit something) The contract is called through a proxy which itself uses up the 2300 gas If a user falls into one of the above categories, they’ll be unable to receive funds from the vault in a migration wrapper. Inaccessible funds means loss of funds, which is Medium severity.

Proof of Concept

payable(receiver).transfer(amount); in https://github.com/debtdao/Line-of-Credit/blob/6987988fe39901cad9a8e5ebb2c6aa719590873d/contracts/utils/LineLib.sol#L48

Use address.call{value:x}() instead.

#0 - c4-judge

2022-11-17T15:47:40Z

dmvt marked the issue as duplicate of #14

#1 - c4-judge

2022-11-17T19:18:10Z

dmvt marked the issue as partial-50

#2 - c4-judge

2022-12-06T14:43:20Z

dmvt marked the issue as full credit

#3 - c4-judge

2022-12-06T14:43:24Z

dmvt marked the issue as satisfactory

#4 - C4-Staff

2022-12-20T05:56:43Z

liveactionllama marked the issue as duplicate of #369

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