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

No incentive to bid in auction until last moment #736

Closed
c4-submissions opened this issue Nov 9, 2023 · 7 comments
Closed

No incentive to bid in auction until last moment #736

c4-submissions opened this issue Nov 9, 2023 · 7 comments
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue grade-c QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue sufficient quality report This report is of sufficient quality unsatisfactory does not satisfy C4 submission criteria; not 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#L57-L61
https://github.com/code-423n4/2023-10-nextgen/blob/main/smart-contracts/MinterContract.sol#L518-L520

Vulnerability details

Impact

Each auction defines a fixed end time, which provides no incentive to bid, except at the last moment, which can be exploited by MEV, in deterrence of all other users of the protocol.

Citing from a similar issue on a previous contest as it leads to the same impact: "The current auction system doesn't allow for a proper price discovery". The current design can quickly lead to a suboptimal final price as someone may have increased its bid given more time.

Evaluated as Medium as a function of the protocol impacted due to improper price discovery of its assets.

Proof of Concept

Whenever a new bid is placed via participateToAuction(), the auction end time is not increased.

    function participateToAuction(uint256 _tokenid) public payable {
        require(
            msg.value > returnHighestBid(_tokenid) &&
            block.timestamp <= minter.getAuctionEndTime(_tokenid) &&
            minter.getAuctionStatus(_tokenid) == true
        );
        auctionInfoStru memory newBid = auctionInfoStru(msg.sender, msg.value, true);
        auctionInfoData[_tokenid].push(newBid);
    }

AuctionDemo.sol#L57-L61

getAuctionEndTime() returns a fixed value, that does not depend on the last bid:

    function getAuctionEndTime(uint256 _tokenId) external view returns (uint) {
        return mintToAuctionData[_tokenId];
    }

MinterContract.sol#L518-L520

Tools Used

Manual Review

Recommended Mitigation Steps

Extend the auction end time after each bid if the time is close to the end.

Assessed type

MEV

@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 9, 2023
c4-submissions added a commit that referenced this issue Nov 9, 2023
@141345
Copy link

141345 commented Nov 17, 2023

auction extention mechanism suggestion.

This one is more suitable for analysis

@c4-pre-sort c4-pre-sort added the sufficient quality report This report is of sufficient quality label Nov 17, 2023
@c4-pre-sort
Copy link

141345 marked the issue as sufficient quality report

@c4-sponsor
Copy link

a2rocket (sponsor) disputed

@c4-sponsor c4-sponsor added the sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue label Nov 23, 2023
@a2rocket
Copy link

the intended design was not to have extension.

@alex-ppg
Copy link

alex-ppg commented Dec 6, 2023

The Warden specifies that the auction's implementation incentivizes users to bid at the last second to not reveal their bids.

This recommendation does align with best practices, such as those employed by OpenSea which will extend an auction by 10 minutes if a bid is made near the end.

I understand that this type of submission has been judged as a medium in the past, however, I do not agree with the precedence.

At best, user experience will be impacted whereby users assumed they had won an auction but have been outbid. This results in the NFT being sold at a higher price point than it would already have which is a benefit for the protocol as a whole.

The recommended course of action would essentially increase this potential benefit rather than prevent it by allowing more outbids to occur until a "better" price is established.

I agree that this is an enhancement and adopting best practices (such as those I cited from OpenSea) is advisable, however, it does not constitute a medium-severity vulnerability. This is better suited under an Analysis submission or as a QA submission.

@c4-judge c4-judge added downgraded by judge Judge downgraded the risk level of this issue QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Dec 6, 2023
@c4-judge
Copy link

c4-judge commented Dec 6, 2023

alex-ppg changed the severity to QA (Quality Assurance)

@c4-judge
Copy link

c4-judge commented Dec 9, 2023

alex-ppg marked the issue as grade-c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue grade-c QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue sufficient quality report This report is of sufficient quality unsatisfactory does not satisfy C4 submission criteria; not eligible for awards
Projects
None yet
Development

No branches or pull requests

7 participants