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

Auction Funds Never Sent To Token Owner #422

Closed
c4-submissions opened this issue Nov 6, 2023 · 3 comments
Closed

Auction Funds Never Sent To Token Owner #422

c4-submissions opened this issue Nov 6, 2023 · 3 comments
Labels
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 downgraded by judge Judge downgraded the risk level of this issue duplicate-971 satisfactory satisfies C4 submission criteria; eligible for awards

Comments

@c4-submissions
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2023-10-nextgen/blob/main/smart-contracts/AuctionDemo.sol#L113

Vulnerability details

Impact

The owner of a token that is auctioned off may never receive the ETH they deserve from the auction. There are no requirements for the owner of the auctionDemo contract to send the ETH to the owner of the token that was auctioned.

Proof of Concept

Within the readme for the competition the NextGen team ask wardens to “Consider ways in which the owner of the token will not receive the funds of the highest bid after an Auction is claimed.” When inspecting the code we see that auctions actually send ETH to the owner of the auctionDemo contract. This is the line within the claimAuction function that distributes the eth equal to the highestBid once the auction is over:
(bool success, ) = payable(owner()).call{value: highestBid}("");

The problem is with the owner() function. This function is inherited from the OpenZeppelin Ownable contract and returns the owner of the contract not the owner of the token.

Tools Used

Manual Review

Recommended Mitigation Steps

The claimAuction function correctly grabs the owner of the token and sets it to the variable ownerOfToken. Use this variable to send eth to

function claimAuction(uint256 _tokenid) public WinnerOrAdminRequired(_tokenid,this.claimAuction.selector){
        .....
                IERC721(gencore).safeTransferFrom(ownerOfToken, highestBidder, _tokenid);
               - (bool success, ) = payable(owner()).call{value: highestBid}("");
               + (bool success, ) = payable(ownerOfToken).call{value: highestBid}("");
                emit ClaimAuction(owner(), _tokenid, success, highestBid);
        .....
    }

Assessed type

ETH-Transfer

@c4-submissions c4-submissions added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Nov 6, 2023
c4-submissions added a commit that referenced this issue Nov 6, 2023
@c4-pre-sort
Copy link

141345 marked the issue as duplicate of #245

@c4-judge
Copy link

c4-judge commented Dec 8, 2023

alex-ppg marked the issue as satisfactory

@c4-judge c4-judge added satisfactory satisfies C4 submission criteria; eligible for awards duplicate-971 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value downgraded by judge Judge downgraded the risk level of this issue and removed duplicate-738 3 (High Risk) Assets can be stolen/lost/compromised directly labels Dec 8, 2023
@c4-judge
Copy link

c4-judge commented Dec 9, 2023

alex-ppg changed the severity to 2 (Med Risk)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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 downgraded by judge Judge downgraded the risk level of this issue duplicate-971 satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

3 participants