Debt DAO contest - 8olidity'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: 115/120

Findings: 2

Award: $6.71

🌟 Selected for report: 0

🚀 Solo Findings: 0

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

Only msg.value > amount is allowed here, but the excess(msg.value - amount) is not returned to the user.

Proof of Concept

    function receiveTokenOrETH(
      address token,
      address sender,
      uint256 amount
    )
      external
      returns (bool)
    {
        if(token == address(0)) { revert TransferFailed(); }
        if(token != Denominations.ETH) { // ERC20
            IERC20(token).safeTransferFrom(sender, address(this), amount);
        } else { // ETH
            if(msg.value < amount) { revert TransferFailed(); } // @audit  
        }
        return true;
    }

Tools Used

vscode

payable(sender).transfer(msg.value - amout);

#0 - c4-judge

2022-11-15T20:47:53Z

dmvt marked the issue as duplicate of #25

#1 - c4-judge

2022-11-17T19:27:23Z

dmvt marked the issue as partial-50

#2 - C4-Staff

2022-12-20T06:44:54Z

liveactionllama marked the issue as duplicate of #39

Awards

2.6694 USDC - $2.67

Labels

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

External Links

Lines of code

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

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:

Proof of Concept

    function sendOutTokenOrETH(
      address token,
      address receiver,
      uint256 amount
    )
      external
      returns (bool)
    {
        if(token == address(0)) { revert TransferFailed(); }
        
        // both branches revert if call failed
        if(token!= Denominations.ETH) { // ERC20
            IERC20(token).safeTransfer(receiver, amount);
        } else { // ETH
            payable(receiver).transfer(amount); // @audit 
        }
        return true;
    }

Tools Used

vscode

use call()

#0 - c4-judge

2022-11-15T20:43:58Z

dmvt marked the issue as duplicate of #14

#1 - c4-judge

2022-11-17T19:19:58Z

dmvt marked the issue as partial-50

#2 - 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