Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: high
Invalid

No check for `state.endTime` on `Auction::buy` as a result user may lose his position

Summary

No check for state.endTime on Auction::buy as a result user may lose his position to win

Vulnerability Details

On Auction::buy we can see it is not checking if the auction is ended or not.

So another user can call buy and put his bid even when the auction is not ended

Auction::buy

/**
Bid on the ZENO auction
User will able to buy ZENO tokens in exchange for USDC
*/
function buy(uint256 amount) external whenActive {
require(amount <= state.totalRemaining, "Not enough ZENO remaining");
uint256 price = getPrice();
uint256 cost = price * amount;
require(usdc.transferFrom(msg.sender, businessAddress, cost), "Transfer failed");
bidAmounts[msg.sender] += amount;
state.totalRemaining -= amount;
state.lastBidTime = block.timestamp;
state.lastBidder = msg.sender;
zeno.mint(msg.sender, amount);
emit ZENOPurchased(msg.sender, amount, price);
}

Impact

There is a function Auction::checkAuctionEnded

  • So let's say the user Bob put a higher bid, and after some time see that the Auction is ended through Auction::checkAuctionEnded

So Bob did not put any higher bid than the previous one because he saw that the Auction was ended.

So he is willing to win the Bid.

  • But another user Alice come and put a higher bid than Bob. But Alice put that bid when the Auction is actually ended. Because ultimately we can see there is no check on buyfunction for if the auction is ended or not.

  • So now Aliceis gonna win the bid as she put higher bid than Bob.

But here Bob is losing unfairly as he thought the auction had ended, so he didn't put in any further bids.

Alice putting her bid even when the auction is ended.

Tools Used

Manual

Recommendations

Put a check on whether the auction is ended or not through state.endTime

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!