Caviar Private Pools - devscrooge's results

A fully on-chain NFT AMM that allows you to trade every NFT in a collection.

General Information

Platform: Code4rena

Start Date: 07/04/2023

Pot Size: $47,000 USDC

Total HM: 20

Participants: 120

Period: 6 days

Judge: GalloDaSballo

Total Solo HM: 4

Id: 230

League: ETH

Caviar

Findings Distribution

Researcher Performance

Rank: 58/120

Findings: 2

Award: $42.54

QA:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

11.5407 USDC - $11.54

Labels

bug
3 (High Risk)
partial-50
duplicate-167

External Links

Lines of code

https://github.com/code-423n4/2023-04-caviar/blob/main/src/PrivatePool.sol#L230 https://github.com/code-423n4/2023-04-caviar/blob/main/src/PrivatePool.sol#L231 https://github.com/code-423n4/2023-04-caviar/blob/main/src/PrivatePool.sol#L323 https://github.com/code-423n4/2023-04-caviar/blob/main/src/PrivatePool.sol#L324

Vulnerability details

Description

For all of the mentioned lines there is a downcasting from uint256 to uint128

Impact

The maximum value for a uint128 is (2^128) - 1, this means that if the value that is trying to be casted is greater than (2^128) -1 it will be wrongly trancated.

Tools Used

Manual review

Use uint256 instead of trying to downcast to uint128.

#0 - c4-pre-sort

2023-04-20T18:04:47Z

0xSorryNotSorry marked the issue as duplicate of #625

#1 - c4-judge

2023-04-27T08:54:18Z

GalloDaSballo marked the issue as duplicate of #167

#2 - c4-judge

2023-05-02T07:56:36Z

GalloDaSballo marked the issue as partial-50

#3 - GalloDaSballo

2023-05-02T07:56:39Z

Insufficient description -> 50%

Awards

30.9954 USDC - $31.00

Labels

bug
grade-b
QA (Quality Assurance)
Q-09

External Links

[L-01] No Tracking of Deposits

Lines of Code

Vulnerability Details

Description

Users can make deposits of ERC721, baseTokens, and nativeETH, but the protocol does not track how much each user has deposited.

Impact

In the future, if a functionality such as an airdrop requires knowledge of how much each user has deposited on the protocol, it will not be possible to implement it.

Tools Used

Manual review

Include one or more mappings to track the amount of ERC721, baseTokens, or nativeETH each user has deposited.


[L-02] Change important variables without informing

Lines of Code

Vulnerability Details

Description

These functions are used to modify variables that play an important role in the protocol. Changing them directly, without alerting the users of the change, can lead to situations where users are unaware of the modification.

Tools Used

Manual review.

Implement a mechanism that ensures a time period between the submission of the variable change by the owner and the actual modification of these variables.

[L-03]

Lines of Code

Vulnerability Details

Description

All the functions inside PrivatePool are implemented for handling both, native ETH and other ERC20 as base tokens but in EthRouter.sol it is said that The only base token which is supported is native ETH.

Tools Used

Manual review.

Consider commenting why other ERC20 tokens are accepted as base tokens or change the implementation of PrivatePool.sol for only allow native ETH as base token.

[L-04] Slippage not checked

Lines of Code

Vulnerability Details

Description

It is said DO NOT call this function directly unless you know what you are doing. Instead, use a wrapper contract that but these function are from the EthRouter.sol contract here and here without checking the slipagge. In the case of the sell function, the output amount is tried to be checked here but as anyone can send ETH to the contract using the receive() function, the slippage check is not correctly done.

Impact

It can lead to a sell transaction with an unexpected amount of slippage for the user.

Tools Used

Manual review.

Check slippage.

[L-5] Unnecesary check statment

Lines of Code

Vulnerability Details

Description

According to EthRouter.sol the only supported native token is native ETH, if the implementation is changed for actually only support native ETH, then the baseToken != address(0) is not necessary here .

Tools Used

Manual review

Change to if (msg.value == 0) revert InvalidEthAmount();

[L-6] No reason for depositing

Vulnerability Details

Description

Users can deposit liquidity into a private pool but there is not benefit for doing it. The will earn nothing from providing liquidity to the private pool.

Impact

As there is no benefit from depositing liquidity, any user wont do it so the pools will remain with a low liquidity balance.

Tools Used

Manual review

Implement a mechanism for the users that have added liquidity to gain some earnings. For example earning fees from trades on the pool.

#0 - c4-judge

2023-05-01T08:51:08Z

GalloDaSballo marked the issue as grade-c

#1 - c4-judge

2023-05-04T18:32:56Z

GalloDaSballo marked the issue as grade-b

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