Closed sherlock-admin closed 1 year ago
PR fixing another issue, removing the withdrawToken() method : https://github.com/BullvBear/bvb-solidity/pull/14
This should be invalid as ERC20 got no function signature as safeTransferFrom(address,address,uint256)
minhquanym
medium
Attacker can burn ERC20 funds in the contract
Summary
https://github.com/sherlock-audit/2022-11-bullvbear/blob/main/bvb-protocol/src/BvbProtocol.sol#L450-L462
Vulnerability Detail
Function
withdrawToken()
is used to receive the NFT manually after the contract is settled. However, an attacker can abuse this function to burn ERC20 funds in the contract.The way it can be done is:
collection
param equal to an ERC20 token address.withdrawToken()
withtokenId
is the amount of funds he want to burnrecipient
will beaddress(0)
because order is not settled (cannot settle anyway)tokenId
amount toaddress(0)
, effectively burn these amount.Impact
Loss of funds deposited into the contract.
I agreed that it will require that ERC20 token has to implement
safeTransferFrom()
function, which is quite weird so I put it as MediumCode Snippet
Tool used
Manual Review
Recommendation
Consider checking
address(0)
before transferring token.