Skip to main content

BytesUnchecked

Welcome to BytesUnchecked, a reference repository for Solana developers to explore critical security patterns and their implementations in Anchor.

Overview

This project provides a side-by-side comparison of Insecure vs. Secure implementations for 7 common Solana vulnerability patterns.

1. Vulnerability Examples

Each example includes:

  • The Exploit: A TypeScript test demonstrating how the vulnerability can be abused.
  • The Fix: A secure implementation using Anchor framework best practices.
  • The Analysis: A breakdown of the security flaw and the mitigation strategy.

The Vulnerability Matrix

IDVulnerabilityCategoryFocus
01Missing SignerSignature VerificationIdentity Validation
02Arithmetic OverflowLogicChecked Math
03PDA Seed LeakPrivacyPDA Security
04Account ClosingMemoryData Zeroing
05Type ConfusionAccount ValidationDiscriminators
06Zero-Copy AlignmentMemoryMemory Layout
07Hook ReentrancyCPI LogicCEI Pattern