Caviar Private Pools - sces60107'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: 73/120

Findings: 1

Award: $26.76

🌟 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/EthRouter.sol#L166 https://github.com/code-423n4/2023-04-caviar/blob/main/src/EthRouter.sol#L244 https://github.com/code-423n4/2023-04-caviar/blob/main/src/EthRouter.sol#L270

Vulnerability details

Impact

EthRouter calls ERC721(nft).setApprovalForAll in many functions. It gives the full approval of NFT to the pools. An attacker can make EthRouter give the full approval of NFTs to a malicious pool address by passing the fake pool address to those functions.

Proof of Concept

Many functions in EthRouter call ERC721(nft).setApprovalForAll to set the full approval of NFT to the pool. deposit() is one of them. https://github.com/code-423n4/2023-04-caviar/blob/main/src/EthRouter.sol#L244

function deposit( address payable privatePool, address nft, uint256[] calldata tokenIds, uint256 minPrice, uint256 maxPrice, uint256 deadline ) public payable { … // approve pair to transfer NFTs from router ERC721(nft).setApprovalForAll(privatePool, true); … }

An attacker can call EthRouter.deposit() with a malicious pool address and any NFT address. Then the malicious pool has the full control of those NFTs on EthRouter

Tools Used

Manual Review

Do not use setApprovalForAll if the private pool address isn’t fully-trusted. Use approve for each NFT token.

#0 - c4-pre-sort

2023-04-20T16:40:43Z

0xSorryNotSorry marked the issue as duplicate of #184

#1 - c4-judge

2023-05-01T19:21:21Z

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