AI-Powered Firmware Security Analysis Platform with Binary Decompilation
SpecTrace is an advanced cybersecurity platform that combines cutting-edge AI algorithms with Ghidra's powerful binary analysis capabilities to provide comprehensive firmware security analysis, vulnerability detection, and compliance validation.
SpecTrace revolutionizes firmware security analysis by offering both text-based and binary-based analysis workflows. Upload source code or binary firmware files, and get detailed security insights powered by OpenAI's GPT-4 and NSA's Ghidra decompiler.
- π§ Binary Decompilation: Convert firmware binaries to readable assembly/C code using Ghidra
- π€ AI Security Analysis: GPT-4 powered vulnerability detection and risk assessment
- π Compliance Validation: Automated security compliance checking
- π Change Analysis: Compare firmware versions and track modifications
- π¨ Modern Interface: Intuitive React dashboard with real-time progress tracking
- Multi-Format Support: ELF, PE, Mach-O, Intel HEX, raw binaries
- Architecture Detection: Automatic CPU architecture identification
- Decompilation: Assembly disassembly and high-level C code generation
- Metadata Extraction: Compiler info, build details, and binary characteristics
- Vulnerability Detection: Buffer overflows, hardcoded credentials, memory issues
- Risk Assessment: CRITICAL, HIGH, MEDIUM, LOW severity classification
- Pattern Recognition: Common attack vectors and security anti-patterns
- Compliance Checking: Industry standard security requirement validation
- Text Mode: Direct source code analysis (.asm, .c, .h files)
- Binary Mode: Automatic decompilation + analysis workflow
- Dual Comparison: Compare old vs new firmware versions
- Specification Validation: Ensure code matches documentation
- Drag & Drop Upload: Intuitive file handling
- Real-Time Progress: Live analysis status with detailed steps
- Comprehensive Reports: Detailed findings with actionable recommendations
- Debug Panel: Development insights and API call monitoring
spectrace/
βββ π api/ # FastAPI Backend
β βββ π services/ # Core analysis services
β β βββ ghidra_service.py # Binary decompilation
β β βββ code_analyzer.py # AI code analysis
β β βββ spec_analyzer.py # Specification analysis
β β βββ compliance_analyzer.py # Compliance validation
β βββ π routes/ # API endpoints
β βββ π middleware/ # Error handling & logging
β βββ π tests/ # Automated tests
β βββ π main.py # Application entry point
βββ π dashboard/ # React Frontend
β βββ π src/
β β βββ π pages/ # Main application pages
β β βββ π components/ # Reusable UI components
β β βββ π lib/ # Utility functions
β β βββ π hooks/ # Custom React hooks
βββ π features/ # Feature documentation
βββ π docs/ # Installation & setup guides
βββ π files/ # Sample test files
βββ π images/ # Screenshots & assets
βββ π³ Dockerfile # Container configuration
βββ π³ docker-compose.yml # Multi-service orchestration
βββ π README.md # This file
| Component | Technology | Purpose |
|---|---|---|
| Framework | FastAPI | High-performance async API |
| Language | Python 3.11+ | Core application logic |
| AI Engine | OpenAI GPT-4 | Security analysis & insights |
| Binary Analysis | Ghidra 11.0.3+ | Firmware decompilation |
| Database | In-memory | Session state management |
| Testing | pytest | Automated testing |
| Component | Technology | Purpose |
|---|---|---|
| Framework | React 18 + TypeScript | User interface |
| Build Tool | Vite | Fast development & building |
| Styling | Tailwind CSS | Responsive design |
| Components | shadcn/ui + Radix UI | Accessible components |
| State Management | React Hooks | Application state |
| HTTP Client | Fetch API | Backend communication |
| Component | Technology | Purpose |
|---|---|---|
| Containerization | Docker + Docker Compose | Deployment & development |
| Web Server | Uvicorn | ASGI server |
| Reverse Proxy | Built-in CORS | Cross-origin requests |
| File Storage | Local filesystem | Temporary file handling |
- OpenAI API Key (required for AI analysis)
- Internet Connection (for AI API calls and package downloads)
- 4GB+ RAM (for Ghidra binary analysis)
- 2GB+ Disk Space (for Ghidra installation and temporary files)
| Platform | Requirements | Installation Guide |
|---|---|---|
| πͺ Windows | Python 3.11+, Node.js 18+, Java 17+, Git | π Windows Setup |
| π macOS | Python 3.11+, Node.js 18+, Java 17+, Homebrew | π macOS Setup |
| π§ Linux | Python 3.11+, Node.js 18+, Java 17+, wget/curl | π Linux Setup |
| π³ Docker | Docker Desktop or Docker Engine | π Docker Setup |
Fastest way to get started with zero configuration:
# 1. Clone the repository
git clone https://github.com/your-repo/spectrace.git
cd spectrace
# 2. Create environment configuration
echo "OPENAI_API_KEY=your_openai_api_key_here" > .env
# 3. Launch the platform
docker-compose up --buildπ Access the application:
- Dashboard: http://localhost:5173
- API: http://localhost:8000
- API Docs: http://localhost:8000/docs
Choose your platform-specific guide:
- πͺ Windows: Follow Windows Setup Guide
- π macOS: Follow macOS Setup Guide
- π§ Linux: Follow Linux Setup Guide
π Text Mode: Upload source code files directly
- Supported:
.asm,.c,.h,.txtfiles - Use case: When you have firmware source code
π§ Binary Mode: Upload firmware binaries for decompilation
- Supported:
.bin,.elf,.exe,.hexfiles - Use case: When you only have compiled firmware
Required Files:
- Firmware Files: 2 versions (original + updated)
- Specifications: 2 versions (original + updated documentation)
File Size Limits:
- Text files: 50MB max
- Binary files: 100MB max
- Specifications: 10MB max
The platform automatically:
- π Prepares Analysis: Validates files and sets up environment
- π§ Decompiles Binaries: Converts binaries to readable code (if binary mode)
- π Analyzes Code: AI-powered security analysis and comparison
- π Processes Specs: Documentation analysis and change detection
- β Validates Compliance: Checks code-to-spec alignment
- π Generates Report: Comprehensive results with recommendations
Report Sections:
- π¨ Security Findings: Vulnerabilities with severity ratings
- π Risk Assessment: Overall security posture
- π Change Analysis: Code modifications and their impact
- π Compliance Status: Documentation alignment score
- π‘ Recommendations: Actionable security improvements
POST /api/v1/decompile
Content-Type: multipart/form-data
# Upload binary file for decompilation
# Returns: Assembly code + decompiled C codePOST /api/v1/compare-code
Content-Type: application/json
# Compare two firmware code versions
# Returns: Security findings + risk assessmentPOST /api/v1/compare-specs
Content-Type: application/json
# Compare two specification versions
# Returns: Feature changes + behavioral analysisPOST /api/v1/validate-compliance
Content-Type: application/json
# Validate code-to-specification alignment
# Returns: Compliance score + mismatchesπ Full API Documentation: http://localhost:8000/docs
| Format | Extension | Architecture | Use Case |
|---|---|---|---|
| ELF | .elf |
Linux/Embedded | Linux executables, IoT firmware |
| PE | .exe, .dll |
Windows | Windows programs, drivers |
| Mach-O | .app, .dylib |
macOS | macOS applications |
| Intel HEX | .hex, .ihex |
Embedded | Microcontroller firmware |
| Raw Binary | .bin, .img |
Various | Custom firmware images |
| S-Record | .s19, .srec |
Embedded | Motorola S-record format |
cd api
pytest -v # Run all tests
pytest tests/test_ghidra* # Test Ghidra integration
python run_tests.py # Custom test configurationcd dashboard
npm test # Run React tests
npm run lint # Check code quality
npm run type-check # TypeScript validation# Test complete workflow with sample files
cd api
python -c "
import asyncio
from services.ghidra_service import GhidraDecompiler
async def test():
decompiler = GhidraDecompiler()
print('β
Ghidra integration ready!')
asyncio.run(test())
"# 1. Clone and setup
git clone https://github.com/your-repo/spectrace.git
cd spectrace
# 2. Backend development
cd api
pip install -r requirements.txt
python main.py
# 3. Frontend development
cd dashboard
npm install
npm run devBackend (API)
python main.py # Start development server
pytest # Run tests
python run_tests.py # Custom test runner
uvicorn main:app --reload # Alternative server startFrontend (Dashboard)
npm run dev # Development server
npm run build # Production build
npm run preview # Preview production build
npm run lint # Code linting
npm run type-check # TypeScript checking# Required
OPENAI_API_KEY=sk-... # Your OpenAI API key
# Optional
GHIDRA_INSTALL_DIR=/opt/ghidra # Ghidra installation path
JAVA_HOME=/usr/lib/jvm/java-17 # Java installation path
DEBUG=true # Enable debug loggingSpecTrace was developed by the following team for the AI Cybersecurity Hackathon - Sponsored by SAP & KPMG:
- Richard Meinsen
- Joseph Chris Adrian
- Javier Peres
- Julian Stosse
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright Β© 2025 SpecTrace Team Hackathon
π‘οΈ SpecTrace - Revolutionizing Firmware Security with AI
Built with β€οΈ for the cybersecurity community
π Website β’ π Documentation β’ π¬ Community β’ π¦ Twitter




