A cloud-native cybersecurity platform built on AWS Serverless architecture that leverages hybrid Machine Learning to detect, analyze, alert, and automatically block account takeover and session hijacking attempts in real time.
The platform enforces Continuous Behavioral Authentication. Rather than trusting static passwords alone, incoming telemetry is evaluated by an ML inference pipeline to automatically neutralize compromised sessions.
flowchart TD
subgraph CLIENT["Dual-Persona Client Suite"]
U1["🛡️ User Security Portal (Live Siren & Kill Switch)"]
U2["⚡ Red Team Attack Studio (Tokyo Travel, Tor, Brute Force)"]
U3["🛰️ Blue Team SOC Visualizer (SVG Gauge & Flight Map)"]
end
subgraph GATEWAY["Amazon API Gateway & Ingestion"]
GW["REST API Gateway (CORS Enabled)"]
V["Pydantic Validation • XSS/NoSQL Sanitizer • Sliding-Window Rate Limiter"]
end
subgraph COMPUTE["AWS Lambda Serverless Microservices"]
L1["Auth & Session Handler<br/>(PBKDF2-SHA256, Kill Switch)"]
L2["ML Risk Engine<br/>(Hybrid Anomaly Pipeline)"]
L3["Alert Dispatcher<br/>(Web Audio Siren & SNS)"]
end
subgraph ML["Hybrid Machine Learning Models"]
M1["Scikit-Learn Random Forest (Supervised Risk)"]
M2["Scikit-Learn Isolation Forest (Zero-Day Outlier)"]
M3["TensorFlow Deep Autoencoder (Reconstruction MSE Loss)"]
end
subgraph STORAGE["Telemetry & Storage Layer"]
CW["Amazon CloudWatch (Metrics, Alarms, Logs)"]
SNS["Amazon SNS (Alert Topics)"]
DB["MongoDB / Local Document Store"]
end
CLIENT -->|HTTPS / REST| GW --> V --> COMPUTE
L2 --> ML
COMPUTE --> STORAGE
L3 -.->|Live In-App Siren Alarm| U1
Incoming sessions are transformed into a normalized behavioral vector:
| Feature | Description | Anomaly Trigger |
|---|---|---|
geo_velocity_kmh |
Haversine velocity between successive logins |
|
distance_km |
Physical geographic distance from baseline | Sudden intercontinental jump |
device_distance |
Canvas fingerprint, OS, user-agent divergence | Unrecognized hardware canvas |
ip_reputation |
Tor exit relays and datacenter proxies | Verified Tor exit node ( |
failed_attempts_burst |
Velocity of recent failed password attempts | |
circadian_anomaly |
Deviation from historical active login hours | Activity during off-hours |
bot_signature |
Headless browser markers and automation flags | Automation signals detected |
-
Scikit-Learn Random Forest: Evaluates supervised compromise probability (
$0 - 100%$ ). - Scikit-Learn Isolation Forest: Identifies unsupervised zero-day behavioral anomalies.
-
TensorFlow Deep Autoencoder (7-4-2-4-7): Flags anomalies when reconstruction error exceeds threshold (
$\text{MSE} > 0.12$ ). - Explainable AI (XAI): Generates human-readable factor attribution weights for every security event.
| Risk Score | Action | Automated Enforcement |
|---|---|---|
| 0 – 39 | ALLOW |
Standard session access granted |
| 40 – 69 | CHALLENGE_MFA |
Adaptive Step-Up 6-digit OTP verification challenge |
| 70 – 100 | BLOCK_SESSION |
Session revoked, Web Audio siren sounds, CloudWatch incremented, SNS dispatched |
-
PBKDF2-HMAC-SHA256: 200,000 hashing rounds with 16-byte cryptographic salts (
secrets.token_hex). - Sliding-Window Rate Limiting: 5 failed login attempts per 10-minute window enforces a 15-minute lockout.
-
Input Sanitization: Neutralizes XSS tags and NoSQL injection operators (
$where,$gt,$ne, prototype pollution). - Anti-Enumeration Generic Messaging: Standardized "Invalid credentials or account restricted" responses.
- Primary Device Governance & Kill Switch: Master device retains sole revocation authority over secondary sessions.
Zero AWS cloud dependencies or external databases required—includes built-in local document storage and SIEM telemetry.
- Python 3.10+ (tested on Python 3.10 – 3.14)
# Clone & enter directory
cd aws-security-main
# Install dependencies
pip install -r requirements.txt
# Run automated tests
python -m unittest tests/test_backend.pypython run_standalone.pyOpen http://127.0.0.1:8000 in your browser. (Or use docker-compose up --build)
| Persona | Password | Baseline Location | |
|---|---|---|---|
| Primary Demo User | demo@awssecurity.io |
AWSSecurity#2026 |
New York, US |
| Legacy Demo User | demo@aegisguard.io |
AegisGuard#2026 |
New York, US |
Demonstrate real-time attack detection and automated prevention on a single machine:
- Browser 1 (Chrome — Legitimate User):
- Go to
http://127.0.0.1:8000, click👤 Fill Demo User (Sachin), and log in. - Click
🛡️ Yes, Register as My Primary Devicewhen prompted. Notice🔊 Sound: ON.
- Go to
- Browser 2 (Edge / Incognito — Attacker):
- Open
http://127.0.0.1:8000and switch to the⚡ Attack Simulatortab. - Select
demo@awssecurity.ioand clickLaunch Scenariounder Impossible Travel (Tokyo, 8,500 km/h).
- Open
- Observe Automated Defense in Browser 1:
- Within 2 seconds, Browser 1 sounds an audible siren alarm and displays a pulsing crimson alert banner.
- The threat card arrives in the Security Alerts Inbox with an XAI factor breakdown.
- Switch to
🛰️ SOC Blue Teamto inspect the SVG risk needle spike and the flight trajectory map. - Switch to
📊 Telemetry & SIEMto verify thatBlockedHijacksincremented in CloudWatch.
Deploy the serverless stack to AWS using the provided SAM template (aws/template.yaml):
cd aws
sam build
sam deploy --guidedProvisions: Amazon API Gateway, 3 AWS Lambda functions (Auth, Risk Engine, Alert Dispatcher), CloudWatch Log Group (/aws/lambda/AccountHijackRiskEngine), CloudWatch Alarm (HighRiskRateAlarm), and Amazon SNS Topic.
aws-security-main/
├── README.md # System overview & quickstart
├── PRACTICE.md # Viva defense guide & exam Q&A
├── requirements.txt # Python dependencies (FastAPI, Scikit-learn, etc.)
├── run_standalone.py # Zero-AWS one-click standalone runner
├── docker-compose.yml # Multi-container Docker setup with MongoDB 7.0
├── aws/ # SAM template, CloudWatch dashboard & Lambda handlers
├── backend/ # FastAPI REST API, hybrid ML models & security controls
├── database/ # Transparent document store & MongoDB schemas
└── frontend/ # Dual-persona UI (User Portal, Attack Studio, SOC, SIEM)
This project is licensed under the MIT License.