Skip to content

fix(rewards-program): validate token account owner in revoke instructions#33

Merged
dev-jodee merged 1 commit into
mainfrom
fix/revoke-token-account-owner-validation
Apr 22, 2026
Merged

fix(rewards-program): validate token account owner in revoke instructions#33
dev-jodee merged 1 commit into
mainfrom
fix/revoke-token-account-owner-validation

Conversation

@dev-jodee
Copy link
Copy Markdown
Collaborator

Summary

  • Adds verify_token_account_owner utility that reads the token account's internal owner field (bytes 32..64) and compares against the expected owner pubkey
  • Validates recipient token account ownership in RevokeDirectRecipient
  • Validates claimant token account ownership in RevokeMerkleClaim

Previously both revoke instructions only checked that the token account was owned by the token program (verify_owned_by). This allowed the authority to substitute their own token account in NonVested mode, causing vested tokens to be transferred to the authority instead of the recipient.

Audit finding: #2 (Critical)

Test plan

  • just build
  • cargo test -p rewards-program --lib
  • cargo test -p tests-rewards-program test_revoke_direct
  • cargo test -p tests-rewards-program test_revoke_merkle

…ions

Verify that the recipient/claimant token account's internal owner field
matches the actual recipient/claimant pubkey. Previously only token-program
ownership was checked, allowing the authority to substitute their own token
account and steal vested tokens in NonVested revoke mode.
@dev-jodee dev-jodee requested a review from amilz April 22, 2026 18:57
@dev-jodee dev-jodee merged commit bf4077e into main Apr 22, 2026
7 checks passed
@dev-jodee dev-jodee deleted the fix/revoke-token-account-owner-validation branch April 22, 2026 18:57
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.

1 participant