Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The execution of an order transfers 1 token regardless of Order.amount #807

Closed
code423n4 opened this issue Oct 10, 2022 · 2 comments
Closed
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate This issue or pull request already exists sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-10-blur/blob/2fdaa6e13b544c8c11d1c022a575f16c3a72e3bf/contracts/matchingPolicies/StandardPolicyERC1155.sol#L33
https://github.com/code-423n4/2022-10-blur/blob/2fdaa6e13b544c8c11d1c022a575f16c3a72e3bf/contracts/matchingPolicies/StandardPolicyERC1155.sol#L59

Vulnerability details

Impact

An order can be placed for an arbitrary amount, which is relevant for ERC1155. But when matched and executed only 1 token is transferred. This can lead to problems with accounting for the user, expecting a transfer of Order.amount tokens, potentially with a loss of funds as a consequence.

Proof of Concept

StandardPolicyERC1155.sol hardcodes a return value of 1, which is passed to BlurExchange as the amount used in the transferERC1155() function.

Tools Used

Code inspection

Recommended Mitigation Steps

Consider amending StandardPolicyERC1155.sol to make use of the Order.amount for ERC1155, either by allowing for the transfer of more than one token or by returning false in canMatchMakerAsk() and canMatchMakerBid for a match where Order.amount != 1 (e.g. by adding ... && makerAsk.amount == 1 && takerBid.amount == 1 to the bool return).

@code423n4 code423n4 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels Oct 10, 2022
code423n4 added a commit that referenced this issue Oct 10, 2022
@blur-io-toad
Copy link

This was an oversight on my part for not putting this contract as out-of-scope. Our marketplace does not handle ERC1155 yet and so we haven't concluded what the matching critieria for those orders will be. This contract was mainly created to test ERC1155 transfers through the rest of the exchange, but shouldn't be deployed initially. When we are prepared to handle ERC1155 orders we will have to develop a new matching policy that determines the amount from the order parameters. Acknowledging that it's incorrect, but won't be making any changes as the contract won't be deployed.

@blur-io-toad blur-io-toad added the sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons label Oct 16, 2022
@GalloDaSballo GalloDaSballo removed the 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value label Oct 26, 2022
@GalloDaSballo
Copy link
Collaborator

Dup of #666

@GalloDaSballo GalloDaSballo added duplicate This issue or pull request already exists 3 (High Risk) Assets can be stolen/lost/compromised directly labels Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate This issue or pull request already exists sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Projects
None yet
Development

No branches or pull requests

3 participants