Blur Exchange contest - arcoun's results

An NFT exchange for the Blur marketplace.

General Information

Platform: Code4rena

Start Date: 05/10/2022

Pot Size: $50,000 USDC

Total HM: 2

Participants: 80

Period: 5 days

Judge: GalloDaSballo

Id: 168

League: ETH

Blur Exchange

Findings Distribution

Researcher Performance

Rank: 7/80

Findings: 3

Award: $2,603.11

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

https://github.com/code-423n4/2022-10-blur/blob/main/contracts/matchingPolicies/StandardPolicyERC1155.sol#L33 https://github.com/code-423n4/2022-10-blur/blob/main/contracts/matchingPolicies/StandardPolicyERC1155.sol#L59 https://github.com/code-423n4/2022-10-blur/blob/main/contracts/lib/OrderStructs.sol#L19

Vulnerability details

Impact

Blur Exchange supports buying or selling several ERC1155 tokens by specifying the amount value in an Order structure. This is correctly implemented in the BlurExchange contract but not in the StandardPolicyERC1155 contract which fails to validate the amount and will always return 1 as the amount of the token.

A buyer wanted to buy several tokens will pay the full price and only get one token.

Proof of Concept

  • A buyer wants to buy 10 ERC1155-Famous-Token for 10 ether
  • He create and sign an order with amount = 10 and price = 10 ether
  • A seller with only one ERC1155-Famous-Token create and sign a related order (amount can be of any value in the order)
  • Someone calls execute() with the two orders
  • The transaction is executed. The seller get 10 ether, but the buyer only get 1 ERC1155-Famous-Token instead of 10

The amount value must be checked (both orders must have the same amount) and returns inside canMatchMakerAsk and canMatchMakerBid.

#0 - GalloDaSballo

2022-10-13T22:27:14Z

Findings Information

🌟 Selected for report: Soosh

Also found by: 0x1f8b, 0x4non, 0xc0ffEE, RaymondFam, Ruhum, RustyRabbit, Trust, arcoun, cccz, d3e4, minhtrng, rotcivegaf, saian, sakshamguruji

Labels

bug
duplicate
2 (Med Risk)

Awards

2437.8089 USDC - $2,437.81

External Links

Lines of code

https://github.com/code-423n4/2022-10-blur/blob/main/contracts/ExecutionDelegate.sol#L36-L39

Vulnerability details

Impact

The owner of the ExecutionDelegate contract can call approveContract() to add a new address allowed to transfer ERC20/ERC721/ERC1155 tokens.

As the BlurEchange contract is already upgradeable, there is no need to add any other addresses after the contract has been created/initialized.

If there are very valuable approvals on ExecutionDelegate or if the private key of the owner is compromised, this is a potential scenario.

Proof of Concept

  • A user wants to make a 10000 WETH offer on some ERC721/ERC1155
  • He call approve() on the WETH contract to approve the transfer by the ExecutionDelegate contract
  • The owner adds himself as an approved contract using approveContract()) and steal the 10000 WETH (and all other approved tokens) by calling transferERC20() (or the other transfer functions).

Remove Ownable, contracts, approveContract() and denyContract(). Add an imutable exchangeAddress address as the only allowed address to transfer tokens, and only set it in the constructor or initializer.

#0 - GalloDaSballo

2022-10-10T23:10:36Z

The finding looks valid Admin Privilege, historically Med

#1 - GalloDaSballo

2022-10-27T15:45:35Z

R

#2 - GalloDaSballo

2022-11-15T23:35:28Z

Dup of #235

Awards

50.4817 USDC - $50.48

Labels

bug
QA (Quality Assurance)

External Links

Lines of code

https://github.com/code-423n4/2022-10-blur/blob/main/contracts/BlurExchange.sol#L451-L453

Vulnerability details

Impact

The execute() function is payable to allow a buyer to directly provide Ether as payment. If a user does a mistake and send Ether while this is not expected, the Ether will be locked in the contract and not refunded.

Proof of Concept

  • A user wants to buy an ERC721 token for 1 ether, the related seller order has used paymentToken=WETH
  • The user approve the ExecutionDelegate contract for WETH or already has an old approval
  • He creates an order and execute it, mistakenly adding 1 Ether as payment
  • The trade is executed using 1 WETH but the additional 1 Ether is lost and locked in the contract

The _executeFundsTransfer function must ensure that msg.value is zero when a direct payment is not expected.

#0 - GalloDaSballo

2022-10-13T21:11:49Z

Dup of #634

#1 - GalloDaSballo

2022-11-09T13:42:44Z

L

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