fix: correct is_signer flag for readonly accounts in transfer hook CPI#2175
fix: correct is_signer flag for readonly accounts in transfer hook CPI#2175ffulb wants to merge 1 commit intodrift-labs:masterfrom
Conversation
…ansfer hook In transfer_checked_with_transfer_hook, the readonly account branch passes account_info.is_writable as the is_signer parameter to AccountMeta::new_readonly(). Since readonly accounts have is_writable=false, this forces all readonly accounts to is_signer=false, silently stripping signer requirements from transfer hook additional accounts. This could allow unauthorized transfers through Token-2022 mints with transfer hooks that require a readonly signer account.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughA bug fix in the token controller's Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Security Fix — Critical: Wrong is_signer Flag in Transfer Hook Account Construction
File
programs/drift/src/controller/token.rs, line 269Vulnerability
In
transfer_checked_with_transfer_hook, the readonly account branch:passes
is_writable(which isfalsefor readonly accounts) as theis_signerparameter. This forces all readonly accounts in the transfer hook CPI tois_signer = false, silently stripping signer requirements.Impact
Fix
Additional Findings
I have 20 additional findings (1 Critical, 6 High, 6 Medium, 5 Low) across the Drift Protocol codebase. Key ones:
Happy to share all details. Contact via GitHub or hello@drift.trade.
Wallet for bounty:
0xd67c6444cD3617Bd6D0A52aCE0E4aA29127cEA68Summary by CodeRabbit