Until recently, Solana developers had virtually no access to fuzzing tools. While Ethereum has a mature fuzzing ecosystem, Solana’s security testing has so far consisted primarily of unit tests, integration tests, and academic research tools that are not production-ready.
Trident changes this by bringing the most advanced smart contract fuzzing technique, Manually Guided Fuzzing (MGF), directly to Solana programs. This enables Solana developers to enjoy the best fuzzing methodology for security testing.
Guided Discovery Instead of Brute Force
Unit and integration tests provide essential ground-level protection, but they miss complex edge cases. Traditional black-box fuzzing attempts to explore the entire state space through brute force, but Solana programs’ state space is too large to search completely.
The key issue is that black-box fuzzers either stop at arbitrary points, or implement heuristics to guide exploration. Both approaches miss critical vulnerabilities.
Instead of relying on algorithmic heuristics, MGF enables developers and security researchers to:
- Target known attack patterns by testing scenarios based on real vulnerability research,
- Simulate attacker behavior through crafted instruction sequences that mirror actual exploits,
- Focus on protocol-specific risks, addressing a given system’s unique attack surface,
- Achieve deterministic coverage – ensuring critical edge cases receive testing attention.
This approach has proven effective in our Ethereum security work, consistently discovering vulnerabilities that other automated approaches and manual audits miss.
Solana Needs Specialized Fuzz Testing
Solana’s execution model is different from Ethereum’s EVM in state management. Unlike Ethereum contracts that maintain internal persistent storage, Solana programs are stateless executables that operate on external accounts passed in each transaction.
This separation enables Solana’s parallel processing capabilities but introduces specific types of vulnerabilities. Generic fuzzing tools miss these unique attack vectors.
Account-Based State Management
Solana programs must explicitly validate every account provided in a transaction, creating opportunities for account confusion attacks. A program might assume an account is one of its owned Program Derived Addresses (PDAs) when an attacker has actually provided a malicious substitute.
Example vulnerability pattern:
// Vulnerable: No ownership verification
pub fn process_instruction(
program_id: &Pubkey,
accounts: &[AccountInfo],
instruction_data: &[u8],
) -> ProgramResult {
let vault_account = &accounts[0]; // Assumes this is the correct vault
// Process without verifying vault_account.owner == program_id
}
Black-box fuzzing cannot systematically discover these vulnerabilities because it doesn’t account for expected account relationships. MGF defines specific flows that test account substitution scenarios.
Parallel Execution and Race Conditions
Solana’s Sealevel runtime executes transactions concurrently when they don’t conflict on account access. While account locking prevents basic race conditions, subtle timing issues can still emerge, particularly around multi-instruction transactions and cross-program invocations (CPIs).
Cross-Program Invocation Complexities
Solana programs frequently invoke other programs through CPIs, creating complex transaction flows. A single user transaction can pack multiple instructions across different programs, with each potentially calling back to others. This creates Solana-specific attack surfaces, such as arbitrary CPI vulnerabilities where programs fail to validate the target program ID.
Solana-Specific Attack Vectors for MGF
Account Revival: The account closure and revival attack occurs when programs close accounts by zeroing lamports without proper marking. Attackers can “revive” accounts within the same transaction by transferring lamports back.
MGF Flow Example:
# Flow 1: Close account (zeroes lamports)
def flow_close_account():
close_user_stake_account(attacker_account)
# Flow 2: Revive account (same transaction)
def flow_revive_account():
system_transfer(attacker, closed_account, 1_lamport)
# Flow 3: Exploit revived account
def flow_exploit_revived():
claim_rewards(closed_account) # Should fail but might succeed
# Invariant: Closed accounts should not be reusable
@invariant
def account_closure_invariant():
assert closed_accounts_are_not_exploitable()
Missing Signer Checks: FuzzDelSol research found this vulnerability class in numerous deployed programs where critical operations proceeded without proper signer verification.
Arbitrary CPI Attacks: Programs allowing user-specified program IDs create attack vectors through malicious programs mimicking legitimate interfaces.
Vulnerable pattern:
// Dangerous: User-controlled program_id
invoke(
&token_instruction,
&[
user_provided_token_program.clone(), // Attacker controls this
source_account.clone(),
dest_account.clone(),
],
)?;
Solana Fuzzing Toolings
Trident: The first fuzzing framework for Solana programs written in Rust
Trident 0.11.0 is a major step forward in Solana security testing. While Ethereum has had Manually Guided Fuzzing for years, Solana developers previously lacked native tooling for this advanced testing approach. Trident brings the most sophisticated smart contract testing technique directly to Solana’s execution model.
Where black-box fuzzing relies on statistical sampling to find vulnerabilities, Trident enables systematic attack scenario construction. This targeted approach has already discovered vulnerabilities in leading Solana protocols, demonstrating the power of guided discovery over brute force.
Why Use Trident:
- SVM-speed execution: Optimized for Solana’s virtual machine performance
- Account model awareness: Understands Solana’s unique state management
- On-chain data integration: Enables testing against realistic blockchain conditions
- Cross-program interaction support: Handles complex CPI scenarios
- Property-based and stateful fuzzing: Provides comprehensive coverage approaches
Battle-Tested on Major Protocols:
Trident has been validated through real-world implementations with leading Solana projects:
- Wormhole: Cross-chain bridge infrastructure testing
- Unstoppable Domains: Decentralized domain security validation
- Kamino Finance: DeFi protocol vulnerability discovery
These deployments demonstrate Trident’s capability to handle complex, production-grade protocols where security failures could result in significant financial losses.
Alternative tools: Mollusk provides lightweight SVM execution for high-performance scenarios. Custom integrations use RPC interfaces but sacrifice in-process performance benefits.
Implementation Strategy
1. Environment Setup
First, set up your testing environment with the Solana toolchain, the Anchor framework, and the chosen fuzzing tools.
For Trident integration:
cargo install trident-cli
trident init your-project
2. Invariant Implementation
Invariants are properties that must always hold after any sequence of operations. They’re security assertions that get checked after each flow execution.
Define invariants that capture essential security properties:
- Conservation laws (token balances, reserves)
- Access control requirements
- State consistency across accounts
- Account ownership verification
- State consistency checks
3. Flow Definition
A flow represents a single test step in a sequence. Think of it as a single transaction or instruction call within a larger attack scenario. Flows allow you to model real-world attack patterns by chaining together specific instructions.
Identify critical instruction sequences based on program functionality and known vulnerability patterns. Focus on multi-instruction transactions that could expose race conditions or state inconsistencies.
4. Coverage Strategy
Ensure fuzzing campaigns cover:
- All public instructions with varied parameters
- Multi-instruction transaction patterns
- Account substitution scenarios
- CPI interaction patterns
- Edge cases around rent, compute limits
Advanced Techniques and Considerations
Differential Testing with Off-Chain Models
Implement simplified models of complex mathematical operations in high-level languages for comparison against on-chain implementations.
This technique proved effective in identifying precision errors in Solidity libraries and applies equally to Solana programs handling financial calculations.
Fork Testing Adaptation
While Solana doesn’t support direct mainnet forking like Ethereum’s Anvil, developers can clone specific mainnet accounts into test environments.
This enables testing against realistic on-chain data while maintaining the safety of a test environment.
Performance and Computational Considerations
Solana’s compute budget limits impose practical constraints on fuzzing scenarios. Design flows to remain within realistic transaction compute limits while still exercising critical code paths.
Consider using Mollusk for high-iteration scenarios where performance is a priority.
Best Practices and Limitations
Manually Guided Fuzzing on Solana requires a deep understanding of both the program logic and Solana’s execution model. The technique excels at finding complex interaction bugs but depends heavily on the quality of defined flows and invariants.
Key limitations of MGF:
- Requires significant manual effort and expertise
- May miss vulnerabilities outside defined flow scenarios
- Performance constraints limit iteration counts for complex scenarios
Mitigation strategies:
- Combine MGF with broad coverage-guided fuzzing for baseline coverage
- Regularly update flows based on new vulnerability research
- Integrate static analysis tools like Sec3’s X-Ray for comprehensive coverage
Conclusion
Solana’s architecture requires specialized security approaches. MGF transforms testing from hundreds of individual integration tests to systematic attack vector validation, discovering vulnerabilities that existing methods miss.
Success requires understanding Solana’s unique characteristics and relevant attack vectors. The payoff is systematic discovery of subtle vulnerabilities before production deployment.
The security of the Solana ecosystem depends on proactive testing approaches that can keep pace with increasingly sophisticated protocols. Trident provides the foundation for building that security into your development workflow from day one.
Start Securing Your Solana Programs Today
Trident makes Manually Guided Fuzzing accessible to any Solana development team. The framework is open source and designed to evolve with your security needs, from basic fuzzing to guided precision testing.
Get Started:
- Install:
cargo install trident-cli
- Website: https://usetrident.xyz/
- GitHub Repository: https://github.com/Ackee-Blockchain/trident
Additional Resources
- Solana Program Security Model: Official documentation on account closure and other security considerations
- Solana Common Attack Vectors: Community-maintained repository of typical Solana vulnerabilities
- FuzzDelSol Research: Academic paper detailing Solana-specific fuzzing approaches and bug discovery