The TSender::airdropERC20
function does not check to confirm if the sender doesn't mistakenly include the TSender
contract address in the recipients
array, causing an irrecoverable loss of some amount out of the totalAmount
The TSender::airdropERC20
function takes an array of addresses (recipients
), which is the list of the addresses to which the user wants to airdrop an ERC20 token. The TSender::airdropERC20
does a good amount of checking to ensure that the user doesn't mistakenly airdrop to an unintended address, but the TSender::airdropERC20
function fails to check if the array of addresses (recipients
) the sender passes in contains the address of the TSender
contract itself. The absence of this check can cause an irrecoverable loss of some amount out of the total amounts the user intended to airdrop. This might seem unlikely to happen, but in fact, it can happen because you need the address of the TSender
contract before you can call it to help with airdropping an ERC20
token and in the process of writing a script to call the TSender
contract you might mistakenly include the address of the TSender
contract in the array of recipients you want to pass to the TSender:airdropERC20
function. Finally, checking for address(0) speaks volumes about how much we care about the funds of the protocol user, and a user mistakenly passing in the address of the TSender
contract would result in the same irreversible loss of funds.
Include the below code in Base_Test.t.sol
Then run the command forge test --mt test_TSender_can_ERC20Token_to_itself -vvvv
, You will get an output like below showing that indeed the sender successfully airdropped some of the token the TSender
contract address.
This vulnerability would cause the sender to airdrop some of the total amount to the TSender
contract. Knowing well enough that the TSender
contract doesn't have any function that interacts directly with ERC20
tokens to transfer tokens or approve tokens, it is a fact that any ERC20
token airdrop to the TSender
contract is gone forever.
Manual Review
We know well enough that the protocol is all about being hyper-efficient with gas usage for the airdropping activity, But then funds safety and security come first before gas optimization. So we will advise the protocol to implement a check to ensure that the address of the TSender
contract is not included in the recipients
array and if included the TSender
contract should revert.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.