Blur Exchange contest - rvierdiiev'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: 28/80

Findings: 2

Award: $147.47

🌟 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/BlurExchange.sol#L433

Vulnerability details

Impact

Order amount value is ignored. If seller created order to sell amount of 3 ERC1155 tokens and buyer execute that order then in the end buyer will pay all price amiunt, but will receive only 1 token.

BlurExchange.execute function receives token amount that should be sent to buyer from matching policies.

function _canMatchOrders(Order calldata sell, Order calldata buy)
        internal
        view
        returns (uint256 price, uint256 tokenId, uint256 amount, AssetType assetType)
    {
        bool canMatch;
        if (sell.listingTime <= buy.listingTime) {
            /* Seller is maker. */
            require(policyManager.isPolicyWhitelisted(sell.matchingPolicy), "Policy is not whitelisted");
            (canMatch, price, tokenId, amount, assetType) = IMatchingPolicy(sell.matchingPolicy).canMatchMakerAsk(sell, buy);
        } else {
            /* Buyer is maker. */
            require(policyManager.isPolicyWhitelisted(buy.matchingPolicy), "Policy is not whitelisted");
            (canMatch, price, tokenId, amount, assetType) = IMatchingPolicy(buy.matchingPolicy).canMatchMakerBid(buy, sell);
        }
        require(canMatch, "Orders cannot be matched");

        return (price, tokenId, amount, assetType);
    }

However StandardPolicyERC1155 always returns the amount of 1 and do not check the amount that was provided by seller and buyer. 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

That means that buyer will pay more if amount of seller order is bigger then 1. And the main thing is that he paid for few tokens, but received only 1.

Proof of Concept

Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.

Tools Used

If provided amount is 0 then do not send tokens. Add checking of the identical amount in seller's order and buyer's order. And then return correct amount.

#0 - GalloDaSballo

2022-10-13T22:30:12Z

Awards

32.6464 USDC - $32.65

Labels

bug
G (Gas Optimization)

External Links

#0 - GalloDaSballo

2022-10-21T00:21:18Z

Presentation is abysmal, you're not explaining the reEntrancy gas savings, I'm considering closing

#1 - GalloDaSballo

2022-10-22T23:25:16Z

5k

#2 - GalloDaSballo

2022-10-22T23:25:33Z

Will penalize for presentation vs other reports

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