Skip to content

Code4rena

Caviar Private Pools

Every publicly disclosed report for Caviar Private Pools and what kind of bugs they were.

disclosed reports
28
most reported class
Business logic
bug classes found
4
first disclosure
2023
Find Caviar Private Pools on bugbounty.fyi Current scope, rewards and status, if it runs a public program.

Disclosed reports

Newest first. Only what Caviar Private Pools chose to make public.

Business logic

Factory.create : Predictability of pool address creates multiple issues.

The address of a new PrivatePool was derived only from a user-supplied salt, so anyone watching the public mempool could front-run a create transaction with the same salt to deploy a pool at the expected address. This let an attacker capture a user's subsequent deposit or repeatedly block pool creation.

Caviar Private Pools

Medium
Business logic

Flash loan fee is incorrect in Private Pool contract

The flash loan fee in the Private Pool contract was incorrectly set to the raw changeFee value without scaling, so a changeFee of 25 resulted in a flash loan fee of only 25 wei instead of the intended 0.0025 ETH. An attacker could borrow NFTs via flash loans for almost no fee.

Caviar Private Pools

Medium
Business logic

Loss of funds for traders due to accounting error in royalty calculations

The buy and sell functions in PrivatePool collected royalty fees from traders even when the royalty recipient address was zero, but did not transfer those fees to anyone. This caused traders to lose the royalty amount, which remained stuck in the pool contract.

Caviar Private Pools

Medium
Smart contracts

Royalty recipients will not get fair share of royalties

Royalties for NFTs bought together are calculated by dividing the total sale price equally among all NFTs, ignoring each NFT's weight. This means recipients of more expensive NFTs receive less royalty than they should, while cheaper NFTs get more.

Caviar Private Pools

Medium
Business logic

EthRouter can’t perform multiple changes

The EthRouter contract's change function sends the entire msg.value to each pool in a loop, but after the first iteration the router's balance is reduced, causing subsequent iterations to fail with an out-of-funds error. This prevents users from performing multiple changes in a single transaction.

Caviar Private Pools

Medium
Smart contracts

Risk of silent overflow in reserves update

The buy and sell functions cast uint256 values to uint128 without checking for overflow, so a trade with large amounts could silently wrap the virtual reserves. This would break the constant-product pricing invariant and lead to incorrect price calculations, potentially causing financial losses.

Caviar Private Pools

High
Smart contracts

Royalty receiver can drain a private pool

The royalty fee calculation in the buy function calls _getRoyalty twice, with an untrusted external call in between. A malicious royalty receiver could change the royalty fee between the two calls, causing the pool to pay the full sale price to the royalty receiver while the buyer pays nothing to the pool, allowing the pool to be drained.

Caviar Private Pools

High
Smart contracts

changeFeeQuote will fail for low decimal ERC20 tokens

The changeFeeQuote function in PrivatePool calculates a fee exponent by subtracting 4 from the token's decimals. For ERC20 tokens with fewer than 4 decimals, this subtraction underflows and reverts, causing any call to change or changeFeeQuote to fail.

Caviar Private Pools

Medium
Business logic

Flashloan fee is not distributed to the factory

The flashloan function in PrivatePool sends the entire fee to the pool, while the factory receives no protocol fee, unlike other functions such as change. An attacker could take flashloans repeatedly and the protocol would lose the fee revenue it should have earned.

Caviar Private Pools

Medium
Business logic

Incorrect protocol fee is taken when changing NFTs

The protocol fee for changing NFTs was calculated as a percentage of the pool fee rather than the input amount, making it extremely low. This resulted in a loss of yield for the Caviar protocol.

Caviar Private Pools

Medium
Business logic

PrivatePool.flashLoan() takes fee from the wrong address

The flashLoan function takes the fee from the caller (msg.sender) instead of the receiver of the callback, contrary to the EIP-3156 specification. This can cause an unexpected loss of funds for a caller who has pre-approved the pool to spend their tokens and is not the owner of the flashloan contract.

Caviar Private Pools

Medium
Access control

PrivatePool owner can steal all ERC20 and NFT from user via arbitrary execution

The PrivatePool contract's execute function lets the pool owner make arbitrary calls to any contract, so a malicious owner can use a user's token approvals to the pool to transfer the user's ERC20 tokens or NFTs to themselves. The report demonstrates stealing an ERC20 balance after the victim approved the pool.

Caviar Private Pools

High
Audit finding

Malicious royalty recipient can steal excess eth from buy orders

A malicious royalty recipient could reenter the buy function in EthRouter.sol and steal excess ether that was refunded to the router during a user's buy order. The attacker could drain all ether held by the router before the original transaction completed.

Caviar Private Pools

Medium
Business logic

Missing deadline checks allow pending transactions to be maliciously executed

The Pair contract's trading functions lack a deadline parameter, so pending transactions can be executed much later when market conditions have changed. An attacker could exploit this via MEV to sandwich a stale transaction, causing significant loss to the user.

Caviar Private Pools

Medium
Business logic

Liquidity providers may lose funds when adding liquidity

When adding liquidity to a two-token pool, the contract mints LP tokens using the smaller of the two proportional shares, so any imbalance between the deposited token amounts is left in the pool as a donation. A liquidity provider who deposits at a skewed ratio therefore receives fewer LP tokens than their deposit is worth and loses part of their funds on withdrawal.

Caviar Private Pools

High
Business logic

It’s possible to swap NFT token ids without fee and also attacker can wrap unwrap all the NFT token balance of the Pair contract and steal their air drops for those token ids

The Pair contract's wrap and unwrap functions do not track which specific NFT token IDs a user deposited, so anyone can wrap one whitelisted NFT and unwrap a different whitelisted NFT without paying a fee. An attacker could also repeatedly unwrap and re-wrap every NFT held by the contract to claim airdrops meant for all liquidity providers.

Caviar Private Pools

Medium
Audit finding

Pair price may be manipulated by direct transfers

The Pair contract calculates token prices from its current token balances, which an attacker can change by transferring tokens directly to the contract. This allows manipulation of the price returned by the public price function, potentially enabling theft from third-party integrations that use it as an oracle.

Caviar Private Pools

Medium
Smart contracts

First depositor can break minting of shares

The pair contract mints LP shares using a formula that rounds down, so an attacker who seeds the pool with a tiny amount and then donates a large amount directly to the pair can make each share extremely valuable. Later depositors adding less than the inflated reserve then receive zero LP tokens for their deposit.

Caviar Private Pools

High
Smart contracts

Rounding error in buyQuote might result in free tokens

The buyQuote function in a Solidity contract rounded the required base-token payment down instead of up, so a buyer could sometimes pay zero base tokens for a small amount of fractional tokens. An attacker could repeatedly buy tiny amounts of fractional tokens for free, reducing the fractional token reserve and short-changing liquidity providers on fees.

Caviar Private Pools

Medium