-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bidders whose bid settles at auction end timestamp might have their bidding funds permanently lost to them #962
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-175
edited-by-warden
satisfactory
satisfies C4 submission criteria; eligible for awards
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Comments
c4-submissions
added
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
labels
Nov 10, 2023
141345 marked the issue as primary issue |
c4-pre-sort
added
the
primary issue
Highest quality submission among a set of duplicates
label
Nov 14, 2023
This was referenced Nov 14, 2023
Closed
Closed
A token can be stolen from the auction due to an incorrect condition in the end-time validation
#911
Closed
This was referenced Nov 27, 2023
Closed
alex-ppg marked issue #1547 as primary and marked this issue as a duplicate of 1547 |
c4-judge
added
duplicate-1547
and removed
primary issue
Highest quality submission among a set of duplicates
labels
Dec 2, 2023
alex-ppg marked the issue as not a duplicate |
alex-ppg marked the issue as duplicate of #1926 |
alex-ppg marked the issue as satisfactory |
c4-judge
added
the
satisfactory
satisfies C4 submission criteria; eligible for awards
label
Dec 8, 2023
alex-ppg changed the severity to 2 (Med Risk) |
c4-judge
added
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
downgraded by judge
Judge downgraded the risk level of this issue
and removed
3 (High Risk)
Assets can be stolen/lost/compromised directly
labels
Dec 9, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-175
edited-by-warden
satisfactory
satisfies C4 submission criteria; eligible for awards
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/AuctionDemo.sol#L105
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/AuctionDemo.sol#L58
Vulnerability details
Impact
In AuctionDemo.sol, the
participateToAuction()
andclaimAuction()
flows have vulnerabilities that will likely result in bidders permanently losing their bidding funds when they submit their bids close to the auction end timestamp.And since bidding close to the auction end timestamp is expected bidding behavior that happens regularly in auctions where a bidding war is encouraged until the auction ends, I think this is a high-severity issue.
Proof of Concept
There are (2) vulnerabilities at work here.
(1) The boundary of the time range between the active auction period and the auction end is not cleanly handled. A time overlap is allowed at auction end timestamp;
(2) When an auction is claimed - the nft is minted and bidding funds are returned, the auction claim status is not checked in
participateToAuction()
;On top of the (2) above,
claimAuction()
allows the winner to call the function to claim their nft and distribute bidding funds, which is essentially makingclaimAuction()
publicly available to whoever has the highest bid at the auction end timestamp.(https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/AuctionDemo.sol#L58)
(https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/AuctionDemo.sol#L105)
As seen above, when users trying to outbid each other close to the auction end, their transaction might settle at
minter.getAuctionEndTime(_tokenid)
, in which case, their bidding funds will be paid and bidding will be successful.However, to solidify their win, the existing highest bidder will
claimAuction()
at the earliest which is also the same timestamp asminter.getAuctionEndTime(_tokenid)
. In such cases, the bidders whose transaction is settled after the existing highest bidder will have their funds lost. In addition, callingcancelBid()
after the fact to recover their bidding funds will be too late since the transaction will revert when the timestamp passes the auction end time.We can see that in AuctionDemo.sol there is no emergency withdrawal or funds sweeps mechanism to recover any funds locked in the scenario above.
Tools Used
Manual Review
Recommended Mitigation Steps
In
paricipateToAuction
, either change the require statement intoblock.timestamp < minter.getAuctionEndTime(_tokenid)
, or add check to ensureauctionClaim[_tokenid] != true
.Assessed type
Timing
The text was updated successfully, but these errors were encountered: