Skip to content
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 block the payment and refund of funds in the auction. #1230

Closed
c4-submissions opened this issue Nov 12, 2023 · 9 comments
Closed
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-739 partial-50 Incomplete articulation of vulnerability; eligible for partial credit only (50%)

Comments

@c4-submissions
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/AuctionDemo.sol#L104-L120

Vulnerability details

Impact

If the highest bidder's address in the auction belongs to a contract that does not implement the onERC721Received() function, calling claimAuction() becomes impossible. Consequently, the remaining funds from bids become trapped in the auction contract. This vulnerability can be exploited by an attacker who deliberately uses a contract without implementing the required function and aims to become the highest bidder, thereby blocking the refund process.

Proof of Concept

Suppose an attacker employs a contract that does not implements onERC721Received() to call AuctionDemo::participateToAuction() and manage to bid high enough to become the highest bidder. In this scenario when the AuctionDemo::claimAuction() function is invoked to process the token transfer and refund remaining active bids, the call will revert due to the use of safeTransferFrom(). It's important to note that this scenario can also occur unintentionally if the highest bidder's address is a contract that lacks the required ERC721Receiver functionality.

Since the auction has ended (block.timestamp <= minter.getAuctionEndTime(_tokenId)), and there is no alternative method for bidders to retrieve their funds (as cancelBid and cancelAllBids are disabled when auctions ends), the token and all funds become permanently trapped within the contract. Thefore this issue is classified as high severity, as any attacker can exploit this vulnerability intentionally, effectively freezing all funds in the contract.

Tools Used

Manual Review.

Recommended Mitigation Steps

Consider using transferFrom() instead of safeTransferFrom().

Assessed type

ERC721

@c4-submissions c4-submissions added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Nov 12, 2023
c4-submissions added a commit that referenced this issue Nov 12, 2023
@c4-pre-sort
Copy link

141345 marked the issue as duplicate of #364

@c4-pre-sort
Copy link

141345 marked the issue as not a duplicate

@c4-pre-sort
Copy link

141345 marked the issue as duplicate of #1653

@c4-pre-sort
Copy link

141345 marked the issue as duplicate of #843

@c4-pre-sort
Copy link

141345 marked the issue as duplicate of #486

@c4-judge
Copy link

c4-judge commented Dec 1, 2023

alex-ppg marked the issue as not a duplicate

@c4-judge
Copy link

c4-judge commented Dec 1, 2023

alex-ppg marked the issue as duplicate of #1759

@c4-judge c4-judge added duplicate-739 partial-50 Incomplete articulation of vulnerability; eligible for partial credit only (50%) and removed duplicate-1759 labels Dec 4, 2023
@c4-judge
Copy link

c4-judge commented Dec 8, 2023

alex-ppg marked the issue as partial-50

@c4-judge
Copy link

c4-judge commented Dec 9, 2023

alex-ppg changed the severity to 2 (Med Risk)

@c4-judge c4-judge removed the 3 (High Risk) Assets can be stolen/lost/compromised directly label Dec 9, 2023
@c4-judge 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 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-739 partial-50 Incomplete articulation of vulnerability; eligible for partial credit only (50%)
Projects
None yet
Development

No branches or pull requests

3 participants