104 — Non-Canonical Bump / PDA Derivation Confusion
Severity: 7 | Real: Sealevel Attacks — "bump seed canonicalization"
find_program_address returns the canonical (highest valid) bump for a set of seeds. create_program_address accepts ANY bump and will succeed for multiple non-canonical bumps, yielding several valid PDAs for the same logical seeds. A program that accepts a user-supplied bump and derives with create_program_address (or Anchor seeds::bump without storing/reusing the canonical bump) lets an attacker create "shadow" accounts for the same entity — duplicate positions, parallel vaults, or bypassed one-per-user invariants.
Verification Procedure
Step 1: Find PDA derivations and bump handling
grep -rn --include="*.rs" -E "create_program_address|find_program_address|Pubkey::create_program_address|bump" programs/Step 2: Flag user-supplied bumps fed to create_program_address
- ✅ PASS: Bumps come from
find_program_address/ Anchor canonicalbumpand are stored in state, then reused viabump = account.bump - ❌ FAIL: An instruction argument bump is passed into
create_program_addresswithout proving it is canonical
Step 3: Verify stored-bump reuse on all subsequent access
grep -rn --include="*.rs" -E "bump = [a-z_]+\.bump|bump,\s*$" programs/*/src/instructions/- ✅ PASS: Every access after init uses the stored canonical bump
- ❌ FAIL: Bump re-derived or re-supplied per call (allows non-canonical variant)
- Bump provenance: classify the last element of every
create_program_addressseed list — instruction argument with no== find_program_address(..).1comparison in the fn or its helpers (High); field of a Borsh-decoded instruction struct (High); account field (safe only if written fromctx.bumps/find_program_addressat aninitthat usedseeds+ barebump). A stored canonical bump withcreate_program_addressis recommended, not a finding. - PoC recipe: enumerate
b in 0..=255, keep bumps wherecreate_program_addresssucceeds (about half), call create+claim per bump; fixed code allows exactly one (templates/poc/RECIPES.md).
Sources: crytic/solana-lints lints/bump_seed_canonicalization [paraphrased, cited: https://github.com/crytic/solana-lints]; Sealevel Sentinel (stantheman0128/sealevel-sentinel) src/detectors/bump-seed-canonicalization.ts (MIT, Copyright (c) 2026 Stan (stantheman0128)); Solana Foundation course content/courses/program-security/bump-seed-canonicalization.md [paraphrased, cited]; CDSecurity/cdsecurity-skills rust-audit-prep/references/checklist.md create_program_address row, corrected (MIT, Copyright (c) 2026 CD Security).
Step 4: Verify one-per-entity invariants hold under non-canonical bumps
- For "one position per user", "one vault per fund", etc.: confirm a second non-canonical PDA cannot be initialized for the same seeds
- ✅ PASS:
inituses canonical seeds+bump; duplicates impossible - ❌ FAIL: Attacker can
inita parallel account with a non-canonical bump
Overall verdict:
- ✅: Canonical bumps only, stored and reused; no
create_program_addresswith untrusted bump - ⚠️: Canonical at init but re-derived elsewhere (defense-in-depth gap)
- ❌: User-supplied bump used in derivation — shadow PDAs possible