-
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
AuctionDemo#claimAuction did not set auctionInfoData.status to false #1172
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-1323
satisfactory
satisfies C4 submission criteria; eligible for awards
sponsor disputed
Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
sufficient quality report
This report is of sufficient quality
Comments
141345 marked the issue as primary issue |
This was referenced Nov 15, 2023
Closed
Closed
Closed
This was referenced Nov 22, 2023
a2rocket (sponsor) disputed |
Closed
141345 marked the issue as sufficient quality report |
alex-ppg marked the issue as duplicate of #1323 |
alex-ppg marked the issue as satisfactory |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-1323
satisfactory
satisfies C4 submission criteria; eligible for awards
sponsor disputed
Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/AuctionDemo.sol#L104
Vulnerability details
Impact
AuctionDemo#claimAuction did not set auctionInfoData.status to false, the auction is still valid after the claim and the user can call
cancelBid
to get a 2x refund.Proof of Concept
The
claimAuction
function finds the user with the highest bid and buys the NFT, and the other users make a refund.Since auctionInfoData[_tokenid][i].status is not set to false, the user within the same block.timestamp can call cancelBid after claimAuction to get a 2x refund.
cancelBid
verifies whether the Auction is out of date and auctionInfoData.status is true, ifclaimAuction
andcancelBid
are within the same block.timestamp, block.timestamp == minter.getAuctionEndTime(_tokenid), the time verification will pass, and since auctionInfoData.status is always true, theclaimAuction
andcancelBid
functions will both be called successfully, and the user will get 2x For a refund.There are 3 ways a malicious user can carry out an attack:
cancelBid
in bidder's fallback, this is not a reentrant attack, it just makescancelBid
execute in the same block after theclaimAuction
execution.claimAuction
and thencancelBid
to double the refund on one or more of his unwinning auctions.claimAuction
function to initiatecancelBid
, which is then executed in the same block afterclaimAuction
.Tools Used
vscode manual
Recommended Mitigation Steps
Set status to false after claimAuction
Assessed type
Other
The text was updated successfully, but these errors were encountered: