DeFiFoundry
20,000 USDC
View results
Submission Details
Severity: medium
Valid

Incorrect `auctionEndTime` threshold logic allows simultaneous `bid()` or `unbid()` and `auctionEnd()`

Description

In the current implementation of the auction contract, the contract allows the simultaneous execution of the bid() or unbid() functions and the auctionEnd() function when the block.timestamp
is equal to the auction end time.

function bid(uint256 amount) external {
if (block.timestamp > auctionEndTime) {
revert AuctionAlreadyEnded();```
function auctionEnd() external {
if (block.timestamp < auctionEndTime) {
revert AuctionNotYetEnded();
}

This oversight enables unexpected ending behaviour at the very last moment of the auction, potentially undermining the auction's integrity.

Impact

Unexpected auctionEnd: Some users may wait to calculate the total amount of bids and set a bid or unbid at the last second, the issue here is that auctionEnd could be called sooner, causing issues for these users, and undermining the overall integrity of the auction process.

Tools Used

Manual Review

Recommended Mitigation

function auctionEnd() external {
- if (block.timestamp < auctionEndTime) {
+ if (block.timestamp <= auctionEndTime) {
revert AuctionNotYetEnded();
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Users can bid in the same block when the actionEnd could be called (`block.timestamp==actionEndTime`), depending on the order of txs in block they could lose funds

The protocol doesn't properly treat the `block.timestamp == auctionEndTime` case. Impact: High - There are at least two possible impacts here: 1. By chance, user bids could land in a block after the `auctionEnd()` is called, not including them in the multiplier calculation, leading to a situation where there are insufficient funds to pay everyone's claim; 2. By malice, where someone can use a script to call `auctionEnd()` + `bid(totalBids)` + `claimTokens()`, effectively depriving all good faith bidders from tokens. Likelihood: Low – The chances of getting a `block.timestamp == auctionEndTime` are pretty slim, but it’s definitely possible.

Support

FAQs

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