LooksRare Aggregator contest - Vadis's results

An NFT aggregator protocol.

General Information

Platform: Code4rena

Start Date: 08/11/2022

Pot Size: $60,500 USDC

Total HM: 6

Participants: 72

Period: 5 days

Judge: Picodes

Total Solo HM: 2

Id: 178

League: ETH

LooksRare

Findings Distribution

Researcher Performance

Rank: 21/72

Findings: 3

Award: $264.89

QA:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

Labels

bug
2 (Med Risk)
satisfactory
duplicate-241

Awards

151.3257 USDC - $151.33

External Links

#0 - c4-judge

2022-11-21T11:17:33Z

Picodes marked the issue as duplicate of #241

#1 - c4-judge

2022-12-16T13:56:41Z

Picodes marked the issue as satisfactory

Findings Information

Awards

77.2215 USDC - $77.22

Labels

bug
2 (Med Risk)
downgraded by judge
satisfactory
duplicate-277

External Links

Lines of code

https://github.com/code-423n4/2022-11-looksrare/blob/e3b2c053f722b0ca2dce3a3eb06f64859b8b7a6f/contracts/LooksRareAggregator.sol#L108-L109

Vulnerability details

Description

LooksRareAggregator.execute() at the end of execution send all unspent ETH and ERC20 back to actor. But it send all amount lying on the contract which may be bigger than initially sent by actor. So anyone seeing that there are some ETH or ERC20 tokens stuck on contract may just send with a call of ERC20EnabledLooksRareAggregator.execute() 1 token of each ERC20 with positive contract balance, some dummy trade order (which may fail) and isAtomic=false flag and get back all funds on contract in ETH and ERC20. There are special functions to rescue stuck ETH and ERC20 (TokenRescuer.rescueERC20() and TokenRescuer.rescueETH()) which can be called only by owner. So obviously by business-logic anyone shouldn't be able to get stuck ETH and ERC20.

Recommendation

Save initial amount and spent amount of ETH and ERC20 during fulfillment of all orders. Return only unused part of initially sent funds.

#0 - c4-judge

2022-11-19T09:59:41Z

Picodes marked the issue as duplicate of #277

#1 - c4-judge

2022-12-16T13:55:59Z

Picodes changed the severity to 2 (Med Risk)

#2 - c4-judge

2022-12-16T13:56:00Z

Picodes marked the issue as satisfactory

Awards

36.3434 USDC - $36.34

Labels

bug
downgraded by judge
grade-b
QA (Quality Assurance)
sponsor disputed
Q-22

External Links

Lines of code

https://github.com/code-423n4/2022-11-looksrare/blob/e3b2c053f722b0ca2dce3a3eb06f64859b8b7a6f/contracts/TokenRescuer.sol#L34-L38

Vulnerability details

Description

TokenRescuer.rescueERC20() is intended to rescue ERC20 tokens stuck in the contract. But it doesn't work correctly with tokens getting commission from sender (e.g. CacheGold). It tries to send exactly IERC20(currency).balanceOf(address(this)) - 1). There would not be enough balance for a commission, so any try to call TokenRescuer.rescueERC20() would revert and tokens would stuck forever.

Recommendation

Add amount parameter to TokenRescuer.rescueERC20(). Do not allow to use arbitrary ERC20 (use a whitelist).

#0 - Picodes

2022-11-19T12:40:27Z

There is a sort of whitelist as tokens needs to be approved in the aggregator, and I don't think this falls within High Risk as in the first place this function is to rescue stucked funds only and is not supposed to be used.

#1 - c4-judge

2022-11-19T12:40:37Z

Picodes changed the severity to QA (Quality Assurance)

#2 - c4-sponsor

2022-11-24T12:29:27Z

0xhiroshi marked the issue as sponsor disputed

#3 - c4-judge

2022-12-12T10:05:11Z

Picodes 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