Flow

Sablier
FoundryDeFi
20,000 USDC
View results
Submission Details
Severity: high
Invalid

Potential Reentrancy Vulnerability in Batch Function

Summary

The batch function utilizes delegatecall to execute multiple encoded functions within the contract. If any of these encoded functions involve external calls, they may be susceptible to reentrancy attacks, allowing an attacker to manipulate the contract's state in unintended ways.

Vulnerability Details

Delegatecall Usage: The batch function employs delegatecall, which executes functions in the context of the calling contract. This means that the state of the calling contract can be modified, making it sensitive to security risks. An attacker could repeatedly call the batch function before the previous execution completes. This can lead to multiple entries in the function's execution stack, potentially manipulating the contract's state in undesirable ways.

Impact

Attackers could exploit reentrancy to alter the contract's state, leading to unauthorized transfers or changes.

Tools Used

Manual Review

Recommendations

Added CEI pattern and add the following event

event FunctionCalled(address indexed caller, bytes data);
function batch(bytes[] calldata calls) external {
uint256 count = calls.length;
// Checks: Validate input
require(count > 0, "Batch: No calls provided");
for (uint256 i = 0; i < count; ++i) {
// Emit an event for logging purposes
emit FunctionCalled(msg.sender, calls[i]);
// Interactions: Perform the delegatecall
(bool success, bytes memory result) = address(this).delegatecall(calls[i]);
if (!success) {
revert Errors.BatchError(result);
}
}
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Too generic
inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Too generic

Appeal created

ghufranhassan1 Submitter
10 months ago
inallhonesty Lead Judge
10 months ago
inallhonesty Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Too generic

Support

FAQs

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