How to interpret and act on Believe Security findings
After Believe Security completes the analysis of your Solana program, you'll receive a comprehensive report detailing any identified vulnerabilities, potential issues, and recommendations for improvement. This guide will help you understand how to interpret these results and take appropriate action.
Believe Security results are organized into several key sections:
The executive summary provides a high-level overview of the analysis, including:
The core of the report is the list of vulnerabilities, organized by severity. Each vulnerability entry includes:
The program fails to verify that the transaction is signed by the appropriate authority, allowing unauthorized access to protected withdrawal operations. This critical vulnerability could allow an attacker to withdraw funds without authorization.
pub fn process_withdraw( program_id: &Pubkey, accounts: &[AccountInfo], amount: u64, ) -> ProgramResult { let account_info_iter = &mut accounts.iter(); let authority = next_account_info(account_info_iter)?; let vault = next_account_info(account_info_iter)?; // VULNERABILITY: No verification that authority is a signer transfer_funds(amount, vault, authority)?; Ok(()) }
pub fn process_withdraw( program_id: &Pubkey, accounts: &[AccountInfo], amount: u64, ) -> ProgramResult { let account_info_iter = &mut accounts.iter(); let authority = next_account_info(account_info_iter)?; let vault = next_account_info(account_info_iter)?; // Verify that the authority is a signer if !authority.is_signer { return Err(ProgramError::MissingRequiredSignature); } transfer_funds(amount, vault, authority)?; Ok(()) }
An attacker could execute unauthorized withdrawals, potentially draining all funds from the vault. This is a critical security vulnerability that should be addressed immediately.
In addition to vulnerabilities, Believe Security provides recommendations for following best practices that can improve your code's security, readability, and maintainability.
Consider using more specific error types instead of returning generic program errors. This will improve error messages and make debugging easier.
fn validate_account(account: &AccountInfo) -> ProgramResult { if account.data_len() < MIN_ACCOUNT_SIZE { return Err(ProgramError::InvalidAccountData); } // Other validation... Ok(()) }
// Define custom error types #[derive(Debug)] pub enum AccountError { InsufficientSize { expected: usize, actual: usize }, InvalidOwner { expected: Pubkey, actual: Pubkey }, // Other specific errors... } impl From<AccountError> for ProgramError { fn from(e: AccountError) -> Self { ProgramError::Custom(1) // Map to appropriate error codes } } fn validate_account(account: &AccountInfo) -> Result<(), AccountError> { if account.data_len() < MIN_ACCOUNT_SIZE { return Err(AccountError::InsufficientSize { expected: MIN_ACCOUNT_SIZE, actual: account.data_len(), }); } // Other validation... Ok(()) }
Believe Security may suggest performance optimizations to reduce compute unit usage and improve program efficiency.
Believe Security uses the following severity levels to prioritize issues:
Issues that could lead to immediate fund loss or complete program compromise. These should be addressed immediately before deployment.
Serious vulnerabilities that could lead to significant security issues. These should be addressed before deployment to production.
Issues that may have security implications but with limited impact. These should be addressed in a timely manner.
Minor issues or best practice recommendations that should be addressed but don't pose immediate security risks.
When addressing the findings in your report, we recommend the following prioritization:
Believe Security provides an interactive interface for exploring and managing analysis results. Here's how to use it effectively:
Use the filtering options to focus on specific types of issues:
For each vulnerability, you can:
You can export analysis results in multiple formats:
As you address vulnerabilities, you can mark them as fixed in the interface. This helps track your progress and maintain a record of security improvements. In continuous analysis mode, Believe Security will automatically verify fixed issues in subsequent scans.
For optimal security, we recommend integrating Believe Security into your development workflow through continuous analysis:
Continuous analysis helps catch vulnerabilities early in the development process and ensures that security remains a priority throughout your project lifecycle.