This scenario outlines a potential Denial-of-Service (DoS) attack on the airdropERC20 function in the TSender contract:
Attacker's Goal:
The attacker aims to disrupt the airdrop process by causing the transaction to consume excessive gas and ultimately revert. This could prevent legitimate airdrops from being processed or slow down the entire network.
Attack Method:
Crafting a Malicious Transaction:
The attacker creates a transaction calling the airdropERC20 function.
Instead of a reasonable number of recipients, the attacker specifies an excessively large number (e.g., thousands or millions) in the recipient list.
Alternatively, the attacker might choose very small individual transfer amounts (e.g., fractions of a wei).
Gas Consumption:
The airdropERC20 function iterates through each recipient and amount in the calldata.
With an enormous number of recipients, the loop iterations significantly increase.
Processing each recipient involves memory accesses, calculations, and potentially even additional function calls (if using libraries).
The combination of a large number of iterations and potentially complex operations within the loop leads to high gas consumption.
Transaction Reversion:
Due to the excessive gas usage, the transaction likely reaches the gas limit set for the blockchain.
As the gas limit is exceeded, the entire transaction reverts, failing to complete the airdrop and wasting gas spent on processing the malicious transaction.
Network Impact:
If multiple malicious transactions are submitted simultaneously, they can collectively consume a significant amount of gas, potentially leading to network congestion and slowing down transaction processing for everyone.
Impact on TSender Contract:
Legitimate airdrops might be hindered due to failed transactions caused by DoS attacks.
The contract owner might incur unnecessary gas costs due to processing malicious transactions.
The reputation of the contract could be tarnished if DoS attacks become frequent.
Mitigating DoS Attacks:
Limiting Recipients: Implement a maximum allowed number of recipients per airdrop transaction to prevent attackers from specifying excessively large numbers.
Minimum Transfer Amount: Set a minimum allowed transfer amount to discourage attackers from using very small amounts that inflate gas costs.
Gas Optimization: Review the code and optimize gas usage within the airdropERC20 function, focusing on the loop and potential library interactions.
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.