Skip to content

x4r5h/API-Abuse-Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

28 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

API Abuse Detection Platform

Dashboard Preview

Real-time API threat detection and mitigation for FinTech systems

Python Flask License

๐ŸŽฏ Problem Statement

FinTech platforms face critical security challenges:

  • Rate Abuse: Attackers flood APIs with excessive requests
  • Credential Stuffing: Repeated authentication failures signal brute-force attempts
  • Suspicious Patterns: Unusual endpoint access sequences indicate malicious behavior
  • Limited Visibility: Traditional monitoring misses security threats at the API level

Sentinel Protocol addresses these gaps with intelligent, real-time threat detection.


โœจ Key Features

๐Ÿ”’ Security & Detection

  • Multi-Layer Threat Detection Engine

    • Rate limit abuse (>100 req/min threshold)
    • Failed authentication tracking (>5 failures in 10min)
    • Transaction anomaly detection (no balance check before payment)
    • Honeypot endpoint for attacker identification
  • Intelligent Pattern Recognition

    • Correlated incident analysis
    • Geographic anomaly detection
    • Behavioral fingerprinting

๐Ÿ“Š Real-Time Monitoring

  • Live Dashboard with ECharts visualizations
  • Request Timeline showing traffic patterns
  • Alert System with severity levels (CRITICAL/HIGH/MEDIUM/LOW)
  • IP Management with whitelist/blacklist controls

๐Ÿ›ก๏ธ Automated Mitigation

  • Rate Limiting via Redis (100 req/min per IP)
  • Automatic IP Blocking with configurable duration
  • Multi-IP Simulation using X-Simulated-IP headers
  • Export & Reporting (CSV/JSON formats)

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Mock FinTech   โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚  Logging Layer   โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚   SQLite DB     โ”‚
โ”‚     APIs        โ”‚     โ”‚  (Middleware)    โ”‚     โ”‚   (Indexed)     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ”‚
                                โ–ผ
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚  Detection Engine     โ”‚
                    โ”‚  (Background Thread)  โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ”‚
                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                โ–ผ               โ–ผ               โ–ผ
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚  Alerts  โ”‚    โ”‚ Blocking โ”‚    โ”‚  Redis   โ”‚
        โ”‚ Database โ”‚    โ”‚  System  โ”‚    โ”‚  Cache   โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ”‚
                                โ–ผ
                        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                        โ”‚   Dashboard   โ”‚
                        โ”‚   (React UI)  โ”‚
                        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.9+
  • Redis (optional, falls back to in-memory storage)

Installation

  1. Clone the repository
git clone https://github.com/x4r5h/API-Abuse-Detection.git
cd API-Abuse-Detection
  1. Install dependencies
pip install flask flask-cors redis
  1. Start Redis (optional but recommended)
redis-server
  1. Run the application
python app.py
  1. Access the dashboard
http://localhost:5000

๐ŸŽฎ Demo & Testing

Simulate Normal Traffic

Open APIabuser.html in your browser and click "Start Normal Traffic"

  • Realistic user behavior with varied timing
  • Proper authentication flow
  • Expected endpoint sequences

Launch Attack Simulations

  1. Rate Limit Attack: Single IP exceeding 100 req/min
  2. Distributed DDoS: Multiple IPs flooding simultaneously
  3. Brute Force: Multiple failed authentication attempts
  4. Honeypot Trigger: Accessing admin endpoints
  5. Combined Attack: Real-world botnet simulation

View Results

  • Dashboard updates in real-time
  • Alerts appear with severity indicators
  • IPs get automatically blocked
  • Logs captured with full details

๐Ÿ“ Project Structure

sentinel-protocol/
โ”œโ”€โ”€ app.py                      # Flask backend with detection engine
โ”œโ”€โ”€ templates/
โ”‚   โ”œโ”€โ”€ index.html             # Main dashboard
โ”‚   โ”œโ”€โ”€ logs.html              # Log analysis page
โ”‚   โ”œโ”€โ”€ alerts.html            # Security alerts page
โ”‚   โ””โ”€โ”€ ip-management.html     # IP control panel
โ”œโ”€โ”€ static/
โ”‚   โ””โ”€โ”€ js/
โ”‚       โ”œโ”€โ”€ main.js            # Dashboard logic
โ”‚       โ”œโ”€โ”€ logs.js            # Log filtering & export
โ”‚       โ”œโ”€โ”€ alerts.js          # Alert management
โ”‚       โ””โ”€โ”€ ip-management.js   # IP whitelist/blacklist
โ”œโ”€โ”€ APIabuser.html                # Multi-IP attack simulator
โ”œโ”€โ”€ main.db                    # SQLite database (auto-created)
โ””โ”€โ”€ README.md

๐Ÿ” Detection Rules

Threat Type Condition Action
Rate Abuse >100 requests/min from single IP Block 5 min
Failed Auth >5 failed auth in 10 min Block 30 min
Transaction Anomaly Payment without balance check Alert MEDIUM
Honeypot Access Any request to /api/admin/* Block 1 hour + CRITICAL alert

๐ŸŽจ Dashboard Features

๐Ÿ“ˆ Real-Time Metrics

  • Total requests (1-hour window)
  • Failed request rate
  • Active security alerts
  • Currently blocked IPs

๐Ÿ“Š Visualizations

  • Traffic Timeline: Request volume over time (ECharts line chart)
  • Top Endpoints: Most-accessed APIs (pie chart)
  • Alert Feed: Live security incidents with severity badges
  • IP Geolocation: World map showing threat origins

๐Ÿ”ง Management Tools

  • IP Whitelist/Blacklist: Manual access control
  • Alert Resolution: One-click incident closure
  • Log Export: CSV download for forensics
  • Auto-Refresh: 10-second interval updates

๐Ÿ› ๏ธ Tech Stack

Category Technologies
Backend Python, Flask, SQLite
Caching Redis (with in-memory fallback)
Frontend HTML5, Tailwind CSS, Vanilla JS
Charts ECharts 5.4.3
Animations Anime.js 3.2.1

๐Ÿ“Š API Endpoints

Mock FinTech APIs

GET  /api/balance           # Check account balance
POST /api/transaction       # Process payment
GET  /api/history          # Transaction history

Monitoring APIs

GET  /api/monitoring/stats              # Platform statistics
GET  /api/monitoring/timeline           # Traffic over time
GET  /api/monitoring/alerts             # Security alerts
GET  /api/monitoring/blocked            # Blocked IPs
POST /api/monitoring/block-ip           # Manual IP block
POST /api/monitoring/alert/:id/resolve  # Resolve alert
GET  /api/monitoring/compliance-report"  #compliance-report

๐Ÿงช Testing Workflow

  1. Baseline: Run normal traffic for 2 minutes
  2. Attack 1: Launch rate limit attack โ†’ Verify auto-blocking
  3. Attack 2: Trigger brute force โ†’ Check failed auth alerts
  4. Attack 3: Access honeypot endpoint โ†’ Confirm CRITICAL alert
  5. Attack 4: Combined attack โ†’ Validate correlation detection
  6. Cleanup: Resolve alerts and unblock IPs via dashboard

๐Ÿšง Future Enhancements

  • Machine learning-based anomaly scoring
  • Webhook integration for Slack/Teams alerts
  • GraphQL API support
  • Kubernetes-native deployment
  • OAuth2 flow monitoring
  • API key rotation recommendations

๐Ÿ‘ฅ Team

Built with โค๏ธ by Team AAH for Finnovate Hackathon (Track 6)

About

Real-time API threat detection and mitigation for FinTech systems

Topics

Resources

Stars

Watchers

Forks