Open c4-bot-7 opened 9 months ago
Identified both amount > 0
and to != address(0
. Hence aggregating all related issues here.
0xRobocop marked the issue as sufficient quality report
0xRobocop marked the issue as primary issue
ChristianBorst (sponsor) confirmed
This is a significant issue since it is a DoS attack vector and can cause miscalculation of entitlements. I also think the report is very clear in outlining the issue.
0xA5DF marked the issue as satisfactory
0xA5DF marked the issue as selected for report
Lines of code
https://github.com/code-423n4/2024-02-althea-liquid-infrastructure/blob/main/liquid-infrastructure/contracts/LiquidInfrastructureERC20.sol#L142-L145 https://github.com/code-423n4/2024-02-althea-liquid-infrastructure/blob/main/liquid-infrastructure/contracts/LiquidInfrastructureERC20.sol#L214-L231
Vulnerability details
Impact
LiquidInfrastructureERC20._beforeTokenTransfer()
checks if theto
address has a balance of 0, and if so, adds the address to the holders array.LiquidInfrastructureERC20#L142-145
However, the ERC20 contract allows for transferring and burning with
amount = 0
, enabling users to manipulate the holders array.An approved user that has yet to receive tokens can initiate a transfer from another address to themself with an amount of 0. This enables them to add their address to the holders array multiple times. Then,
LiquidInfrastructureERC20.distribute()
will loop through the user multiple times and give the user more rewards than it should.This also enables any user to call burn with an amount of 0, which will push the zero address to the holders array causing it to become very large and prevent
LiquidInfrastructureERC20.distributeToAllHolders()
from executing.Proof of Concept
Tools Used
Manual Review
Recommended Mitigation Steps
Adjust the logic in
_beforeTokenTransfer
to ignore burns, transfers where the amount is 0, and transfers where the recipient already has a positive balance.Assessed type
Token-Transfer