Summary
In Auction.sol contract in buy function you can observe there is no check that Auction started or not and Auction ended or not. For that If Auction not started or ended on that case if user click on this function, then user can lose money.
Vulnerability Details
In Auction.sol contract in buy function you can observe there is no check that Auction started or not and Auction ended or not.
Bid on the ZENO auction
User will able to buy ZENO tokens in exchange for USDC
*/
function buy(uint256 amount) external whenActive {
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.
If Auction not started buy that function case if user click on this function, then user can lose money.
Tools Used
Manual Review
Recommendations
In Auction.sol contract in buy function add below commented line..
Bid on the ZENO auction
User will able to buy ZENO tokens in exchange for USDC
*/
function buy(uint256 amount) external whenActive {
@>> if (block.timestamp < state.startTime) revert Auction not started;
@>> if (block.timestamp >= state.endTime) revert Auction ended;
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);
}