Blur Exchange contest - corerouter's results

An NFT exchange.

General Information

Platform: Code4rena

Start Date: 11/11/2022

Pot Size: $36,500 USDC

Total HM: 5

Participants: 62

Period: 3 days

Judge: berndartmueller

Id: 181

League: ETH

Blur Exchange

Findings Distribution

Researcher Performance

Rank: 37/62

Findings: 1

Award: $66.81

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

66.8068 USDC - $66.81

Labels

bug
2 (Med Risk)
satisfactory
duplicate-90

External Links

Lines of code

https://github.com/code-423n4/2022-11-non-fungible/blob/main/contracts/Exchange.sol#L161 https://github.com/code-423n4/2022-11-non-fungible/blob/main/contracts/Exchange.sol#L209

Vulnerability details

Impact

The current implementation of _returnDust() does not check assembly call's return value. So even if the call does not succeed, the whole execute() transaction will succeed. In this way, a user's ETH may be stuck in the contract if _returnDust() fails to send back ETH and will be claimed by another user later on.

Proof of Concept

https://github.com/code-423n4/2022-11-non-fungible/blob/main/contracts/Exchange.sol#L161

https://github.com/code-423n4/2022-11-non-fungible/blob/main/contracts/Exchange.sol#L209

https://github.com/code-423n4/2022-11-non-fungible/blob/323b7cbf607425dd81da96c0777c8b12e800305d/contracts/Exchange.sol#L212-L227

Tools Used

Modify current implementation of _returnDust() to check assembly call's return value and change the codes to as follows.

function _returnDust() private { bool callStatus = true;

uint256 _remainingETH = remainingETH; assembly { if gt(_remainingETH, 0) { callStatus := call( gas(), caller(), selfbalance(), 0, 0, 0, 0 ) } } require(callStatus, "Return dust failed"); }

#0 - c4-judge

2022-11-16T11:56:10Z

berndartmueller marked the issue as duplicate of #90

#1 - c4-judge

2022-11-16T11:56:17Z

berndartmueller 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