Escrow `fund()` allows issue-id griefing via front-running before the legitimate sponsor funds
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 15/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- rust
- Área
- blockchain, security
Línea de trabajo
Start with contracts/escrow/src/lib.rs::fund() and contracts/escrow/src/test.rs, then verify Soroban transaction ordering assumptions before choosing a mitigation. Compare the funding flow with the README and consider the related patterns in the milestones and maintenance-pool contracts. Done means implementing and testing a mitigation, documenting its trust assumptions, and confirming the required test and build commands pass.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Background / Context
contracts/escrow/src/lib.rs::fund() uses issue_id (a u64 chosen off-chain by mergefi-backend/the sponsor's wallet) as the sole key into persistent storage (DataKey::Escrow(issue_id)), and rejects a second fund call on the same id with AlreadyFunded. Critically, fund performs no admin check and no validation that the caller is the "intended" sponsor for that issue — any address can call fund(issue_id, sponsor=attacker, token=<attacker-chosen>, amount=1, deadline=<attacker-chosen>) for any issue_id, as long as they supply a valid require_auth signature for themselves as sponsor.
Problem Statement
Because Stellar issue ids are presumably predictable (sequential GitHub issue numbers, or a deterministic hash the backend computes ahead of time), an attacker who front-runs the real sponsor's fund transaction — or simply calls fund proactively for issue ids they anticipate being funded — permanently claims that issue_id slot with a trivial deposit (amount=1) of a token of their choosing. The legitimate sponsor's later fund call then reverts with AlreadyFunded, and there is no top-up or re-fund-different-id path described in the README. This is a low-cost, high-impact griefing vector against a system whose entire value proposition is "sponsors fund GitHub issues."
Requirements
- Analyze the full griefing surface: is
issue_idpredictable/guessable before the realfundcall lands? Model the mempool/submission-ordering assumptions on Stellar/Soroban (there is no public mempool in the traditional sense, but front-running via fee/priority is still analyzed differently — investigate Soroban's actual transaction ordering guarantees). - Propose and implement a mitigation: options include (a) binding
fundto a specific expected sponsor address set at issue-creation time by the admin/oracle, (b) a commit-reveal or admin-pre-registration step beforefundis callable, (c) an admin-callablereassign/force_refund_and_reopenrecovery path for squatted ids, or another design you can justify as superior. - Add regression tests in
contracts/escrow/src/test.rsthat reproduce the griefing scenario and prove the fix closes it (attacker funds first, legitimate sponsor's transaction should still succeed, or attacker's low-value funding should be recoverable without requiring off-chain intervention). - Document the chosen trust model change in the README's escrow section.
Acceptance Criteria
- Written analysis of whether/why
issue_idsquatting is exploitable given Soroban's actual ordering model (not just Ethereum-style mempool assumptions) - A concrete, implemented mitigation in
contracts/escrow/src/lib.rs - New tests proving the attack fails post-fix and existing legitimate flows (README's funding flow) still pass
-
cargo test --workspacegreen,make buildstill produces valid wasm - README updated to reflect the new trust assumptions for
fund
Technical Notes / Hints
- Relevant code:
contracts/escrow/src/lib.rslines ~54-88 (fund),types.rsDataKey::Escrow(u64). - Consider whether the fix should also apply symmetrically to
create_milestone(contracts/milestones/src/lib.rs) anddeposit's implicit pool-creation-on-first-deposit (contracts/maintenance-pool/src/lib.rs) — file separate issues if the fix diverges per contract, but note the shared pattern here.
Difficulty Justification
This requires understanding Soroban/Stellar's actual transaction-ordering and mempool semantics (not assumed from EVM intuition), reasoning about an economic griefing attack with no simple "add a require" fix, and designing a new access-control primitive that doesn't break the permissionless, oracle-driven trust model the rest of the contract relies on. Getting the fix wrong (e.g., adding an admin-only fund) would break the sponsor-initiated funding flow the whole product depends on.
- Lenguaje dominante
- Rust
- Estrellas
- 1
- Forks
- 102
- Merge medio
- 4 h 12 min
- PR fusionados (30 d)
- 30
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de MergeFi/contracts
-
allocations map retains released issues — phantom ledger driftQuizá libre de nuevo @PINYOPATTANAWASANPORN la tomó hace 12 días y no hay ningún pull request abierto. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 25/100
MergeFi/contracts#608 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
escrow::contribute and milestones::contribute accept new funds after deadline + GRACE_PERIOD, when anyone can already refund or cancelPosiblemente ocupada @urielit1313-creator la tomó hace 29 días. Abiertobug
Dificultad 3/5 1-2 días Aptitud para principiantes 25/100
MergeFi/contracts#568 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Makefile deploy targets deploy the unoptimised .wasm — `stellar contract optimize` writes *.optimized.wasmPosiblemente ocupada @urielit1313-creator la tomó hace 29 días. Abiertobug good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 25/100
MergeFi/contracts#567 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
keep_alive never refreshes instance storage, so a contract kept alive only via keep_alive can still archive Admin/Oracle/TreasuryPosiblemente ocupada @urielit1313-creator la tomó hace 29 días. Abiertobug
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
MergeFi/contracts#566 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
[Regression on closed #254] milestones::deallocate still has no test asserting admin authorizationPosiblemente ocupada @urielit1313-creator la tomó hace 29 días. Abiertosecurity testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 25/100
MergeFi/contracts#565 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de MergeFi/contracts
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
design-data-spec
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
adobe/spectrum-design-data#1744 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
USERID reads /etc/passwd directly instead of looking the user upPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertodefect
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día