- Audit: Has the contract been reviewed by a third-party security audit?
- Review external contracts: Does the contract interact securely with other external contracts?
- Check admin permissions: Are administrative functions restricted to authorized users only?
- Secure contract upgrade process: Is there a secure method for upgrading or migrating the contract?
- Validate user inputs: Are all inputs from users properly validated to prevent issues like injection or overflows?
- Reentrancy: Is the contract vulnerable to reentrancy attacks? Ensure functions update their internal state before making external calls.
- Test for Reentrancy: Use automated tools like Slither to test for reentrancy vulnerabilities. Ensure functions update internal state before making external calls.
- Validate All Inputs: Ensure all user inputs, including transaction amounts, addresses, and IDs, are validated to avoid common issues like overflow, underflow, or invalid entries.
- Test Invalid or Out-of-Order Transactions: Test the contract’s ability to handle invalid transaction sequences, especially grouped transactions.
- Check access restrictions: Are only authorized users able to access critical functions or sensitive data?
- Correct function visibility: Are functions marked with the correct visibility (
private
,internal
,public
)? - Admin function protection: Are critical administrative functions like
mint
,burn
, andpause
properly secured? - Check Ownership and Admin Privileges: Ensure that only authorized addresses can perform critical operations like minting, burning, staking, and withdrawal.
- Multisig Program: Implement multisig mechanisms for key administrative operations to prevent malicious actions by a single admin.
- Role-based Function Access: Test if the contract properly limits access to certain functions based on roles, like signatory and validator.
- Validate arithmetic calculations: Are all arithmetic operations protected from overflows and underflows? Is
SafeMath
or equivalent being used?
- Check usage of
block.timestamp
: Does the contract rely onblock.timestamp
in a way that could be manipulated by miners?
- Timestamp Dependence: Check for reliance on
block.timestamp
and ensure it cannot be manipulated by miners to gain unfair advantages. - Pool Start and End Date Validation: Confirm that pool start dates are properly validated to prevent issues where a pool starts in the past.
- Integer Overflow and Underflow: Verify that arithmetic operations in the contract are protected using libraries like
SafeMath
or similar mechanisms. Check for missing underflow protection as identified in Yieldly audits.
- DAO and Governance Attacks: Test for possible governance manipulation where attackers could execute critical actions like upgrading contracts, minting new tokens, or changing protocol rules.
- Threshold Validation for Voting: Verify that threshold limits are properly defined and applied in voting mechanisms for signatory and validator roles.
- Validate external calls: Does the contract properly check the return values of external calls to ensure execution halts on failure?
- Call and Delegatecall: Are functions using
call()
ordelegatecall()
implemented securely to avoid malicious code execution? - Unchecked External Calls: Ensure that external calls are properly validated and that the contract does not proceed after failed external calls.
- Proxy Contract Validation: Verify that the contract utilizes proxy contracts securely. Ensure that transactions routed through the proxy cannot be bypassed.
- Gas limits: Are contract functions designed to stay within gas limits? Are long-running loops avoided to prevent gas exhaustion?
- Efficient gas usage: Ensure that gas is not wasted unnecessarily, particularly in critical functions.
- ERC20/721 compliance: Are the token contracts (ERC20, ERC721) following the proper standards?
- Transfer permissions: Can transfer functions be manipulated? Does the contract handle permissions and limits correctly?
- Randomness generation: If the contract generates random numbers, are they generated securely to avoid manipulation?
- Test DoS resistance: Can the contract be locked or rendered unusable by malicious transactions that consume excessive gas or halt critical functions?
- Loops in functions: Ensure that functions looping over arrays or lists do not allow attackers to exhaust gas limits.
- Storage and data access: Ensure the contract is storing and accessing data efficiently.
- State updates: Does the contract correctly update its state after each transaction?
- Prevent front-running: Can important transactions be manipulated or reordered by front-running attacks?
- Protect against phishing: Test how the contract handles interactions with user interfaces that may deceive users.
- Test randomness sources: Are random numbers generated using secure and unpredictable sources to prevent manipulation?
- Implement Emergency Withdraw: Confirm that users have access to emergency withdrawal functions to recover funds if a contract enters an unexpected state. Ensure admin privileges on emergency actions are not overly restrictive.
- Reward Calculation Verification: Test if staking rewards and pool ratios are calculated correctly after staking and withdrawing actions. Ensure that updates to rewards are triggered as expected.
- Dynamic Testing for Pool Operations: Perform dynamic tests to ensure that pool ratios and user claimable amounts are updated correctly.
- Secure oracle usage: If the contract relies on external oracles, are they protected against manipulation?
- Secure Randomness: Ensure that random number generation is not predictable or manipulable, especially in lottery or staking functionalities.
- Oracle Manipulation: Test contracts for potential oracle manipulation that could lead to pricing or staking rewards being incorrectly calculated.
- Proper data validation: Are inputs and outputs validated properly to prevent data integrity issues?
- Correct cryptography implementation: Are cryptographic methods and hashing applied according to best practices?
- Access control and authentication: Are there any vulnerabilities allowing unauthorized users to access restricted functions?
- Injection mitigation: Ensure the contract is not vulnerable to data or command injection.
- Admin Bypass Testing: Attempt to bypass admin privileges or role restrictions by manipulating function parameters or transaction sequences.
- Test Role-based Enhancements: Verify that role-based enhancements are structured properly, ensuring that only authorized users can perform specific actions.
- MythX: Automatically analyze contracts for common vulnerabilities.
- Slither: Detect logic vulnerabilities, reentrancy issues, and gas optimizations.
- Manticore: Symbolic execution and fuzzing tool for smart contracts.
- Oyente: Static analyzer to find issues like reentrancy, uncontrolled loops, and others.
- Adhere to Versioning: Ensure the contract explicitly defines the Solidity or Algorand version (
pragma version
) being used to avoid unintended behavior during compilatio. - Boundaries for Function Parameters: Check that input values for functions have well-defined boundaries, such as ensuring array sizes or transaction amounts are reasonable.