Sparkn

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

Contracts are vulnerable to fee-on-transfer accounting-related issues

Summary

Contracts are vulnerable to fee-on-transfer accounting-related issues

Vulnerability Details

The functions below transfer funds from the caller to the receiver via transferFrom(), but do not ensure that the actual number of tokens received is the same as the input amount to the transfer. If the token is a fee-on-transfer token, the balance after the transfer will be smaller than expected, leading to accounting issues. Even if there are checks later, related to a secondary transfer, an attacker may be able to use latent funds (e.g. mistakenly sent by another user) in order to get a free credit.

File: src/Distributor.sol
147: erc20.safeTransfer(winners[i], amount);
164: token.safeTransfer(STADIUM_ADDRESS, token.balanceOf(address(this)));

Impact

Accounting issues

Tools Used

Manual

Recommendations

One way to solve this problem is to measure the balance before and after the transfer, and use the difference as the amount, rather than the stated amount.

Support

FAQs

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