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

Usage of Safe wallet can lead to permanent DoS of an auction, losing all funds of participants #1071

Closed
c4-submissions opened this issue Nov 11, 2023 · 5 comments
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/main/smart-contracts/AuctionDemo.sol#L112

Vulnerability details

Background

The Sponsor stated in the README.md of this contest:

Consider if any functionality does not work with a SAFE (formerly Gnosis) wallet.

However, any function that ends up using .safeTransferFrom to send an ERC721 token will not always work with Safe wallets because not all Safe wallets will have a fallbackManager implemented due to various (security) reasons. The fallbackManager ensures that a Safe wallet is able to receive ERC721 tokens by implementing onERC721Received.

Since in this project, safeTransferFrom is used to transfer the ERC721, this transfer will revert with the following error code:

file: smart-contracts/ERC721.sol
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");

What for impact does this have?
Consider the following:

  • Alice put's her 1/1 NFT on auction.
  • BobDAO bids on the 1/1 NFT with the intention to win. They use their Safe multisig wallet.
  • BobDAO ends up winning the auction out of 100 participants.
  • The admin calls AuctionDemo.claimAuction to distribute the NFT.
  • However, this call will revert because the Safe does not implement the ERC721TokenReceiver.
  • This means that, all 100 other participants, will not be able to be refunded their money. The participants can not call cancelBid because the auction has ended.

Tools used

Manual review.

Recommended mitigation

For the exact scenario described above, split the refund mechanism into a different function that is not at mercy of the ERC721.safeTransferFrom() function succeeding, which people can call after the auction has ended.

Assessed type

Other

@c4-submissions c4-submissions added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Nov 11, 2023
c4-submissions added a commit that referenced this issue Nov 11, 2023
@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
Copy link

c4-judge commented Dec 8, 2023

alex-ppg marked the issue as partial-50

@c4-judge c4-judge added partial-50 Incomplete articulation of vulnerability; eligible for partial credit only (50%) 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 8, 2023
@c4-judge
Copy link

c4-judge commented Dec 9, 2023

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

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