Zokyo Automated Tools
  • πŸ€–Unlocking Smart Contract Security: A Comprehensive Guide to Automated Vulnerability Analysis
  • 🐍Mastering Slither: A Comprehensive Guide to Smart Contract Vulnerability Detection
    • πŸš€Prerequisites
      • πŸ’»Code Editor
      • 🐍Setting up Python and Configuring Virtual Environments
      • πŸ”­Setting Up Git
      • πŸ‘ŠGit Bash
    • ⚑What Is Static Analysis
    • 🐍What Is Slither
    • πŸ“©Setting Up Slither: Installation and Virtual Environment Configuration
    • πŸ”©Installing solc and Crytic Compile: Foundation Tools for Slither
    • πŸ”Analyzing Smart Contracts Locally with Slither
      • πŸ—ΊοΈHandling Import Errors in Slither: A Guide on Solc Remappings
      • πŸ›£οΈHandling Path Errors In Slither
    • 🌍Analyzing Smart Contracts Already Deployed On Main-nets
    • πŸ”ŒExploring Slither's Tools and Printers: A Comprehensive Tutorial
    • πŸ€–Using Bash Scripts for Batch Analysis with Slither
    • πŸ’»Slither Intermediate Representation
    • 🌐Slither Python API
    • ⚠️Custom Detectors in Slither
      • 🀝Leveraging Custom Detectors from the Community
        • πŸ€—Leveraging Custom Detectors from the Community: Spotlight on the pessimistic.io Team
      • 🌱Making your own detectors
  • βš›οΈOyente: Symbolic Execution Tool
    • 😎What Is Symbolic Execution?
Powered by GitBook
On this page
  1. Mastering Slither: A Comprehensive Guide to Smart Contract Vulnerability Detection

Custom Detectors in Slither

PreviousSlither Python APINextLeveraging Custom Detectors from the Community

Last updated 1 year ago

Custom detectors in Slither are user-defined modules that allow users to augment the analysis capabilities of Slither by defining specific rules or conditions to detect issues or patterns within smart contracts that are not covered by Slither's built-in detectors. These custom detectors enable users to tailor the security analysis to meet the unique needs of their projects, ensuring that the contracts comply with specific coding standards, security practices, or project-specific requirements.

What are Custom Detectors Used For?

  • Enhanced Customization: Custom detectors allow for enhanced customization of the analysis process, enabling users to focus on specific areas of interest or concern in the smart contracts.

  • Project-Specific Rules: They enable the enforcement of project-specific rules, coding standards, and security practices.

  • Automated Analysis: Custom detectors automate the analysis of specific patterns or issues, integrating these checks into the automated analysis process executed by Slither.

How Do Custom Detectors Work?

Custom detectors are Python scripts that define a class inheriting from Slither's core detector class. These detectors override specific methods to implement the custom detection logic.

  1. Initialization: The detector is initialized, setting up necessary metadata and configurations.

  2. Detection Logic: The detector defines a _detect method where the detection logic is implemented. This method contains the code that analyzes the smart contract's elements such as functions, variables, and modifiers.

  3. Result Reporting: If an issue or pattern is detected, the detector reports it, and it gets integrated into Slither's overall analysis report.

How to Create a Custom Detector?

  1. Define the Detector Class: Start by defining a Python class for your detector that inherits from the Detector class from Slither’s API.

  2. Implement Detection Logic: Implement the _detect method within your class to define the detection logic.

  3. Configure Metadata: Set up metadata like the detector's name, description, and severity.

Conclusion

Custom detectors in Slither offer a powerful way to enhance and tailor the security analysis process. By creating custom detectors, users can ensure that the analysis is aligned with the specific needs, rules, and standards of their projects, providing a more comprehensive and relevant analysis result. When implementing custom detectors, it's essential to have a good understanding of Slither’s architecture and the smart contract elements you wish to analyze to define effective detection rules.

🐍
⚠️
Book an audit with Zokyo