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

Buying non-ERC721 NFTs is not supported #142

Open
code423n4 opened this issue Sep 18, 2022 · 3 comments
Open

Buying non-ERC721 NFTs is not supported #142

code423n4 opened this issue Sep 18, 2022 · 3 comments
Labels
bug Something isn't working QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/PartyDAO/party-contracts-c4/blob/3896577b8f0fa16cba129dc2867aba786b730c1b/contracts/crowdfund/BuyCrowdfundBase.sol#L128-L139

Vulnerability details

Impact

The _buy function of the BuyCrowdfundBase contract can call any function of any contract to buy any NFT (like cryptopunks), but since cryptopunks does not have the ownerOf function, this prevents the contract from buying non-ERC721 standard NFTs like cryptopunks even if it raises enough Eth.

        {
            // Execute the call to buy the NFT.
            (bool s, bytes memory r) = callTarget.call{ value: callValue }(callData);
            if (!s) {
                r.rawRevert();
            }
        }
        // Make sure we acquired the NFT we want.
        if (token.safeOwnerOf(tokenId) != address(this)) {
            revert FailedToBuyNFTError(token, tokenId);
        }

And the AuctionCrowdfund contract does not support bidding for non-ERC721 standard NFTs.

Proof of Concept

https://github.com/PartyDAO/party-contracts-c4/blob/3896577b8f0fa16cba129dc2867aba786b730c1b/contracts/crowdfund/BuyCrowdfundBase.sol#L128-L139

Tools Used

None

Recommended Mitigation Steps

Consider filtering for non-ERC721 compliant NFTs when creating BuyCrowdfund/CollectionBuyCrowdfund/AuctionCrowdfund contracts.
Or add support for non-ERC721-compliant NFTs

@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 Sep 18, 2022
code423n4 added a commit that referenced this issue Sep 18, 2022
@merklejerk merklejerk added the duplicate This issue or pull request already exists label Sep 22, 2022
@merklejerk
Copy link
Collaborator

Duplicate of #248

@merklejerk merklejerk marked this as a duplicate of #248 Sep 22, 2022
@HardlyDifficult
Copy link
Collaborator

This is a NC feature suggestion, converting into a QA report for the warden.

@HardlyDifficult HardlyDifficult added QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed duplicate This issue or pull request already exists 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Oct 4, 2022
@HardlyDifficult
Copy link
Collaborator

Merging with #143

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Projects
None yet
Development

No branches or pull requests

3 participants