Sparkn

CodeFox Inc.
DeFiFoundryProxy
15,000 USDC
View results
Submission Details
Severity: high
Valid

Missing Address 0 Check in Winners List:

Summary

The function performs token transfers to addresses in the winners array without checking if any of the addresses are 0x0 (address 0).

Vulnerability Details

This could lead to accidental loss of tokens, as transferring tokens to address 0 results in a burn.

Impact

uint256 winnersLength = winners.length; // cache length
for (uint256 i; i < winnersLength;) {
uint256 amount = totalAmount * percentages[i] / BASIS_POINTS; // @audit-issue amount checks
erc20.safeTransfer(winners[i], amount); // @audit-issue no address 0 checks when doing safeTransfer
unchecked {
++i;
}
}

Tools Used

Manual review

Recommendations

To mitigate this, you should add a check to ensure that the addresses in the winners array are not address 0 before proceeding with the token transfer.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.