Maintenance-pool `deposit()` allows pool-id squatting via `TokenMismatch` griefing
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 20/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- rust
調査の方向性
Read contracts/maintenance-pool/src/lib.rs around deposit() and contracts/maintenance-pool/src/types.rs for the pool key, then inspect the pool ID generation assumption described in the issue. Review the open linked pull request before starting, since it may already be addressing this work. A complete fix must prevent token squatting, preserve permissionless recurring deposits and admin-authorized withdrawals, and include the described tests in contracts/maintenance-pool/src/test.rs; the issue specifies cargo test --workspace.
索引モデルが issue の本文から書いたものです。
説明
Background / Context
contracts/maintenance-pool/src/lib.rs::deposit() creates a MaintenancePool on first deposit for a given pool_id, locking in whatever token the first depositor supplies (pool.deposit_count > 0 && pool.token != token → TokenMismatch). pool_id is described in types.rs as "an off-chain-assigned id for a repo/org," implying it's likely derived deterministically (e.g., hash of owner/repo) and therefore guessable ahead of time by anyone watching GitHub activity.
Problem Statement
An attacker can call deposit(pool_id, attacker, some_worthless_token, 1) for any repo/org they expect to receive real sponsor funding, permanently locking that pool to the worthless token. Every subsequent legitimate sponsor deposit in the intended asset (e.g., USDC on Stellar) reverts with TokenMismatch, with no recovery path in the contract (no admin override, no per-token sub-pools). This is a cheap, repeatable denial-of-service against the "recurring maintenance funding" product surface, distinct from and worth separating from the escrow-id-squatting issue because the recovery constraints differ (a pool is meant to be long-lived and repeatedly topped up, so there's no natural "just use a different id" workaround the way there might be for a one-off escrow).
Requirements
- Determine whether
pool_idgeneration is/should be unpredictable (out of scope to change the backend, but document the assumption) or whether the contract must be hardened regardless. - Design and implement a fix: candidates include admin-gated pool creation (a separate
create_pool(pool_id, token)admin call beforedepositis permitted), an allowlist of valid tokens set atinitialize, or a per-(pool_id, token)compound key so multiple tokens can coexist per pool without collision (requires rethinkingget_pool/balancesemantics). - Add tests in
contracts/maintenance-pool/src/test.rsreproducing the squat and validating the fix. - Ensure the fix doesn't regress the "sponsors can deposit repeatedly over time" recurring-funding use case central to this contract's purpose.
Acceptance Criteria
- Documented threat model for
pool_idpredictability - Implemented fix in
contracts/maintenance-pool/src/lib.rsandtypes.rsas needed - Tests proving squat attempts no longer block legitimate sponsors
- No breaking change to
withdraw's admin-authorized payout flow -
cargo test --workspacepasses
Technical Notes / Hints
- Code:
contracts/maintenance-pool/src/lib.rslines ~51-104,DataKey::Pool(u64)intypes.rs. - Consider interaction with
Deposithistory keyed by(pool_id, deposit_index)if you change how pools are created/keyed.
Difficulty Justification
The naive fix (reject deposits from non-admin on pool creation) conflicts with the contract's explicit design goal of being sponsor-initiated and permissionless for deposits. A correct solution must preserve permissionless recurring deposits while eliminating the squatting vector — this is a genuine access-control/design tradeoff requiring judgment, not a mechanical patch.
- 主要言語
- Rust
- スター
- 1
- フォーク
- 102
- 平均マージ
- 4時間 12分
- マージ済み PR(30日)
- 30
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
MergeFi/contracts のほかの issue
-
allocations map retains released issues — phantom ledger drift再び着手できるかも @PINYOPATTANAWASANPORN が 12 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 25/100
MergeFi/contracts#608 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
escrow::contribute and milestones::contribute accept new funds after deadline + GRACE_PERIOD, when anyone can already refund or cancel対応中かも @urielit1313-creator が 29 日前に担当しました。 オープンbug
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
MergeFi/contracts#568 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
Makefile deploy targets deploy the unoptimised .wasm — `stellar contract optimize` writes *.optimized.wasm対応中かも @urielit1313-creator が 29 日前に担当しました。 オープンbug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 25/100
MergeFi/contracts#567 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
keep_alive never refreshes instance storage, so a contract kept alive only via keep_alive can still archive Admin/Oracle/Treasury対応中かも @urielit1313-creator が 29 日前に担当しました。 オープンbug
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
MergeFi/contracts#566 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
[Regression on closed #254] milestones::deallocate still has no test asserting admin authorization対応中かも @urielit1313-creator が 29 日前に担当しました。 オープンsecurity testing
難易度 2/5 1〜3時間 初心者へのやさしさ 25/100
MergeFi/contracts#565 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
MergeFi/contracts の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
design-data-spec
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
adobe/spectrum-design-data#1744 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
USERID reads /etc/passwd directly instead of looking the user up対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンdefect
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信