Skip to content

Lack of reentrancy guard in cancel_stream function #72

Description

@Jaydbrown

Description

The cancel_stream function currently transfers the remaining token balance back to the sender before fully updating the stream's active state in storage. While Soroban has some mitigations, if the token contract allows for callbacks, this could potentially be exploited to reenter the contract.

Suggested Fix

Apply the Checks-Effects-Interactions pattern strictly:

  1. Load the stream state and verify the caller is authorized (Checks).
  2. Update the stream state in storage to Canceled and zero out the pending balances (Effects).
  3. Perform the token transfers to the sender and recipient (Interactions).
    Optionally, add a standard reentrancy guard if complex callbacks are expected.

Metadata

Metadata

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions