You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 26, 2023. It is now read-only.
github-actionsbot opened this issue
Feb 21, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issue
According to the natspec documentation in DepositManagerV1.sol, fundBountyToken() should be used to "Transfers protocol token or ERC20 from msg.sender to bounty address". However, it is possible to use this function to deposit ERC721 tokens. This is because there is no validation within Bounty.receiveFunds() that prevents ERC721 tokens from being deposited. This results in ERC721 tokens becoming unrefundable, as the deposit has been erroneously registered as a non-NFT.
Impact
Erronous ERC20 deposits with ERC721 tokens will be reverted when attempting to call refundDeposit()
Code Snippet
Heres the unit test for this:
it('should revert when attempting to refund ERC721-as-ERC20 deposit',async()=>{// ARRANGEawaitopenQProxy.mintBounty(Constants.bountyId,Constants.organization,atomicBountyInitOperation);constbountyAddress=awaitopenQProxy.bountyIdToAddress(Constants.bountyId);awaitmockNft.approve(bountyAddress,1);constbounty=awaitAtomicBountyV1.attach(bountyAddress);constdepositId=generateDepositId(Constants.bountyId,0);// ASSUMEexpect(awaitmockNft.ownerOf(1)).to.equal(owner.address);// ACTawaitdepositManager.fundBountyToken(bountyAddress,mockNft.address,1,1,Constants.funderUuid);// ASSERTexpect(awaitbounty.isNFT(depositId)).to.be.false;expect(awaitmockNft.ownerOf(1)).to.equal(bountyAddress);awaitexpect(depositManager.refundDeposit(bountyAddress,depositId)).to.be.reverted;});
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issue
ltyu
high
ERC721 can be deposits as ERC20
Summary
Vulnerability Detail
According to the natspec documentation in DepositManagerV1.sol,
fundBountyToken()
should be used to "Transfers protocol token or ERC20 from msg.sender to bounty address". However, it is possible to use this function to deposit ERC721 tokens. This is because there is no validation withinBounty.receiveFunds()
that prevents ERC721 tokens from being deposited. This results in ERC721 tokens becoming unrefundable, as the deposit has been erroneously registered as a non-NFT.Impact
Erronous ERC20 deposits with ERC721 tokens will be reverted when attempting to call
refundDeposit()
Code Snippet
Heres the unit test for this:
This function can be used to transfer both, ERC20 and ERC721:
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/BountyCore.sol#L197-L215
Here's the code being impacted:
Tool used
Manual Review
Recommendation
Add validation to
receiveFunds()
to prevent tokens besides ERC20 and protocol tokens from being deposited.Duplicate of #352
The text was updated successfully, but these errors were encountered: