InsureDAO contest - danb'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: 3/37

Findings: 7

Award: $5,356.01

🌟 Selected for report: 1

πŸš€ Solo Findings: 2

Findings Information

🌟 Selected for report: danb

Labels

bug
3 (High Risk)
disagree with severity
sponsor acknowledged

Awards

3799.5139 INSURE - $1,329.83

2306.8477 USDC - $2,306.85

External Links

Handle

danb

Vulnerability details

https://github.com/code-423n4/2022-01-insure/blob/main/contracts/PoolTemplate.sol#L807 if there is no liquidity in the pool, the first deposit determines the total liquidity, if the amount is too small the minted liquidity for the next liquidity providers will round down to zero.

Impact

An attacker can steal all money from liquidity providers.

Proof of Concept

consider the following scenario: a pool is created. the attacker is the first one to deposit, they deposit with _amount == 1, the smallest amount possible. meaning the total liquidity is 1. then they join another pool in order to get attributions in the vault. they transfer the attributions to the pool using transferAttribution. for example, they transferred 1M dollar worth of attributions. the next person deposits in the index, for example, 500,000 dollars. https://github.com/code-423n4/2022-01-insure/blob/main/contracts/PoolTemplate.sol#L803 the amount they will get is:

_amount = (_value * _supply) / _originalLiquidity;

as we know: _amount = 500,000 dollar _supply = 1 _totalLiquidity = 1,000,000 dollar (the attacker transferred directly) the investor will get (500,000 dollar * 1) / (1,000,000 dollar) = 0 and they will pay 500,000 this money will go to the index, and the attacker holds all of the shares, so they can withdraw it and get 1,500,000 stealing 500,000 dollars from the second investor.

Tools Used

manual review

#0 - oishun1112

2022-01-20T08:21:15Z

yes. Every address that has attributions can call transferAttribution(), however, the address has to call addValue() to earn attributions. addValue() has onlyMarket modifier. To pass onlyMarket modifier, ownership has to be stolen, in short.

#1 - oishun1112

2022-01-20T08:22:03Z

Since we assume ownership control is driven safely, we don't take this as an issue.

#2 - 0xean

2022-01-27T15:24:46Z

Agree with warden that the privilege addresses should not be able to use approvals in a way that rugs users funds.

Based on the fact that we have seen many rug pulls in the space based on compromised "owner" keys, this is a valid attack path.

3 β€” High: Assets can be stolen/lost/compromised directly (or indirectly if there is a valid attack path that does not have hand-wavy hypotheticals).

Findings Information

🌟 Selected for report: WatchPug

Also found by: danb

Labels

bug
duplicate
3 (High Risk)

Awards

1709.7813 INSURE - $598.42

1038.0815 USDC - $1,038.08

External Links

Handle

danb

Vulnerability details

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

_redeemAmount should be _deductionFromIndex multiplied by _shareOfIndex, not divided. this would lead to a wrong distribution of payments.

Findings Information

🌟 Selected for report: Dravee

Also found by: Fitraldys, Ruhum, WatchPug, danb, egjlmn1, robee

Labels

bug
duplicate
2 (Med Risk)
sponsor disputed

Awards

86.5379 INSURE - $30.29

52.5409 USDC - $52.54

External Links

Handle

danb

Vulnerability details

https://github.com/code-423n4/2022-01-insure/blob/main/contracts/PoolTemplate.sol#L671 https://github.com/code-423n4/2022-01-insure/blob/main/contracts/PoolTemplate.sol#L703

the functions applyCover and resume iterate over unbounded array. anyone can create an index and add it to the pool, therefore it is possible to add many indexes and prevent any call to applyCover and resume because of passing the gas limit.

#0 - oishun1112

2022-01-13T05:49:31Z

only the single pool can be created permission less. index can be created via governance.

#1 - 0xean

2022-01-27T21:15:51Z

dupe of #352

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