Skip to content
Business logic Audit finding Beginner

WalletImpl cannot receive NFTs as intended

The WalletImpl contract lacks the onERC721Received and onERC1155Received functions, so it cannot receive NFTs sent via safeTransferFrom or safeMint. This means any attempt to transfer NFTs to these wallets will fail, potentially causing loss of funds if a pull/claim flow relies on the wallet receiving NFTs.

obront Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-04-splits-judging/issues/57

Found by

obront

Summary

WalletImpl is intended to turn pass through wallets into generalizable wallets that can be used for any purpose, including receiving NFTs. However, because it does not implement the onERC721Received() and onERC1155Received() functions, it will not pass the checks for safeTransferFrom() and will not be able to be used for NFTs as intended.

Vulnerability Detail

WalletImpl.sol is inherited by PassThroughWalletImpl.sol and SwapperImpl.sol to turn them into generalizable smart contract wallets. It implements an execCalls() function that allows the owner to perform any arbitrary action on behalf of the contract.

The purpose of this was explained by Will in the contest Discord channel:

we wanted it to have the full flexibility of a smart contract wallet for various situations which might arise when using it as a pay to address (eg if you use an address for primary proceeds on artblocks it also must be able to receive & handle NFTS)

However, as it is currently implemented thee contracts will not be able to receive NFTs sent with safeTransferFrom(), because they do not implement the necessary functions to safely receive these tokens..

While in many cases such a situation would be Medium severity, looking at Will's example above makes clear that the circumstances in which these wallets will be used could lead to more serious consequences. For example, having a wallet that is entitled to high value NFTs but is not able to receive them is clearly a loss of funds risk, and a High severity issue.

Impact

Any time an ERC721 or ERC1155 is attempted to be transferred with safeTransferFrom() or minted with safeMint(), the call will fail.

Code Snippet

https://github.com/sherlock-audit/2023-04-splits/blob/main/splits-utils/src/WalletImpl.sol#L9-L66

Tool used

Manual Review

Recommendation

Include onERC721Received() and onERC1155Received() functions in WalletImpl.sol.

Discussion

ctf-sec

@wminshew Would love to hear your thought on this one.

The submission is true but because the issue is confirmed via DM and not in the context readme doc, I think the issue can be a valid low.

wminshew

@ctf-sec definitely a valid issue. I am not sure how loss-of-funds would be defined in my own artblocks example given -- I don't think the NFTs are lost, just that the txn would fail and the artist would have to use a different wallet/address? if the NFTs were indeed lost (vs txn reverting) that would feel like a High to me. if txn reverts, i can see arguments for a low or possibly medium (i suppose even if txn reverts for AB there is a chance this would result in total loss for other protocols?)

ctf-sec

Thanks for your comment. I will add the "low severity" label for now.

In the project doc of the auditing contest.

Q: Which ERC721 tokens do you expect will interact with the smart contracts? none

wminshew

yes that's a good point and my bad -- the diversifier (pass-through wallet) is expected to interact w arbitrary 721s & 1155s but I flubbed that FAQ sorry

wminshew

Thanks for your comment. I will add the "low severity" label for now.

thinking about this more i feel like this should be at least medium and possible high -- any nft flow that relied on a pull/claim would've resulted in lost funds

ctf-sec

Comment from Sherlock:

The readme excluding usage of NFT's makes this one really difficult. Have pushed hard for Validating issues based on readme information in the past and not discord messages valid. Will need to stick to it, We need to definitely consider updating contest information mid-contest if needed. Not sure yet how to do that.

Keep it medium from the onERC1155Received() point of view.

In case there is an escalation we can look into it further.

zobront

Fixed in https://github.com/0xSplits/splits-utils/pull/3/

jacksanford1

Confirming that Splits meant for this fix (3) to link to this issue (57): https://github.com/0xSplits/splits-utils/pull/3#issue-1693165292

wminshew

confirmed

securitygrid

Escalate for 10 USDC. It is clearly stated in README.md: Q: Which ERC721 tokens do you expect will interact with the smart contracts? none so, this issue is not valid H/M.

sherlock-admin

Escalate for 10 USDC. It is clearly stated in README.md: Q: Which ERC721 tokens do you expect will interact with the smart contracts? none so, this issue is not valid H/M.

You've created a valid escalation for 10 USDC!

To remove the escalation from consideration: Delete your comment.

You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.

z0ld

Escalate for 10 USDC I would like to bring attention to an issue that I believe deserves further consideration and escalation. As mentioned in the discussion above, the pass-through wallet is expected to interact with arbitrary ERC721s & ERC1155s. However, the rules for the auditing contest mention no expected interaction with ERC721 tokens in the Q&A, and it appears ERC1155 tokens follow the same situation.

sherlock-admin

Escalate for 10 USDC I would like to bring attention to an issue that I believe deserves further consideration and escalation. As mentioned in the discussion above, the pass-through wallet is expected to interact with arbitrary ERC721s & ERC1155s. However, the rules for the auditing contest mention no expected interaction with ERC721 tokens in the Q&A, and it appears ERC1155 tokens follow the same situation.

You've created a valid escalation for 10 USDC!

To remove the escalation from consideration: Delete your comment.

You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.

hrishibhat

Escalation rejected

While the readme denies any interaction with ERC721 tokens, this issue still holds true for ERC1155 tokens, there is no explicit exclusion of these tokens and the issue raised clearly breaks an intended functionality of the Wallet implementations. This is a valid medium.

sherlock-admin

Escalation rejected

While the readme denies any interaction with ERC721 tokens, this issue still holds true for ERC1155 tokens, there is no explicit exclusion of these tokens and the issue raised clearly breaks an intended functionality of the Wallet implementations. This is a valid medium.

This issue's escalations have been rejected!

Watsons who escalated this issue will have their escalation amount deducted from their next payout.

The original report as published on Sherlock, by obront. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The contract does not implement the required receiver functions for ERC721 and ERC1155 tokens.

Impact

Any attempt to transfer an ERC721 or ERC1155 token to the wallet using safeTransferFrom or safeMint will fail, potentially causing loss of funds if a pull/claim flow relies on the wallet receiving NFTs.

What the attacker needed

Wallet used to receive NFTs

The fix

The issue was fixed by adding the onERC721Received and onERC1155Received functions to WalletImpl.sol.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Smart contracts that receive NFTs must implement special functions to acknowledge the transfer; otherwise, the transfer fails. Here, the wallet contract was meant to hold NFTs but lacked these functions, so any attempt to send NFTs to it would be rejected.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by obront

View all

46 more disclosed reports, best first.

More from Splits

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.