InsureDAO contest - p4st13r4's results

Anyone can create an insurance pool like Uniswap.

General Information

Platform: Code4rena

Start Date: 07/01/2022

Pot Size: $80,000 USDC

Total HM: 21

Participants: 37

Period: 7 days

Judge: 0xean

Total Solo HM: 14

Id: 71

League: ETH

InsureDAO

Findings Distribution

Researcher Performance

Rank: 7/37

Findings: 6

Award: $3,184.57

🌟 Selected for report: 9

πŸš€ Solo Findings: 2

Findings Information

🌟 Selected for report: loop

Also found by: p4st13r4, ye0lde

Labels

bug
duplicate
3 (High Risk)

Awards

1025.8688 INSURE - $359.05

622.8489 USDC - $622.85

External Links

Handle

p4st13r4

Vulnerability details

Impact

There is a typo in the unlock function, when setting the status of an insurance to false.

function unlock(uint256 _id) public {
    require(
        insurances[_id].status == true &&
            marketStatus == MarketStatus.Trading &&
            insurances[_id].endTime + parameters.getGrace(msg.sender) <
            block.timestamp,
        "ERROR: UNLOCK_BAD_COINDITIONS"
    );
    insurances[_id].status == false;

    lockedAmount = lockedAmount - insurances[_id].amount;

    emit Unlocked(_id, insurances[_id].amount);
}

Instead of doing:

insurances[_id].status = false;

The code just asserts an inequality, by using the == instead of =, like so:

insurances[_id].status == false;

This results in funds stuck and never really unlocked. Also, a malicious actor could bring the value of lockedAmount to zero by unlocking the same insurance multiple times, which would break the economy of the pool.

Proof of Concept

I don’t think a POC is needed, since the typo is evident: https://github.com/code-423n4/2022-01-insure/blob/main/contracts/PoolTemplate.sol#L360

Tools Used

Editor

Use assignment instead of comparison, as stated above

Findings Information

🌟 Selected for report: p4st13r4

Labels

bug
2 (Med Risk)
sponsor disputed

Awards

1139.8542 INSURE - $398.95

692.0543 USDC - $692.05

External Links

Handle

p4st13r4

Vulnerability details

Impact

Any user can pay the debt for any borrower in Vault.sol, by using repayDebt(). This function allows anyone to repay any amount of borrowed value, up-to and including the totalDebt value; it works by setting the debts[_target] to zero, and decreasing totalDebt by the given amount, up to zero. However, all debts of the other borrowers are left untouched.

If a malicious (but generous) user were to repay the debt for all the borrowers, markets functionality regarding borrowing would be DOSed: the vault would try to decrease the debt of the market, successfully, but would fail to decrease totalDebt as it would result in an underflow

Proof of Concept

https://github.com/code-423n4/2022-01-insure/blob/main/contracts/Vault.sol#L257

Tools Used

Editor

Make repayDebt() accept an amount up-to and including the value of the debt for the given borrower

#0 - oishun1112

2022-01-28T06:03:06Z

this needs to be specified how in more detail.

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