Unsafe Deserialization
A vulnerability where account data is deserialized into a Rust struct without validating that the data length, discriminator, or content matches expectations, potentially allowing an attacker to craft maliciously structured account bytes that cause undefined behavior, skip field initialization, or be misinterpreted as a different struct type. In Solana programs, using try_from_slice on data that is shorter than the expected struct silently succeeds in some configurations (or panics in others), leaving fields zeroed or corrupted. The safe pattern is to always validate the discriminator prefix, use try_from_slice_unchecked only when bounds are independently guaranteed, and leverage Anchor's automatic discriminator enforcement on Account<'info, T> deserialization.
Sua exploração
0 termos visitados no totalTermos Relacionados
Binary Object Representation Serializer for Hashing—the standard serialization format for …
Ver termo →The byte array stored in an account that holds program-specific state. Data is typically s…
Ver termo →A vulnerability, also called account confusion, where a program deserializes an account as…
Ver termo →