-
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
Attacker can prevent highest bidder from receiving auctioned token and users from receiving their ETH back #1045
Comments
141345 marked the issue as duplicate of #1632 |
141345 marked the issue as duplicate of #843 |
141345 marked the issue as duplicate of #486 |
alex-ppg marked the issue as not a duplicate |
alex-ppg marked the issue as duplicate of #2006 |
alex-ppg marked the issue as unsatisfactory: |
alex-ppg marked the issue as unsatisfactory: |
Hi @alex-ppg , here are some points I'd like to point out as to why I believe this issue is valid:
Thank you for taking the time to read this. |
Hey @mcgrathcoutinho, thanks for providing feedback on this! I consulted on this with three different judges before making a verdict to ensure I am aligned with the census around OOS findings. To note, the verdict you list on point 3 that mentions OOS findings speaks about the instance of the code that is audited. As such, it covers bot findings, external libraries, etc. but does not cover speculation on future code. This falls under the relevant SC verdict highlighted in the primary issue's judgment: #1785 (comment) |
Hi @alex-ppg, thanks for the response. The speculation on future code states:
In this case, the bug manifesting is very much likely due to the sponsor confirmation in the screenshot above which agrees on the future code change i.e. the mitigation. Based on the fact that funds of all users and the winner's NFT is permanently locked with only a 1 wei deposit being required by the attacker, why would this issue not be of valid critical severity? |
Hey @mcgrathcoutinho, thanks again for requesting additional clarification! You are free to follow up with the Sponsor concerning issues that show up after they carry out their remediations without proper care. As mentioned before, I consulted with multiple SC judges concerning this and thus consider my judgment final. Any issue that would arise from a remediation of a bot report finding opens up a huge can of worms in terms of fairness/competency and I believe the following statement sums up this judgment:
Keep in mind that information acquired from DMs with the Sponsor is in my opinion OOS as it would provide you with an unfair advantage. Submissions are not allowed to quote statements from the Sponsor, they should merely build on clarifications provided from them in a neutral way. Additionally, the Sponsor above has confirmed that they will be applying the remediation which is checking the result of the call; this does not necessarily mean they will check it with a |
Lines of code
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/AuctionDemo.sol#L57
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/AuctionDemo.sol#L104
Vulnerability details
Impact
An attacker can prevent the highest bidder from receiving the auctioned token and the users from receiving their ETH back (deposited from previous bids - that were not cancelled). This is because the current implementation uses a push over pull mechanism to refund the user's ETH. This means that external calls are made to the user's address, instead of letting them withdraw it themselves. The issue arises when an attacker intentionally deposits dust amount of ETH as soon as the auction starts (in order to be included in the list of active bidders) and reverts (in his receiver contract's receive/fallback function) during the refunding process in claimAuction(). This would mean permanent locking of the user's funds in the AuctionDemo.sol contract.
Additionally, the ETH of the highest bidder (who won the auction) are not transferred to the ownerOf() AuctionDemo.sol, which means it is a loss for the team as well since those ETH are permanently locked in AuctionDemo.sol contract as well.
The impact of this issue is critical since user's ETH is permanently locked and no bargaining can be done with the attacker to cancel his bid past the auctionEndTime since cancelBid() function would revert.
Note: This finding assumes that the mitigation of M-01 bot finding has been applied i.e. checking the return value of success from low-level call in order to prevent failed calls from continuing and not refunding the users (for whom the low-level calls failed). The mitigation being applied has been confirmed with the sponsor as well (see below).
Proof of Concept
Here is the whole process:
auctionInfoData[_tokenid]
, which stores the list of active bidders.success = false
causing the whole claimAuction() transaction created by Alice to be reverted.Although the attacker will lose the small dust amount of ETH that was deposited in the beginning of the auction, the other users placing bigger bids will permanently lose their ETH due to being non-refundable. Furthermore, Alice is deprived from receiving the auctioned token that she won.
Additionally, the team cannot bargain with the attacker to cancel his bid post the auctionEndTime (in order to refund the users who lost ETH) since the check on Line 125 does not allow cancelling bids past the auctionEndTime.
Coded POC
Here are some points to understand this POC:
forge test --match-test testAttackerPreventsWinnerFromReceivingNFTAndUsersFromReceivingETHBack -vvvvv
forge test --match-test testAttackerPreventsWinnerFromReceivingNFTAndUsersFromReceivingETHBack -vvvvv
command.Attacker's Contract
Tools Used
Manual Review
Recommended Mitigation Steps
Use a pull over push mechanism, which allows users to withdraw by calling the AuctionDemo.sol contract instead of sending the ETH back to them. The claimAuction() function should only include the transfer of the auctioned token to the winner and transfer of ETH to the team's trusted address.
Assessed type
call/delegatecall
The text was updated successfully, but these errors were encountered: