Skip to content

ayush-roy-21/SC-Vulnerability-Scanner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ Smart Contract Vulnerability Scanner

πŸš€ Live Demo

Check out the project in action here:
Live Demo License: MIT

A comprehensive smart contract security analysis tool combining static analysis and symbolic execution capabilities for thorough security assessment of Ethereum smart contracts.

πŸ“Έ Live Preview:

SC.Vulnerability.Scanner.Demo.video.mp4

✨ Key Features

  • Static Analysis: Slither-like capabilities including control/data flow analysis and pattern matching.
  • Symbolic Execution: Mythril-like path exploration and constraint solving to detect complex attack vectors.
  • Interactive Web Interface: Upload contracts, view vulnerability reports, and get security recommendations.
  • Detects: Reentrancy, Arithmetic Overflows/Underflows, Access Control Issues, and Gas Inefficiencies.

πŸ› οΈ Tech Stack

  • Frontend: React, TypeScript
  • Backend: Python, Flask/FastAPI
  • Target: Solidity Smart Contracts

πŸ—οΈ System Architecture

A comprehensive smart contract security analysis tool combining static analysis and symbolic execution capabilities for thorough security assessment of Ethereum smart contracts.

System Architecture

+------------------+      +------------------+      +------------------+
|     Frontend     |      |     Backend      |      | Smart Contracts |
|     (React)      |<---->|    (Python)      |<---->|   (Solidity)    |
+------------------+      +------------------+      +------------------+
| β€’ Contract Form  |      | β€’ Static Analysis|      | β€’ AST Analysis  |
| β€’ Results View   |      | β€’ Symbolic Exec  |      | β€’ Vulnerability |
| β€’ Vulnerability  |      | β€’ Detectors      |      |   Patterns      |
|   Dashboard      |      | β€’ API Endpoints  |      | β€’ Test Cases    |
+--------+---------+      +--------+---------+      +--------+--------+
         |                         |                         |
         v                         v                         v
+------------------+      +------------------+      +------------------+
|    External      |      |    Database      |      |   Blockchain    |
|    Services      |      |    (Results)     |      |   Networks      |
+------------------+      +------------------+      +------------------+
| β€’ Code Repos     |      | β€’ Scan History  |      | β€’ Mainnet       |
| β€’ Documentation  |      | β€’ Vulnerabilities|      | β€’ Testnet       |
| β€’ Updates        |      | β€’ Analytics      |      | β€’ Local Node    |
+------------------+      +------------------+      +------------------+

Analysis Flow

Backend Flow

flowchart TB
    A[Contract Input] --> B[Static Analyzer]
    A --> C[Symbolic Executor]
    B --> D[Detectors]
    C --> D
    D --> E[Access Control]
    D --> F[Arithmetic]
    D --> G[Gas]
    D --> H[Reentrancy]
    E & F & G & H --> I[Analysis Results]
    I --> J[API Response]
Loading

Frontend Flow

flowchart TB
    A[Contract Form] --> B[Contract Analysis Page]
    B --> C[Analysis Results]
    C --> D[Vulnerability Report]
    D --> E[Issue Details]
    D --> F[Stats Summary]
    D --> G[Vulnerability Chart]
    E & F & G --> H[Dashboard]
    H --> I[Recent Scans]

style A fill:#f9f,stroke:#333
style H fill:#bbf,stroke:#333
Loading

Features

  • Static Analysis (Slither-like capabilities)

    • Control flow analysis
    • Data flow analysis
    • Pattern matching for known vulnerabilities
    • State variable analysis
  • Symbolic Execution (Mythril-like capabilities)

    • Path exploration
    • Constraint solving
    • Transaction sequence analysis
    • Attack vector detection
  • Web Interface

    • Interactive vulnerability reports
    • Code visualization
    • Audit trail
    • Security recommendations

Project Structure

.
β”œβ”€β”€ backend/                    # Python backend
β”‚   β”œβ”€β”€ analyzers/             # Analysis engines
β”‚   β”‚   β”œβ”€β”€ ast_parser.py      # Solidity AST parsing
β”‚   β”‚   β”œβ”€β”€ static_analyzer.py # Static analysis
β”‚   β”‚   └── symbolic_executor.py # Symbolic execution
β”‚   β”œβ”€β”€ detectors/             # Vulnerability detectors
β”‚   β”‚   β”œβ”€β”€ access_control_detector.py
β”‚   β”‚   β”œβ”€β”€ arithmetic_detector.py
β”‚   β”‚   β”œβ”€β”€ gas_detector.py
β”‚   β”‚   └── reentrancy_detector.py
β”‚   β”œβ”€β”€ tests/                 # Test suite
β”‚   β”‚   └── contracts/         # Test contracts
β”‚   β”œβ”€β”€ app.py                 # Main application
β”‚   └── requirements.txt       # Python dependencies
β”œβ”€β”€ frontend/                  # React frontend
β”‚   β”œβ”€β”€ src/                  
β”‚   β”‚   β”œβ”€β”€ components/        # Reusable components
β”‚   β”‚   β”œβ”€β”€ pages/            # Main application pages
β”‚   β”‚   β”œβ”€β”€ theme/            # UI theme configuration
β”‚   β”‚   └── utils/            # Helper utilities
β”‚   β”œβ”€β”€ package.json          # NPM dependencies
β”‚   └── tsconfig.json         # TypeScript config
└── scripts/                  # Utility scripts

Setup

  1. Backend Setup
cd backend
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt
  1. Frontend Setup
cd frontend
npm install

Running the Application

  1. Start the Backend
cd backend
python app.py
  1. Start the Frontend
cd frontend
npm start

Running Security Scans

  1. Using the Web Interface:

    • Navigate to the web UI (default: http://localhost:3000)
    • Upload your smart contract file
    • Click "Analyze Contract"
    • View detailed vulnerability report
  2. Using Command Line:

# Start the backend server
cd backend
python app.py

# In another terminal, analyze a contract
curl -X POST -F "file=@path/to/contract.sol" http://localhost:5000/analyze

Supported Vulnerability Types

  • Access Control Issues
  • Arithmetic Vulnerabilities (Overflow/Underflow)
  • Gas Optimization Issues
  • Reentrancy Vulnerabilities
  • And more...

Development

Running Tests

  1. Backend Tests:
cd backend
python -m pytest tests/
  1. Frontend Tests:
cd frontend
npm test

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run the test suite
  5. Submit a pull request

License

MIT License

Copyright (c) 2025 Smart Contract Vulnerability Scanner

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files.

About

A comprehensive smart contract security analysis tool combining static analysis and symbolic execution to detect Solidity vulnerabilities.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors