Flow

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

Reentrancy Vulnerability in Withdrawals

location: /src/SablierFlow.sol

code :

function withdraw(uint256 amount) external {
require(balances[msg.sender] >= amount, "Insufficient balance");
balances[msg.sender] -= amount;
token.safeTransfer(msg.sender, amount); // Vulnerable line
}

Impact

  • Description: The withdraw function first decrements the user's balance and then makes an external call to transfer tokens. If the token contract is malicious and calls back into the withdraw function before the state is updated, it could allow the attacker to withdraw more than their balance.

  • Real-World Consequences: This vulnerability could lead to significant financial losses for users and damage the reputation of the contract.

Recommendations

  • Checks-Effects-Interactions Pattern: Change the order of operations. Perform state updates (effects) before making external calls (interactions).

  • Reentrancy Guard: Implement a reentrancy guard using OpenZeppelin's ReentrancyGuard to prevent multiple invocations of the function.

Updates

Lead Judging Commences

inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Lack of quality
inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Lack of quality

Support

FAQs

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