You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 26, 2023. It is now read-only.
github-actionsbot opened this issue
Feb 23, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
The auction can be started by anyone calling settle before start_auction is called by the owner
Summary
settle can be called by anyone before start_auction is called by the owner which lead for anyone to be able to virtually call start_auction as well as reducing the number of auctions by 1.
Vulnerability Detail
Before start_auction is called:
_epoch_in_progress == False since epoch_end == 0. As a consequence anyone can call the function before it as been started by the owner.
winner == empty(address) since there is no highest_bidder yet. As a consequence, winner becomes FALLBACK_RECEIVER like so: AuctionHouse.vy#L191-L193
if winner ==empty(address):
winner = FALLBACK_RECEIVER
log AuctionSettledWithNoBid(token_id, FALLBACK_RECEIVER)
current_epoch_token_id == 0 since no epoch have passed yet. Therefore epoch_start and epoch_end get initialized and current_epoch_token_id get incremented like so:
@externaldef settle():
""" @notice Settles the latest epoch / auction. Reverts if the auction is still running. Mints the NFT to the highest bidder. If there are no bids, mints the NFT to the FALLBACK_RECEIVER address. Resets everything and starts the next epoch / auction. """assertself._epoch_in_progress() ==False, "epoch not over"
winner: address=self.highest_bidder
token_id: uint256=self.current_epoch_token_id
winning_amount: uint256=self.highest_bid
if winner ==empty(address):
winner = FALLBACK_RECEIVER
log AuctionSettledWithNoBid(token_id, FALLBACK_RECEIVER)
# reset for next roundself.highest_bid =0self.highest_bidder =empty(address)
# set up next round if there is oneifself.current_epoch_token_id <self.max_token_id:
self.current_epoch_token_id +=1self.epoch_start =block.timestampself.epoch_end =self.epoch_start + EPOCH_LENGTH
else:
self.epoch_start =0self.epoch_end =0MintableNFT(NFT).mint(winner, token_id)
if winning_amount >0:
ERC20(WETH).approve(self.vault, winning_amount)
Vault(self.vault).register_deposit(token_id, winning_amount)
log AuctionSettled(token_id, winner, winning_amount)
Tool used
Manual Review
Recommendation
I recommend adding a boolean value which would be turned True when the owner call start_auction and checked in the settle function as being True.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
seyni
medium
The auction can be started by anyone calling
settle
beforestart_auction
is called by the ownerSummary
settle
can be called by anyone beforestart_auction
is called by the owner which lead for anyone to be able to virtually callstart_auction
as well as reducing the number of auctions by 1.Vulnerability Detail
Before
start_auction
is called:_epoch_in_progress == False
sinceepoch_end == 0
. As a consequence anyone can call the function before it as been started by the owner.winner == empty(address)
since there is nohighest_bidder
yet. As a consequence,winner
becomesFALLBACK_RECEIVER
like so:AuctionHouse.vy#L191-L193
current_epoch_token_id == 0
since no epoch have passed yet. Thereforeepoch_start
andepoch_end
get initialized andcurrent_epoch_token_id
get incremented like so:AuctionHouse.vy#L200-L203
A NFT will be minted to the
FALLBACK_RECEIVER
:AuctionHouse.vy#L208
But no
winning_amount
will be sent to the vault sincewinning_amount == 0
Impact
Anyone can virtually call
start_auction
which is a permissionned function.The number of auctions will be reduced by 1.
Code Snippet
AuctionHouse.vy#L174-L213
Tool used
Manual Review
Recommendation
I recommend adding a boolean value which would be turned
True
when the owner callstart_auction
and checked in thesettle function
as beingTrue
.Duplicate of #39
The text was updated successfully, but these errors were encountered: