Kuiper contest - 0xsanson's results

Automated portfolio protocol.

General Information

Platform: Code4rena

Start Date: 16/09/2021

Pot Size: $50,000 USDC

Total HM: 26

Participants: 30

Period: 7 days

Judge: GalloDaSballo

Total Solo HM: 17

Id: 36

League: ETH

Kuiper

Findings Distribution

Researcher Performance

Rank: 11/30

Findings: 4

Award: $1,515.58

🌟 Selected for report: 2

πŸš€ Solo Findings: 1

Findings Information

🌟 Selected for report: 0xsanson

Labels

bug
2 (Med Risk)
disagree with severity
sponsor confirmed

Awards

1001.9319 USDC - $1,001.93

External Links

Handle

0xsanson

Vulnerability details

Impact

The owner of Factory contract can modify the values of auctionMultiplier and auctionDecrement at any time. During an auction, these values are used to calculate newRatio and thereby tokensNeeded: specifically, it's easy to set the factory parameters so that tokensNeeded = 0 (or close to zero) for every token. This way the owner can participate at an auction, change the parameters, and get the underlying tokens from a Basket without transferring any pending tokens.

Proof of Concept

https://github.com/code-423n4/2021-09-defiProtocol/blob/main/contracts/contracts/Auction.sol#L89-L99

Tools Used

editor

Consider adding a Timelock to these Factory functions. Otherwise a way to not modify them if an auction is ongoing (maybe Auction saves the values it reads when startAuction is called).

#0 - frank-beard

2021-09-28T20:47:30Z

the owner for this is intended to be a dao that acts in support of the protocol, however this is a good point to the centralization concerns for the protocol, we will most likely manage this by adding a timelock to these function

#1 - GalloDaSballo

2021-12-19T00:01:18Z

Agree with the finding from the warden, highly recommend the sponsor to add these possibilities in their docs to make it easy for users to understand them.

That said, a possible remediation would also be to add checks in the setters, to avoid for these specific edge cases.

Because the exploit is dependent on an external condition (setting to a specific value by governance), the finding is of medium severity

Findings Information

🌟 Selected for report: jonah1005

Also found by: 0xRajeev, 0xsanson, cmichel, itsmeSTYJ

Labels

bug
duplicate
2 (Med Risk)
disagree with severity
sponsor confirmed

Awards

131.4735 USDC - $131.47

External Links

Handle

0xsanson

Vulnerability details

Impact

In Basket.sol, approveUnderlying is used to approve tokens to be spent by the Auction. The current implementation uses a simple approve function, instead of the safer safeApprove. Also it's recommended to have an approve to zero first, since the allowance could be already positive and some tokens (e.g. USDT) wouldn't work in this case.

Proof of Concept

https://github.com/code-423n4/2021-09-defiProtocol/blob/main/contracts/contracts/Basket.sol#L226

Tools Used

editor

Consider writing

IERC20(tokens[i]).safeApprove(spender, 0); IERC20(tokens[i]).safeApprove(spender, type(uint256).max);

#0 - GalloDaSballo

2021-12-19T15:55:07Z

Duplicate of #35

Findings Information

🌟 Selected for report: tensors

Also found by: 0xRajeev, 0xsanson, goatbug, pauliax

Labels

bug
duplicate
1 (Low Risk)
sponsor confirmed

Awards

43.8245 USDC - $43.82

External Links

Handle

0xsanson

Vulnerability details

Impact

In Auction.settleAuction, the auctionBonder can withdraw some bounty tokens from the contract. Since these can be any tokens, the bonder can donate his special """token""" first, then call settleAuction: at the line withdrawBounty(bountyIDs) the execution is passed to their custom contract. A re-entrancy here is also possible since auctionOngoing and hasBonded are modified only at the end of the function. I don't see how this can cause any issue at the moment, but if in the future this contract and Basket.sol are upgraded it's better to play safe and mitigate possible issues now.

Proof of Concept

https://github.com/code-423n4/2021-09-defiProtocol/blob/main/contracts/contracts/Auction.sol#L102

Tools Used

editor

Consider moving auctionOngoing = false and hasBonded = false before any uncontrolled external contract call.

#1 - GalloDaSballo

2021-12-20T01:04:39Z

Duplicate of #270

Findings Information

🌟 Selected for report: 0xsanson

Labels

bug
1 (Low Risk)
sponsor confirmed

Awards

333.9773 USDC - $333.98

External Links

Handle

0xsanson

Vulnerability details

Impact

In Basket.sol, handleFees computes the following: uint256 newIbRatio = ibRatio * startSupply / totalSupply().

In the case that totalSupply() = 0 (every holder burned their basket), the function reverts since there's a 0/0. This issue won't let new people mint, since handleFees is called before any minting.

Proof of Concept

https://github.com/code-423n4/2021-09-defiProtocol/blob/main/contracts/contracts/Basket.sol#L124

Tools Used

editor

Consider adding a check before the division.

if (startSupply == 0) { return; }

#0 - GalloDaSballo

2021-12-12T16:26:15Z

I agree with the finding

I think the warden may have missed a bigger issue (you seem to not be able to mint as mint calls handleFees)

Given the info received the finding is valid, and the severity is valid as well

Highly recommend the sponsor checks the revert for minting as well

Findings Information

🌟 Selected for report: goatbug

Also found by: 0xRajeev, 0xsanson, WatchPug, chasemartin01, hack3r-0m, pauliax

Labels

bug
duplicate
G (Gas Optimization)
sponsor confirmed

Awards

4.3799 USDC - $4.38

External Links

Handle

0xsanson

Vulnerability details

Impact

The function Factory.proposeBasketLicense isn't used inside Factory contract, so it can be set to external to save gas.

Proof of Concept

https://github.com/code-423n4/2021-09-defiProtocol/blob/main/contracts/contracts/Factory.sol#L65

#1 - GalloDaSballo

2021-11-29T14:12:54Z

Duplicate of #240

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