Skip to content

fix: patch 8 security vulnerabilities in escrow and fundraiser programs#17

Open
Potdealer wants to merge 1 commit intoeacc-labs:mainfrom
Potdealer:security-fixes
Open

fix: patch 8 security vulnerabilities in escrow and fundraiser programs#17
Potdealer wants to merge 1 commit intoeacc-labs:mainfrom
Potdealer:security-fixes

Conversation

@Potdealer
Copy link

Summary

Security audit identifying and fixing 8 vulnerabilities (3 Critical, 4 High, 1 Medium) across the Anchor escrow and Pinocchio fundraiser programs.

Escrow Program (Anchor) — 5 findings

  • [CRITICAL] Missing deposit() call in make instruction — vault is created empty, escrow is non-functional
  • [CRITICAL] Wrong mint account (maker_ata_y instead of mint_y) passed to transfer_checked CPI in take — runtime failure
  • [HIGH] Incorrect mint constraint on maker_ata_y — validated against mint_x instead of mint_y
  • [HIGH] PDA seed endianness mismatch — to_be_bytes() in withdraw/close vs to_le_bytes() used at PDA creation, causing signer verification failure
  • [HIGH] Vault closure rent lamports sent to taker instead of maker — systematic rent theft from escrow creators

Fundraiser Program (Pinocchio) — 3 findings

  • [CRITICAL] Inverted comparison in checker — allows fund withdrawal before target is met, blocks withdrawal after target is met
  • [MEDIUM] Missing ? on invoke_signed CPI in checker — transfer errors silently discarded
  • [HIGH] Missing contributor PDA validation in refund — any signer can claim another contributor's refund

Files Changed

  • anchor/escrow/programs/escrow/src/lib.rs — Added deposit call
  • anchor/escrow/programs/escrow/src/instructions/make.rs — Fixed mint constraint
  • anchor/escrow/programs/escrow/src/instructions/take.rs — Fixed mint in CPI, endianness, close destination, added maker account
  • pinocchio/fundraiser/src/instructions/checker.rs — Fixed comparison, added error propagation
  • pinocchio/fundraiser/src/instructions/refund.rs — Added contributor PDA validation

Full detailed audit report with severity ratings, impact analysis, and proof of concept for each finding is included in SECURITY-AUDIT.md.

Test plan

  • Verify escrow make instruction deposits tokens into vault
  • Verify escrow take instruction completes full exchange lifecycle
  • Verify fundraiser checker only allows withdrawal when target is met
  • Verify fundraiser refund rejects contributor accounts not derived from signer
  • Run existing test suites to confirm no regressions

🤖 Generated with Claude Code

…ograms

Escrow (Anchor):
- Add missing deposit() call in make instruction (tokens never transferred to vault)
- Fix maker_ata_y mint constraint from mint_x to mint_y
- Fix wrong mint account in take deposit transfer CPI
- Fix PDA seed endianness mismatch (to_be_bytes -> to_le_bytes) in withdraw and close
- Fix vault closure rent destination from taker to maker (add maker account to Take struct)

Fundraiser (Pinocchio):
- Fix inverted target comparison in checker (>= to <) that allowed premature withdrawal
- Add error propagation (?) on invoke_signed CPI in checker
- Add contributor PDA validation in refund to prevent unauthorized claims

Full audit report in SECURITY-AUDIT.md.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bytetwt
Copy link
Member

bytetwt commented Feb 24, 2026

@Potdealer can you please provide the test cases results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants