Caviar Private Pools - JGcarv'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: 44/120

Findings: 2

Award: $99.40

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

26.761 USDC - $26.76

Labels

bug
3 (High Risk)
satisfactory
duplicate-184

External Links

Lines of code

https://github.com/code-423n4/2023-04-caviar/blob/main/src/PrivatePool.sol#L459

Vulnerability details

Impact

Sellers that interact directly with the PrivatePool need to approve tokens beforehand, and due to the convenience, it's common practice to approveAll to avoid multiple transactions.

With that in mind, allowing the owner to execute arbitrary transactions, allows for taking tokens from previous sellers that haven't revoked the approval, effectively stealing them.

Proof of Concept

Tools Used

Manual review.

Ideally, remove the execute function, as the potential flaws are greater than the possible benefit.

If that's not desired, then prevent calls to the pool's nft and baseToken

#0 - c4-pre-sort

2023-04-20T16:40:35Z

0xSorryNotSorry marked the issue as duplicate of #184

#1 - c4-judge

2023-05-01T19:21:22Z

GalloDaSballo marked the issue as satisfactory

Awards

26.761 USDC - $26.76

Labels

bug
3 (High Risk)
satisfactory
duplicate-184

External Links

Lines of code

https://github.com/code-423n4/2023-04-caviar/blob/main/src/PrivatePool.sol#L459

Vulnerability details

Impact

Buyers that interact directly with the PrivatePool need to approve tokens beforehand, and due to the convenience, it's common practice to the maximum limit.

With that in mind, allowing the owner to execute arbitrary transactions, allows for taking erc20 tokens from previous buyers that haven't revoked the approval, effectively stealing them.

Proof of Concept

Tools Used

Manual review.

Ideally, remove the execute function, as the potential flaws are greater than the possible benefit.

If that's not desired, then prevent calls to the pool's nft and baseToken

#0 - c4-pre-sort

2023-04-20T16:40:32Z

0xSorryNotSorry marked the issue as duplicate of #184

#1 - c4-judge

2023-05-01T19:21:23Z

GalloDaSballo marked the issue as satisfactory

Findings Information

🌟 Selected for report: Voyvoda

Also found by: CodingNameKiki, DishWasher, GT_Blockchain, J4de, JGcarv, Josiah, RaymondFam, neumo, saian

Labels

bug
2 (Med Risk)
satisfactory
duplicate-463

Awards

72.6437 USDC - $72.64

External Links

Lines of code

https://github.com/code-423n4/2023-04-caviar/blob/main/src/PrivatePool.sol#L737

Vulnerability details

Impact

The provided function changeFeeQuote returns different value for protocol fees than what should be charged, which affect all changes on private pools.

It currently takes the percentage of the feeAmount

protocolFeeAmount = feeAmount * Factory(factory).protocolFeeRate() / 10_000;

While other functions take the protocolFee from the total value of the purchase.

Change to:

protocolFeeAmount = inputAmount * Factory(factory).protocolFeeRate() / 10_000;

#0 - c4-pre-sort

2023-04-20T16:36:36Z

0xSorryNotSorry marked the issue as duplicate of #463

#1 - c4-judge

2023-05-01T07:21:31Z

GalloDaSballo marked the issue as satisfactory

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