Dynamic Arrays #160
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-31
sufficient quality report
This report is of sufficient quality
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/Que5/2023-10-ens/blob/main/contracts/ERC20MultiDelegate.sol#L57-L115
Vulnerability details
Impact
The contract can suffer from a Denial-of-Service (DoS) attack if a malicious actor bombards it with a large number of sources and targets until it stops working.
This is because the contract's delegateMulti function processes a potentially large number of sources and targets in a loop. If an attacker can provide a large number of sources and targets, the loop in the delegateMulti function could consume a significant amount of gas, potentially exceeding the block gas limit and causing the transaction to fail.
Proof of Concept
https://github.com/Que5/2023-10-ens/blob/main/contracts/ERC20MultiDelegate.sol#L57-L115
The contract can be exploited through a Denial-of-Service (DoS) attack, specifically a Reentrancy attack. This type of attack occurs when a contract calls another contract (in this case, the _processDelegation, _reimburse, and createProxyDelegatorAndTransfer functions) and, upon receiving a response, continues executing its code.
The potential DoS attack could be executed by providing a large number of sources and targets in the delegateMulti function. This would cause the contract to loop through each source and target, calling the _processDelegation, _reimburse, and createProxyDelegatorAndTransfer functions for each one. If an attacker can trigger this function with a large number of sources and targets, they could consume a significant amount of gas, potentially exceeding the block gas limit and causing the transaction to fail. Moreover an attacker could potentially call the delegateMulti function multiple times in quick succession, causing the contract to enter a state of continuous looping. This could cause the contract to become unresponsive, effectively stopping it from processing any further transactions.
Tools Used
Manual Analysis
Recommended Mitigation Steps
To mitigate the potential Denial-of-Service (DoS) attack, you can implement the following strategies:
Assessed type
DoS
The text was updated successfully, but these errors were encountered: