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

Incorrect Ether Transfer to Token Owner #432

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

Incorrect Ether Transfer to Token Owner #432

c4-submissions opened this issue Nov 6, 2023 · 2 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 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 smart contract in question contains a critical issue related to the transfer of Ether during the auction claiming process.
When a user claims their auction winnings, Ether is meant to be transferred to the owner of the token being auctioned.
However, the current implementation mistakenly transfers Ether to the contract's owner instead.
This error can have significant consequences as it results in the incorrect distribution of funds, potentially causing financial losses for the users involved in the auction.
Additionally, it could lead to unexpected behavior and disputes regarding the ownership of tokens and funds.

Proof of Concept

function claimAuction(uint256 _tokenid) public WinnerOrAdminRequired(_tokenid,this.claimAuction.selector){
   ..
    for (uint256 i=0; i< auctionInfoData[_tokenid].length; i ++) {
        if (auctionInfoData[_tokenid][i].bidder == highestBidder && auctionInfoData[_tokenid][i].bid == highestBid && auctionInfoData[_tokenid][i].status == true) {
            IERC721(gencore).safeTransferFrom(ownerOfToken, highestBidder, _tokenid);
            (bool success, ) = payable(owner()).call{value: highestBid}(""); // should be ownerOfToken
            emit ClaimAuction(owner(), _tokenid, success, highestBid);
        }..
}

Tools Used

manual review

Recommended Mitigation Steps

To address this issue, it is crucial to modify the Ether transfer mechanism in the contract's claim auction function. Specifically, replace owner() with the variable ownerOfToken in the payable call:

(bool success, ) = payable(ownerOfToken).call{value: highestBid}("");

Assessed type

Context

@c4-submissions c4-submissions 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 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 and removed duplicate-738 labels Dec 8, 2023
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 duplicate-971 satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

3 participants