Skip to content

Double-refund vulnerability in release_creation_deposit #186

@hman38705

Description

@hman38705

Description
release_creation_deposit (Line 211) checks if market.creation_deposit > 0 and then performs a transfer. However, it does not set the market.creation_deposit field to 0 after the transfer. A malicious actor (or even a bug in the loop) could repeatedly call this function as long as the market remains Resolved, draining the contract's balance if multiple depositors are involved.

Requirements and context

  • Set the deposit amount in the market struct to 0 immediately after a successful transfer.
  • Implement the Checks-Effects-Interactions pattern strictly.

Suggested execution

  • Fork the repo and create a branch: git checkout -b fix/issue-83-double-refund-guard
  • Update the deposit release logic.

Implementation changes

  • Modify markets.rs (around line 228) to update the market state before or immediately after the transfer.

Test and commit

  • Verify that a second call to release_creation_deposit for the same market returns successfully but performs no transfer.

Example commit message
fix: prevent double-refund of creation deposits by zeroing state after release

Guidelines

  • Re-entrancy and double-spend protection.
  • Timeframe: 24 hours.

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions