Missing input validation/constraints on all setters
Summary
Missing input validation may cause unexpected behaviour.
Vulnerability Detail
repossessor is not validated in _setRepossessor
This may leave repossessorBid.bidder = address(0) if l.highestBids[tokenId][currentAuctionRound].bidder == address(0):
function _closeAuction(uint256 tokenId) internal {
...
if (l.highestBids[tokenId][currentAuctionRound].bidder == address(0)) {
// No bids were placed, transfer to repossessor
Bid storage repossessorBid = l.bids[tokenId][currentAuctionRound][
l.repossessor
];
repossessorBid.bidAmount = 0;
repossessorBid.feeAmount = 0;
repossessorBid.collateralAmount = 0;
repossessorBid.bidder = l.repossessor;
l.highestBids[tokenId][currentAuctionRound] = repossessorBid;
}
...
}
This may not extend the length of the auction during _closeAuction if the value is too low or it may extend the auction too much:
function _closeAuction(uint256 tokenId) internal {
...
if (
auctionEndTime >= block.timestamp &&
auctionEndTime - block.timestamp <
_bidExtensionWindowLengthSeconds()
) {
uint256 auctionLengthSeconds;
if (l.currentAuctionLength[tokenId] == 0) {
auctionLengthSeconds = _auctionLengthSeconds();
} else {
auctionLengthSeconds = l.currentAuctionLength[tokenId];
}
// Extend auction
l.currentAuctionLength[tokenId] =
auctionLengthSeconds +
_bidExtensionSeconds(); // this value can be too low or too high
}
...
}
startingBid is not validated before being set in _setStartingBid.
startingBid acts as a min bid amount allowed, if this value is allowed to be zero, this might lead to very cheap prices:
function _placeBid(
uint256 tokenId,
address bidder,
uint256 bidAmount,
uint256 collateralAmount
) internal {
EnglishPeriodicAuctionStorage.Layout
storage l = EnglishPeriodicAuctionStorage.layout();
uint256 currentAuctionRound = l.currentAuctionRound[tokenId];
Bid storage bid = l.bids[tokenId][currentAuctionRound][bidder];
// Check if higher than starting bid
require(
bidAmount >= l.startingBid,
'EnglishPeriodicAuction: Bid amount must be greater than or equal to starting bid'
);
function _placeBid(
uint256 tokenId,
address bidder,
uint256 bidAmount,
uint256 collateralAmount
) internal {
...
require(
bidAmount >= l.startingBid, // startingBid can be very low
'EnglishPeriodicAuction: Bid amount must be greater than or equal to starting bid'
);
...
}
Following variables in _initializeAuction are also set without being validated:
dian.ivanov
medium
Missing input validation/constraints on all setters
Summary
Missing input validation may cause unexpected behaviour.
Vulnerability Detail
repossessor is not validated in _setRepossessor This may leave repossessorBid.bidder = address(0) if l.highestBids[tokenId][currentAuctionRound].bidder == address(0):
This may not extend the length of the auction during _closeAuction if the value is too low or it may extend the auction too much:
This may let bidders become the highest bid when the bid is equal to the older bid if the value is allowed to be 0 for example:
This may make the auction infinite if the value is too high:
This may not extend the length of the auction during _closeAuction if the value is too low or it may extend the auction too much:
startingBid acts as a min bid amount allowed, if this value is allowed to be zero, this might lead to very cheap prices:
Following variables in _initializeAuction are also set without being validated:
Impact
Unexpected/weird behaviour in any function using the mentioned storage variables.
Code Snippet
Tool used
Manual Review
Recommendation