Skip to content

Conversation

@SwenSchaeferjohann
Copy link

No description provided.

Validate AccountType discriminator at byte 165 for accounts larger than
165 bytes to prevent type confusion between Mint and Account types.

- Add ACCOUNT_TYPE_OFFSET, ACCOUNT_TYPE_MINT, ACCOUNT_TYPE_TOKEN_ACCOUNT constants
- Add ACCOUNT_TYPE const to Transmutable trait
- Check byte[165] in load_unchecked and load_mut_unchecked when size > 165
- Account uses ACCOUNT_TYPE = 2, Mint uses ACCOUNT_TYPE = 1
Document signer_is_validated parameter, AccountType validation,
library conversion, and note that multisig is not supported.
Return NativeNotSupported error for native account transfers.
Lamport transfer logic commented out for reference.
…ctions

Fixes vulnerability where Token account (165 bytes) could be loaded as Mint (82 bytes)
because AccountType check was only performed for extended accounts (>165 bytes).

Now accepts only:
- Exact length match (bytes.len() == T::LEN) for standard accounts
- Extended accounts (>165 bytes) with matching AccountType discriminator

Adds unit tests covering all validation scenarios.
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.

3 participants